:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #63706a;
  --paper: #fbfcf8;
  --panel: #ffffff;
  --line: #dce4db;
  --mint: #2fa36c;
  --coral: #e86452;
  --gold: #d49b24;
  --blue: #3e75b8;
  --shadow: 0 24px 80px rgba(24, 34, 30, .16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Noto Sans KR", system-ui, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(140deg, rgba(47, 163, 108, .14), transparent 34%),
    linear-gradient(320deg, rgba(232, 100, 82, .14), transparent 31%),
    var(--paper);
}

button {
  font: inherit;
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: clamp(14px, 3vw, 34px);
}

.learning-panel {
  min-height: calc(100vh - clamp(28px, 6vw, 68px));
  border: 1px solid rgba(23, 33, 29, .12);
  background: rgba(255, 255, 255, .82);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar {
  height: 68px;
  padding: 0 clamp(18px, 4vw, 42px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--ink);
  border-radius: 7px;
}

.session-meta {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.session-meta span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,.7);
}

.workspace {
  min-height: calc(100vh - 68px - clamp(28px, 6vw, 68px));
  display: grid;
  grid-template-columns: minmax(270px, 390px) 1fr;
}

.side-rail {
  padding: clamp(24px, 4vw, 46px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  border-right: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--mint);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 9ch;
  margin: 0;
  font-size: clamp(34px, 4.4vw, 58px);
  line-height: 1.02;
  letter-spacing: 0;
}

.lead {
  max-width: 34rem;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.72;
}

.mode-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef4ee;
}

.mode {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.mode.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(23, 33, 29, .08);
}

.curve {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.curve-head,
.card-footer,
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.curve-head span,
.card-footer {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.timeline {
  height: 44px;
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  gap: 8px;
}

.timeline i {
  height: 8px;
  border-radius: 99px;
  background: #dbe5dc;
}

.timeline i.active {
  background: var(--mint);
}

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

.stats-grid div {
  min-height: 82px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stats-grid span {
  display: block;
  font-size: 28px;
  font-weight: 800;
}

.stats-grid small {
  color: var(--muted);
  font-weight: 700;
}

.card-stage {
  position: relative;
  min-height: 680px;
  padding: clamp(22px, 5vw, 58px);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.visual-band {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(47, 163, 108, .08), transparent 35%, rgba(62, 117, 184, .08)),
    repeating-linear-gradient(90deg, transparent 0 54px, rgba(23, 33, 29, .045) 55px 56px);
}

.mini-card {
  position: absolute;
  width: 190px;
  height: 250px;
  border: 1px solid rgba(23, 33, 29, .1);
  border-radius: 8px;
  background: rgba(255,255,255,.54);
  box-shadow: 0 18px 60px rgba(23, 33, 29, .1);
}

.mini-card.one {
  right: 10%;
  top: 10%;
  transform: rotate(9deg);
}

.mini-card.two {
  left: 9%;
  bottom: 12%;
  transform: rotate(-10deg);
}

.wave {
  position: absolute;
  right: 12%;
  bottom: 17%;
  height: 80px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wave span {
  width: 10px;
  border-radius: 99px;
  background: rgba(62, 117, 184, .42);
  animation: pulse 1.25s ease-in-out infinite alternate;
}

.wave span:nth-child(1) { height: 26px; }
.wave span:nth-child(2) { height: 54px; animation-delay: .1s; }
.wave span:nth-child(3) { height: 72px; animation-delay: .2s; }
.wave span:nth-child(4) { height: 45px; animation-delay: .3s; }
.wave span:nth-child(5) { height: 30px; animation-delay: .4s; }

@keyframes pulse {
  from { transform: scaleY(.72); opacity: .55; }
  to { transform: scaleY(1); opacity: 1; }
}

.study-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 470px);
  min-height: 590px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(23, 33, 29, .12);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(24, 34, 30, .18);
  touch-action: none;
  transition: transform .22s ease, box-shadow .22s ease;
}

.study-card.dragging {
  transition: none;
  box-shadow: 0 35px 100px rgba(24, 34, 30, .22);
}

.card-top span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.icon-button,
.action {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.native-prompt {
  margin: 38px 0 22px;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.2;
  font-weight: 800;
}

.answer-area {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf7;
}

.answer-area p {
  margin: 0;
}

.answer-area p:first-child {
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.25;
  font-weight: 800;
}

.answer-area p:last-child {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.65;
}

.reveal-button {
  width: 100%;
  min-height: 52px;
  margin-top: auto;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.actions {
  position: relative;
  z-index: 2;
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(5, 56px);
  gap: 10px;
  justify-content: center;
}

.action {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 24px;
  font-weight: 800;
}

.action.left { color: var(--coral); }
.action.right { color: var(--mint); }
.action.up { color: var(--gold); }
.action.down { color: var(--blue); }
.action.tap { color: var(--ink); }

.choice {
  position: absolute;
  top: 86px;
  opacity: 0;
  padding: 10px 14px;
  border: 3px solid currentColor;
  border-radius: 8px;
  font-size: 24px;
  font-weight: 800;
  transform: rotate(-12deg);
  transition: opacity .12s ease;
}

.choice.nope { left: 28px; color: var(--coral); }
.choice.yes { right: 28px; color: var(--mint); transform: rotate(12deg); }
.choice.save { left: 50%; top: 38px; color: var(--gold); transform: translateX(-50%); }
.choice.speak { left: 50%; top: auto; bottom: 82px; color: var(--blue); transform: translateX(-50%); }

.study-card.intent-left .choice.nope,
.study-card.intent-right .choice.yes,
.study-card.intent-up .choice.save,
.study-card.intent-down .choice.speak {
  opacity: 1;
}

@media (max-width: 860px) {
  .app-shell { padding: 0; }
  .learning-panel {
    min-height: 100vh;
    border: 0;
  }
  .topbar {
    height: auto;
    padding: 14px;
    align-items: flex-start;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .side-rail {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 16px;
    gap: 12px;
  }
  .eyebrow { margin-bottom: 8px; }
  h1 {
    max-width: 100%;
    font-size: 30px;
    line-height: 1.1;
  }
  .lead {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.45;
  }
  .curve {
    padding: 12px;
  }
  .timeline {
    height: 24px;
    margin-top: 8px;
  }
  .stats-grid div {
    min-height: 58px;
    padding: 10px 12px;
  }
  .stats-grid span {
    font-size: 22px;
  }
  .card-stage {
    min-height: 560px;
    padding: 18px 12px 26px;
  }
  .study-card {
    min-height: 430px;
    padding: 22px;
  }
  .native-prompt {
    margin-top: 28px;
    font-size: 25px;
  }
  .reveal-button {
    min-height: 48px;
  }
  .actions {
    grid-template-columns: repeat(5, 48px);
  }
  .action {
    width: 48px;
    height: 48px;
  }
}
