:root {
  --vg-ink: #08172f;
  --vg-muted: #5d6877;
  --vg-line: #d9e2ea;
  --vg-soft-line: #edf2f6;
  --vg-bg: #f6fafc;
  --vg-paper: #fff;
  --vg-green: #0ca35b;
  --vg-green-dark: #067042;
  --vg-green-soft: #eaf8f1;
  --vg-blue: #1f72d8;
  --vg-blue-soft: #edf5ff;
  --vg-pink: #e64d83;
  --vg-pink-soft: #fff0f6;
  --vg-amber: #f0a11f;
  --vg-amber-soft: #fff5df;
  --vg-shadow: 0 16px 40px rgba(8, 23, 47, .08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.voice-generator-page {
  margin: 0;
  background: linear-gradient(180deg, #fbfdfc 0, var(--vg-bg) 360px, #f7fafc 100%);
  color: var(--vg-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.65;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.vg-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 clamp(18px, 4vw, 54px);
  border-bottom: 1px solid var(--vg-line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
}

.vg-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--vg-ink);
  text-decoration: none;
  font-size: 22px;
  font-weight: 950;
}

.vg-logo {
  width: 38px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.vg-logo i {
  display: block;
  width: 5px;
  border-radius: 999px;
  background: var(--vg-green);
}

.vg-logo i:nth-child(1) { height: 18px; }
.vg-logo i:nth-child(2) { height: 30px; }
.vg-logo i:nth-child(3) { height: 42px; }
.vg-logo i:nth-child(4) { height: 26px; }

.vg-header nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vg-header nav a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid var(--vg-line);
  border-radius: 8px;
  background: #fff;
  color: #2d3a4c;
  text-decoration: none;
  font-weight: 900;
}

main {
  width: min(100%, 1500px);
  margin: 0 auto;
  padding: clamp(18px, 2.5vw, 34px) clamp(14px, 2.8vw, 32px) 0;
}

.vg-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 340px);
  align-items: end;
  gap: 28px;
  margin-bottom: 22px;
}

.vg-hero-copy {
  display: grid;
  gap: 8px;
}

.vg-kicker {
  width: fit-content;
  margin: 0;
  padding: 5px 12px;
  border: 1px solid #bfe8d2;
  border-radius: 999px;
  background: var(--vg-green-soft);
  color: var(--vg-green-dark);
  font-size: 15px;
  font-weight: 950;
}

.vg-hero h1 {
  margin: 0;
  color: var(--vg-ink);
  font-size: clamp(40px, 4.4vw, 66px);
  line-height: 1.07;
  font-weight: 950;
}

.vg-lead {
  max-width: 940px;
  margin: 0;
  color: #243247;
  font-size: clamp(18px, 1.7vw, 24px);
  font-weight: 780;
}

.vg-hero-actions {
  display: grid;
  gap: 12px;
}

.vg-hero-primary,
.vg-hero-secondary {
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  text-decoration: none;
  font-size: 18px;
  font-weight: 950;
}

.vg-hero-primary {
  background: var(--vg-green);
  color: #fff;
  box-shadow: 0 14px 30px rgba(12, 163, 91, .24);
}

.vg-hero-secondary {
  border: 1px solid var(--vg-line);
  background: #fff;
  color: var(--vg-blue);
}

.vg-studio {
  display: grid;
  grid-template-columns: minmax(520px, 1.05fr) minmax(500px, .95fr);
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid var(--vg-line);
  border-radius: 8px;
  background: var(--vg-paper);
  box-shadow: var(--vg-shadow);
}

.vg-stage-nav {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--vg-line);
  background: #fff;
}

.vg-stage-nav span {
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #4c5b6e;
  font-size: 18px;
  font-weight: 900;
}

.vg-stage-nav span + span {
  border-left: 1px solid var(--vg-soft-line);
}

.vg-stage-nav b {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e9eef3;
  color: #405066;
  font-size: 18px;
  font-weight: 950;
}

.vg-stage-nav .is-active {
  color: var(--vg-green-dark);
  box-shadow: inset 0 -3px 0 var(--vg-green);
}

.vg-stage-nav .is-active b {
  background: var(--vg-green);
  color: #fff;
}

.vg-panel {
  min-width: 0;
  padding: clamp(18px, 2.2vw, 28px);
}

.vg-script-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--vg-soft-line);
}

.vg-control-panel {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #fff 0, #fbfdfd 100%);
}

.vg-panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.vg-panel-head p,
.vg-block-head p {
  margin: 0 0 3px;
  color: var(--vg-green-dark);
  font-size: 14px;
  font-weight: 950;
}

.vg-panel-head h2,
.vg-block-head h2 {
  margin: 0;
  color: var(--vg-ink);
  font-size: clamp(25px, 2.1vw, 34px);
  line-height: 1.22;
  font-weight: 950;
}

.vg-panel-head strong {
  flex: 0 0 auto;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--vg-blue-soft);
  color: var(--vg-blue);
  font-size: 15px;
  font-weight: 950;
}

#vgScript {
  width: 100%;
  min-height: 320px;
  flex: 1 1 auto;
  padding: 18px;
  border: 1px solid #c5d0dc;
  border-radius: 8px;
  background: #fff;
  color: var(--vg-ink);
  font-size: 18px;
  font-weight: 720;
  line-height: 1.75;
  resize: vertical;
}

#vgScript:focus,
.vg-field input:focus {
  border-color: var(--vg-green);
  outline: 3px solid rgba(12, 163, 91, .18);
}

.vg-helper {
  margin: 10px 0 0;
  color: var(--vg-muted);
  font-size: 15px;
  font-weight: 780;
}

.vg-sub-fields {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 12px;
  margin-top: 16px;
}

.vg-field {
  color: #26364c;
  font-size: 15px;
  font-weight: 950;
}

.vg-field input {
  width: 100%;
  min-height: 50px;
  margin-top: 6px;
  padding: 0 14px;
  border: 1px solid #c5d0dc;
  border-radius: 8px;
  background: #fff;
  color: var(--vg-ink);
  font-weight: 780;
}

.vg-sample-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.vg-sample-row b {
  color: var(--vg-ink);
  font-size: 16px;
  font-weight: 950;
}

.vg-chip {
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid var(--vg-line);
  border-radius: 999px;
  background: #fff;
  color: #2e3c50;
  font-size: 15px;
  font-weight: 900;
}

.vg-chip:hover {
  border-color: var(--vg-blue);
  color: var(--vg-blue);
  background: var(--vg-blue-soft);
}

.vg-chip.is-muted {
  color: var(--vg-muted);
}

.vg-style-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.voice-style {
  min-width: 0;
  min-height: 104px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  padding: 12px 8px;
  border: 1px solid var(--vg-line);
  border-radius: 8px;
  background: #fff;
  color: var(--vg-ink);
  text-align: center;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.voice-style:hover,
.voice-use:hover,
.vg-related a:hover {
  transform: translateY(-1px);
  border-color: #a8bdd0;
}

.voice-style span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--vg-blue-soft);
  color: var(--vg-blue);
  font-size: 19px;
  font-weight: 950;
}

.voice-style[data-style="female"] span,
.voice-style[data-style="cute"] span {
  background: var(--vg-pink-soft);
  color: var(--vg-pink);
}

.voice-style[data-style="narrator"] span,
.voice-style[data-style="bright"] span {
  background: var(--vg-amber-soft);
  color: var(--vg-amber);
}

.voice-style[data-style="calm"] span {
  background: var(--vg-green-soft);
  color: var(--vg-green-dark);
}

.voice-style b {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 950;
}

.voice-style small {
  color: var(--vg-muted);
  font-size: 12px;
  font-weight: 780;
  line-height: 1.35;
}

.voice-style.is-active {
  border-color: var(--vg-green);
  background: #fbfffd;
  box-shadow: inset 0 0 0 2px rgba(12, 163, 91, .18);
}

.voice-style.is-active span {
  background: var(--vg-green);
  color: #fff;
}

.vg-speed {
  margin-top: 18px;
}

.vg-speed h3 {
  margin: 0 0 10px;
  color: var(--vg-ink);
  font-size: 20px;
  font-weight: 950;
}

.speed-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #c5d0dc;
  border-radius: 8px;
  background: #fff;
}

.speed-row button {
  min-height: 50px;
  border: 0;
  border-right: 1px solid #c5d0dc;
  background: #fff;
  color: #27364a;
  font-size: 15px;
  font-weight: 920;
}

.speed-row button:last-child {
  border-right: 0;
}

.speed-row button.is-active {
  background: var(--vg-green);
  color: #fff;
}

.hp {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.voice-primary {
  width: 100%;
  min-height: 66px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  border: 0;
  border-radius: 8px;
  background: var(--vg-green);
  color: #fff;
  font-size: 24px;
  font-weight: 950;
  box-shadow: 0 14px 28px rgba(12, 163, 91, .24);
}

.voice-primary:hover {
  background: #098c4f;
}

.voice-primary span {
  font-size: 18px;
}

.player-card {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--vg-line);
  border-radius: 8px;
  background: #fff;
}

.player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.player-head b {
  display: block;
  color: #4b596b;
  font-size: 14px;
  font-weight: 950;
}

.player-head span {
  display: block;
  color: var(--vg-ink);
  font-size: 20px;
  font-weight: 950;
}

.player-head small {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--vg-green-soft);
  color: var(--vg-green-dark);
  font-size: 13px;
  font-weight: 950;
}

.player-empty {
  display: grid;
  place-items: center;
  min-height: 76px;
  margin: 0;
  padding: 14px;
  border: 1px dashed #c8d6e2;
  border-radius: 8px;
  background: #f8fbff;
  color: #536275;
  text-align: center;
  font-size: 15px;
  font-weight: 850;
}

.player-empty[hidden],
.player-card audio[hidden],
.player-card a[hidden] {
  display: none !important;
}

.player-card audio {
  width: 100%;
  min-width: 0;
}

.player-card a {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--vg-blue);
  border-radius: 8px;
  color: var(--vg-blue);
  text-decoration: none;
  font-weight: 950;
}

.player-card a[aria-disabled="true"] {
  border-color: var(--vg-line);
  color: #96a2af;
  pointer-events: none;
}

body[data-voice-state="processing"] .voice-primary {
  opacity: .72;
  cursor: wait;
}

body[data-voice-state="done"] .player-card {
  border-color: rgba(12, 163, 91, .55);
  box-shadow: 0 12px 28px rgba(12, 163, 91, .12);
}

body[data-voice-state="error"] .player-card {
  border-color: rgba(198, 48, 48, .45);
}

body[data-voice-state="error"] .player-head span {
  color: #b12b2b;
}

.vg-templates,
.vg-guide,
.vg-related {
  margin-top: 34px;
}

.vg-block-head {
  margin-bottom: 14px;
}

.vg-template-grid,
.vg-guide-grid,
.vg-related > div {
  display: grid;
  gap: 14px;
}

.vg-template-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.voice-use,
.vg-guide article,
.vg-related a {
  min-width: 0;
  border: 1px solid var(--vg-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(8, 23, 47, .04);
}

.voice-use {
  min-height: 110px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 3px 14px;
  padding: 16px;
  color: var(--vg-ink);
  text-align: left;
}

.voice-use span {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 8px;
  background: var(--vg-green-soft);
  color: var(--vg-green-dark);
  font-size: 18px;
  font-weight: 950;
}

.voice-use:nth-child(2) span {
  background: var(--vg-blue-soft);
  color: var(--vg-blue);
}

.voice-use:nth-child(3) span {
  background: var(--vg-pink-soft);
  color: var(--vg-pink);
}

.voice-use:nth-child(4) span {
  background: var(--vg-amber-soft);
  color: var(--vg-amber);
}

.voice-use b,
.vg-guide b {
  color: var(--vg-ink);
  font-size: 20px;
  line-height: 1.25;
  font-weight: 950;
}

.voice-use small,
.vg-guide p {
  color: var(--vg-muted);
  font-size: 14px;
  font-weight: 780;
}

.vg-guide-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.vg-guide article {
  padding: 20px;
}

.vg-guide span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--vg-green-soft);
  color: var(--vg-green-dark);
  font-size: 19px;
  font-weight: 950;
}

.vg-guide p {
  margin: 8px 0 0;
}

.vg-related > div {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.vg-related a {
  min-height: 62px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  color: var(--vg-ink);
  text-decoration: none;
  font-size: 16px;
  font-weight: 920;
}

.vg-footer {
  margin-top: 42px;
  padding: 32px;
  background: #06291b;
  color: #e9fff4;
  text-align: center;
  font-weight: 950;
}

@media (max-width: 1180px) {
  .vg-hero,
  .vg-studio {
    grid-template-columns: minmax(0, 1fr);
  }

  .vg-hero-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .vg-script-panel {
    border-right: 0;
    border-bottom: 1px solid var(--vg-soft-line);
  }
}

@media (max-width: 840px) {
  .vg-style-grid,
  .vg-template-grid,
  .vg-guide-grid,
  .vg-related > div {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body.voice-generator-page {
    background: #f7fafc;
  }

  .vg-header {
    min-height: 56px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }

  .vg-brand {
    font-size: 18px;
  }

  .vg-header nav {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .vg-header nav a {
    flex: 0 0 auto;
    min-width: 82px;
  }

  main {
    padding: 14px 10px 0;
  }

  .vg-hero {
    gap: 14px;
    margin-bottom: 14px;
  }

  .vg-kicker {
    font-size: 14px;
  }

  .vg-hero h1 {
    font-size: 34px;
    line-height: 1.13;
  }

  .vg-lead {
    font-size: 16px;
  }

  .vg-hero-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .vg-hero-primary,
  .vg-hero-secondary {
    min-height: 52px;
    font-size: 16px;
  }

  .vg-stage-nav span {
    min-height: 50px;
    flex-direction: column;
    gap: 2px;
    font-size: 14px;
  }

  .vg-stage-nav b {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }

  .vg-panel {
    padding: 12px;
  }

  .vg-panel-head {
    align-items: start;
    gap: 10px;
  }

  .vg-panel-head h2,
  .vg-block-head h2 {
    font-size: 25px;
  }

  .vg-panel-head strong {
    font-size: 13px;
  }

  #vgScript {
    min-height: 220px;
    padding: 14px;
    font-size: 16px;
    line-height: 1.72;
  }

  .vg-helper {
    font-size: 13px;
  }

  .vg-sub-fields,
  .vg-style-grid,
  .vg-template-grid,
  .vg-guide-grid,
  .vg-related > div {
    grid-template-columns: minmax(0, 1fr);
  }

  .vg-field input {
    min-height: 46px;
  }

  .vg-sample-row {
    align-items: stretch;
    gap: 8px;
  }

  .vg-sample-row b {
    width: 100%;
  }

  .vg-chip {
    flex: 1 1 calc(50% - 8px);
    min-height: 44px;
    padding: 0 10px;
    font-size: 14px;
  }

  .vg-style-grid {
    gap: 8px;
  }

  .voice-style {
    min-height: 82px;
    grid-template-columns: 42px minmax(0, 1fr);
    justify-items: start;
    align-content: center;
    gap: 2px 12px;
    padding: 10px 12px;
    text-align: left;
  }

  .voice-style span {
    grid-row: 1 / 3;
    width: 40px;
    height: 40px;
    font-size: 17px;
  }

  .voice-style b {
    font-size: 17px;
  }

  .voice-style small {
    font-size: 12px;
  }

  .speed-row button {
    min-height: 48px;
    font-size: 14px;
  }

  .voice-primary {
    min-height: 62px;
    font-size: 21px;
  }

  .player-head {
    align-items: start;
    flex-direction: column;
  }

  .player-head span {
    font-size: 18px;
  }

  .player-card a {
    width: 100%;
  }

  .voice-use {
    min-height: 96px;
  }
}
