* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #061018;
  --panel: #0b1a23;
  --panel-2: #0f2630;
  --panel-3: #122f39;
  --line: rgba(115, 233, 208, .20);
  --mint: #5cf1c7;
  --mint-soft: #a6ffe8;
  --cyan: #57c7ff;
  --blue: #196c91;
  --blue-2: #2485ad;
  --text: #f1fcfa;
  --muted: #91aaa8;
  --gold: #ffd369;
  --red: #ff7885;
  --white-panel: rgba(255, 255, 255, .06);
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(39, 108, 130, .48), transparent 38%),
    linear-gradient(180deg, #061018, #07141c 68%, #061018);
  color: var(--text);
  font-family: Inter, "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", sans-serif;
}

button {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.app {
  width: min(1040px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--mint);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .19em;
}

.start-screen {
  min-height: calc(100vh - 40px);
  display: grid;
  place-items: center;
}

.start-card {
  width: min(700px, 100%);
  padding: clamp(28px, 6vw, 58px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0, rgba(92, 241, 199, .13), transparent 45%),
    linear-gradient(145deg, rgba(20, 50, 61, .9), rgba(5, 17, 25, .98));
  box-shadow: 0 35px 100px rgba(0, 0, 0, .43);
}

.start-card h1,
.result-header h1 {
  margin: 0;
  font-size: clamp(32px, 6vw, 58px);
  line-height: 1.15;
  letter-spacing: .025em;
}

.lead {
  max-width: 580px;
  margin: 22px auto 0;
  color: #c1d6d3;
  font-size: clamp(15px, 2.5vw, 20px);
  line-height: 1.75;
}

.flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  margin: 30px 0 20px;
}

.flow > div:not(.arrow) {
  min-height: 104px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  padding: 16px;
  border: 1px solid rgba(121, 242, 211, .17);
  border-radius: 18px;
  background: rgba(5, 18, 26, .67);
}

.flow strong {
  color: var(--mint-soft);
  font-size: 22px;
}

.flow span {
  color: #9cb6b3;
  font-size: 13px;
}

.arrow {
  color: var(--mint);
  font-size: 28px;
}

.note,
.result-note {
  color: #7f9b98;
  font-size: 12px;
  line-height: 1.7;
}

.primary-button {
  min-width: 230px;
  margin-top: 20px;
  padding: 15px 25px;
  border: 0;
  border-radius: 999px;
  color: #032119;
  background: linear-gradient(135deg, #9dffe5, #4ae0b8);
  box-shadow: 0 16px 44px rgba(35, 195, 153, .27);
  cursor: pointer;
  font-weight: 900;
  letter-spacing: .05em;
  transition: transform .18s ease, filter .18s ease;
}

.primary-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.quiz-screen {
  display: grid;
  gap: 12px;
}

.quiz-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 5px 2px 4px;
}

.phase-label {
  display: inline-flex;
  margin: 0 0 6px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  color: #b6c7c7;
  background: rgba(4, 15, 22, .76);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}

.phase-label.ai {
  border-color: rgba(92, 241, 199, .32);
  color: var(--mint-soft);
  background: rgba(38, 157, 124, .13);
}

.quiz-header h2 {
  margin: 0;
  font-size: clamp(22px, 4vw, 36px);
}

.progress-area {
  min-width: 150px;
  text-align: right;
  color: #8da4a1;
  font-size: 12px;
  font-weight: 800;
}

.progress {
  width: 150px;
  height: 7px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.09);
}

.progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--cyan));
  box-shadow: 0 0 18px rgba(92, 241, 199, .5);
  transition: width .35s ease;
}

.assist-panel {
  display: grid;
  grid-template-columns: 44% 56%;
  min-height: 230px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(135deg, #0d252f, #07151d);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .23);
}

.assist-heading {
  grid-column: 1 / -1;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 15px;
  border-bottom: 1px solid rgba(124, 240, 211, .13);
  background: rgba(3, 13, 19, .65);
}

.assist-heading-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.raw-panel-mini {
  width: clamp(150px, 24vw, 220px);
  height: 52px;
  padding: 5px 8px;
  border: 1px solid rgba(120, 236, 205, .18);
  border-radius: 12px;
  background:
    radial-gradient(circle at center, rgba(18, 118, 112, .14), transparent 60%),
    rgba(3, 14, 20, .82);
}

.raw-mini-label {
  margin: 0 0 3px;
  color: #9db3b0;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
}

#rawWaveCanvas {
  display: block;
  width: 100%;
  height: 28px;
}

.assist-panel.ai-on {
  border-color: rgba(92, 241, 199, .42);
  box-shadow:
    0 0 0 1px rgba(92, 241, 199, .18),
    0 0 38px rgba(92, 241, 199, .10),
    0 20px 50px rgba(0, 0, 0, .23);
}

.assist-panel.ai-on .assist-heading {
  background:
    linear-gradient(90deg, rgba(92, 241, 199, .12), rgba(87, 199, 255, .06)),
    rgba(3, 13, 19, .85);
}

.assist-panel.ai-on .assist-icon {
  color: #04251d;
  background: linear-gradient(135deg, #92ffe2, #54e7bd);
  border-color: rgba(146,255,226,.32);
  box-shadow: 0 0 18px rgba(92,241,199,.24);
}

.assist-panel.ai-on .assist-title {
  color: #ebfffa;
}

.assist-panel.ai-on .assist-state {
  color: #cbf7eb;
}

.assist-panel.ai-on .ai-result {
  background:
    radial-gradient(circle at 18% 8%, rgba(92,241,199,.16), transparent 38%),
    radial-gradient(circle at 90% 0%, rgba(87,199,255,.11), transparent 34%),
    linear-gradient(145deg, rgba(17, 51, 55, .94), rgba(7, 28, 32, .98));
}

.assist-panel.ai-on .ai-prefix {
  color: #cffff2;
  font-size: 13px;
}

.assist-panel.ai-on .ai-result strong {
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.08;
}

.assist-panel.ai-on .ai-result p:last-child {
  font-size: 15px;
}

.listen-button {
  margin-top: 16px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: 14px;
  color: #032119;
  background: linear-gradient(135deg, #a6ffe8, #59e6bc);
  box-shadow: 0 12px 28px rgba(22, 187, 143, .22);
  cursor: pointer;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .04em;
  transition: transform .16s ease, filter .16s ease, opacity .16s ease;
}

.listen-button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.listen-button:disabled {
  opacity: .4;
  cursor: default;
}

.wave-title {
  position: absolute;
  left: 12px;
  top: 10px;
  z-index: 5;
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  color: #9eb7b3;
  background: rgba(4,14,20,.68);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
}

.assist-heading > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.assist-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(92, 241, 199, .38);
  border-radius: 10px;
  color: var(--mint);
  background: rgba(92, 241, 199, .08);
  font-size: 12px;
  font-weight: 900;
}

.assist-title,
.assist-state {
  margin: 0;
}

.assist-title {
  color: #d4e8e5;
  font-size: 12px;
  font-weight: 800;
}

.assist-state {
  margin-top: 2px;
  color: #758e8b;
  font-size: 10px;
}

.demo-badge {
  padding: 6px 9px;
  border: 1px solid rgba(255, 211, 105, .27);
  border-radius: 999px;
  color: var(--gold);
  background: rgba(255, 211, 105, .07);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
}

.ai-result {
  display: grid;
  align-content: center;
  padding: 24px;
  border-right: 1px solid rgba(121, 238, 210, .12);
  background:
    radial-gradient(circle at 15% 10%, rgba(88, 202, 255, .12), transparent 40%),
    rgba(6, 20, 28, .68);
}

.ai-prefix {
  margin: 0 0 6px;
  color: #73928e;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
}

.ai-result strong {
  color: #97aaa8;
  font-size: clamp(26px, 5vw, 46px);
  line-height: 1.12;
}

.ai-result p:last-child {
  margin: 12px 0 0;
  color: #7d9693;
  font-size: 13px;
  line-height: 1.65;
}

.assist-panel.ai-on .ai-result strong {
  color: var(--mint-soft);
  text-shadow: 0 0 25px rgba(92, 241, 199, .17);
}

.assist-panel.ai-on .ai-result p:last-child {
  color: #c1d5d2;
}

.wave-panel {
  position: relative;
  min-height: 170px;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(20, 115, 108, .17), transparent 55%),
    #031118;
}

#waveCanvas {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
}

.wave-grid {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image:
    linear-gradient(rgba(72, 224, 188, .09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72, 224, 188, .09) 1px, transparent 1px),
    linear-gradient(rgba(72, 224, 188, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72, 224, 188, .025) 1px, transparent 1px);
  background-size: 48px 48px, 48px 48px, 12px 12px, 12px 12px;
}

.wave-waiting {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 20px;
  color: #66827f;
  background: rgba(3, 16, 23, .42);
  text-align: center;
  font-size: 12px;
}

.scan-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -70px;
  z-index: 2;
  width: 70px;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(92, 241, 199, .12), transparent);
}

.wave-panel.active .scan-line {
  opacity: 1;
  animation: scan 2.5s linear infinite;
}

@keyframes scan {
  to { transform: translateX(780px); }
}

.choices-card {
  padding: 12px;
  border: 1px solid rgba(116, 230, 204, .16);
  border-radius: 18px;
  background: #06131a;
  box-shadow: 0 18px 44px rgba(0,0,0,.18);
}

.choice-head {
  display: flex;
  justify-content: space-between;
  padding: 1px 3px 10px;
  color: #86a19e;
  font-size: 12px;
  font-weight: 800;
}

#timerState.active {
  color: var(--mint);
}

#timerState.warning {
  color: var(--gold);
}

.choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.choice-button {
  min-height: 76px;
  padding: 11px 8px;
  border: 1px solid rgba(113, 221, 255, .19);
  border-radius: 13px;
  color: white;
  background:
    linear-gradient(145deg, rgba(255,255,255,.07), transparent 42%),
    var(--blue);
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease, opacity .2s ease;
}

.choice-button:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.12);
}

.choice-button:disabled {
  cursor: default;
  opacity: .48;
}

.choice-button strong,
.choice-button span {
  display: block;
}

.choice-button strong {
  font-size: 21px;
}

.choice-button span {
  margin-top: 3px;
  color: #d4edf6;
  font-size: 10px;
  line-height: 1.3;
}

.video-card {
  position: relative;
  min-height: 330px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px;
  background: #10222a;
  box-shadow: 0 22px 55px rgba(0, 0, 0, .26);
}

.video-card video {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 330px;
  object-fit: cover;
}

.video-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(0, 11, 17, .78), transparent 48%),
    linear-gradient(110deg, rgba(8, 28, 36, .28), transparent 43%);
  pointer-events: none;
}

.video-overlay {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.video-overlay > span {
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  background: rgba(4, 15, 22, .72);
  backdrop-filter: blur(10px);
  font-size: 13px;
  font-weight: 800;
}

.countdown-ring {
  position: relative;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
}

.countdown-ring svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.countdown-ring circle {
  fill: none;
  stroke-width: 4;
}

.ring-bg {
  stroke: rgba(255,255,255,.14);
}

.ring-progress {
  stroke: var(--mint);
  stroke-linecap: round;
  stroke-dasharray: 113.1;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .08s linear;
  filter: drop-shadow(0 0 5px rgba(92,241,199,.55));
}

.countdown-ring strong {
  position: relative;
  z-index: 2;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.transition-toast {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 20px;
  color: var(--text);
  background: rgba(2, 10, 14, .82);
  backdrop-filter: blur(13px);
  text-align: center;
}

.transition-toast strong {
  font-size: clamp(24px, 5vw, 42px);
}

.transition-toast span {
  color: #93aaa7;
}

.result-screen {
  padding-bottom: 40px;
}

.result-header {
  padding: 25px 4px 20px;
  text-align: center;
}

.result-header p:last-child {
  color: #9bb0ad;
}

.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.comparison-card,
.details-card,
.impact-card {
  border: 1px solid rgba(116, 234, 207, .17);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(21, 52, 63, .78), rgba(5, 17, 25, .97));
  box-shadow: 0 20px 54px rgba(0, 0, 0, .23);
}

.comparison-card {
  padding: 23px;
}

.comparison-card.assisted {
  border-color: rgba(92, 241, 199, .33);
  background:
    radial-gradient(circle at 80% 0, rgba(92, 241, 199, .12), transparent 42%),
    linear-gradient(145deg, rgba(21, 60, 65, .82), rgba(5, 19, 25, .98));
}

.comparison-label {
  margin: 0 0 18px;
  color: #91aaa7;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .09em;
}

.assisted .comparison-label {
  color: var(--mint);
}

.metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 15px;
  margin-top: 15px;
}

.metric span {
  color: #9db2af;
  font-size: 13px;
}

.metric strong {
  font-size: clamp(25px, 5vw, 42px);
}

.meter {
  height: 10px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}

.meter i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4c7890, #78a7b7);
  transition: width .8s cubic-bezier(.2,.75,.2,1);
}

.assisted .meter i {
  background: linear-gradient(90deg, var(--mint), var(--cyan));
  box-shadow: 0 0 18px rgba(92,241,199,.38);
}

.impact-card {
  margin-top: 14px;
  padding: 22px;
  text-align: center;
}

.impact-card p {
  margin: 0;
  color: #d5e8e5;
  font-size: clamp(17px, 3vw, 24px);
  font-weight: 800;
  line-height: 1.6;
}

.details-card {
  margin-top: 14px;
  padding: 20px;
}

.details-card h2 {
  margin: 0 0 15px;
  font-size: 20px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 690px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  text-align: left;
  font-size: 12px;
}

th {
  color: #7f9996;
  font-size: 10px;
  letter-spacing: .08em;
}

td {
  color: #d6e5e2;
}

.result-good {
  color: var(--mint);
  font-weight: 900;
}

.result-bad {
  color: var(--red);
  font-weight: 900;
}

.retry-button {
  display: block;
  margin: 22px auto 0;
}

@media (max-width: 760px) {

  .assist-heading {
    align-items: flex-start;
    gap: 10px;
  }

  .assist-heading-right {
    width: 100%;
    justify-content: space-between;
  }

  .raw-panel-mini {
    width: 56%;
    max-width: none;
  }
  .app {
    padding: 12px;
  }

  .flow {
    grid-template-columns: 1fr;
  }

  .arrow {
    transform: rotate(90deg);
  }

  .quiz-header {
    align-items: flex-start;
  }

  .progress-area {
    min-width: 100px;
  }

  .progress {
    width: 100px;
  }

  .assist-panel {
    grid-template-columns: 1fr;
  }

  .ai-result {
    min-height: 145px;
    border-right: 0;
    border-bottom: 1px solid rgba(121, 238, 210, .12);
  }

  .wave-panel {
    min-height: 160px;
  }

  .choices {
    grid-template-columns: repeat(2, 1fr);
  }

  .choice-button {
    min-height: 66px;
  }

  .video-card,
  .video-card video {
    min-height: 270px;
  }

  .comparison-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}


/* v4: reference ZIP style waveform, common to AI / non-AI */
.raw-panel-mini {
  height: 58px;
  background: #07131c;
}
#rawWaveCanvas {
  height: 32px;
}
.wave-panel {
  background: #07131c;
}
.assist-panel.no-ai .wave-panel,
.assist-panel.ai-on .wave-panel {
  opacity: 1;
}
.wave-waiting {
  background: rgba(7, 19, 28, .62);
}
.prep-mode .countdown-ring .ring-progress {
  stroke: #ffd369;
}


.assist-panel.no-ai .ai-result {
  position: relative;
}

.assist-panel.no-ai .ai-prefix,
.assist-panel.no-ai #aiDiagnosis,
.assist-panel.no-ai #aiComment {
  filter: blur(8px);
  user-select: none;
}

.assist-panel.no-ai .ai-result::after {
  content: "AI LOCK";
  position: absolute;
  right: 18px;
  top: 18px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(3,15,22,.72);
  color: #dbe7e8;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
}

.assist-panel.no-ai .listen-button {
  position: relative;
  z-index: 2;
}

.wave-waiting {
  color: #88a19f;
}

.assist-panel.no-ai .wave-title,
.assist-panel.ai-on .wave-title {
  color: #cbe4df;
}


/* v8: 学会ブース表示向けに全体を一段コンパクト化 */
.app {
  width: min(940px, 100%);
  padding: 14px;
}

.quiz-screen {
  gap: 9px;
}

.quiz-header h2 {
  font-size: clamp(20px, 3.4vw, 31px);
}

.assist-panel {
  min-height: 205px;
}

.assist-heading {
  min-height: 52px;
  padding: 8px 12px;
}

.ai-result {
  padding: 18px 20px;
}

.assist-panel.ai-on .ai-result strong {
  font-size: clamp(31px, 5.2vw, 51px);
}

.wave-panel {
  min-height: 152px;
}

.choices-card {
  padding: 9px;
}

.choice-head {
  padding-bottom: 7px;
}

.choices {
  gap: 5px;
}

.choice-button {
  min-height: 64px;
  padding: 8px 6px;
}

.choice-button strong {
  font-size: 18px;
}

.video-card,
.video-card video {
  min-height: 285px;
}

.comparison-card {
  padding: 18px;
}

.details-card {
  padding: 16px;
}

@media (max-width: 760px) {
  .app {
    padding: 8px;
  }

  .video-card,
  .video-card video {
    min-height: 235px;
  }
}
