:root {
  --color-ink: #141413;
  --color-charcoal: #262627;
  --color-canvas: #f3f0ee;
  --color-lifted: #fcfbfa;
  --color-white: #ffffff;
  --color-muted: #696969;
  --color-dust: #d1cdc7;
  --color-wine-rust: #8f2e1f;
  --color-signal: #cf4500;
  --color-orbit: #f37338;
  --color-link: #3860be;
  --radius-button: 20px;
  --radius-chip: 24px;
  --radius-panel: 40px;
  --radius-pill: 999px;
  --shadow-soft: rgba(0, 0, 0, 0.04) 0 4px 24px 0;
  --shadow-halo: rgba(0, 0, 0, 0.08) 0 24px 48px 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR",
    "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--color-canvas);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 12%, rgba(243, 115, 56, 0.1), transparent 28%),
    var(--color-canvas);
  color: var(--color-ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR",
    "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.desktop-canvas {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background: var(--color-canvas);
}

.app-shell {
  position: relative;
  width: min(100vw, 430px);
  min-height: 100vh;
  padding: 22px 18px 34px;
  overflow-x: hidden;
  background: var(--color-canvas);
}

.nav-pill {
  position: sticky;
  top: 14px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 8px 10px;
  margin: 0 auto 30px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.brand-button,
.icon-button {
  border: 0;
  background: transparent;
  color: var(--color-ink);
}

.brand-button {
  display: flex;
  align-items: center;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-button,
.language-button {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.language-button {
  border: 1px solid rgba(20, 20, 19, 0.12);
  background: var(--color-white);
  color: var(--color-ink);
  font-size: 12px;
  font-weight: 700;
}

.icon-button span {
  display: block;
  width: 16px;
  height: 2px;
  margin: 2px 0;
  border-radius: 999px;
  background: var(--color-ink);
}

.icon-button.search span {
  width: 15px;
  height: 15px;
  border: 2px solid var(--color-ink);
  background: transparent;
  border-radius: 50%;
}

.view {
  display: none;
  animation: rise 220ms ease-out;
}

.view.active {
  display: block;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero h1,
.screen-head h1 {
  margin: 8px 0 12px;
  font-size: clamp(36px, 10vw, 42px);
  line-height: 1.04;
  font-weight: 500;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 34ch;
  margin: 0;
  color: var(--color-charcoal);
  font-size: 16px;
  line-height: 1.45;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.eyebrow span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-orbit);
}

.eyebrow.mini {
  font-size: 11px;
}

.scan-panel,
.upload-panel,
.review-panel,
.result-panel,
.form-panel,
.lesson-detail,
.taste-preview,
.memory-strip {
  background: var(--color-lifted);
  border: 1px solid rgba(20, 20, 19, 0.07);
  border-radius: var(--radius-panel);
}

.scan-panel {
  position: relative;
  display: grid;
  grid-template-columns: 138px 1fr;
  gap: 18px;
  align-items: center;
  min-height: 210px;
  margin: 28px 0 18px;
  padding: 22px;
  overflow: hidden;
}

.wine-portrait {
  position: relative;
  width: 132px;
  height: 132px;
}

.wine-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: var(--shadow-halo);
}

.scan-copy {
  position: relative;
  z-index: 1;
}

.scan-copy h2,
.result-panel h2,
.lesson-detail h2,
.taste-preview h2 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 500;
}

.scan-copy p {
  margin: 0 0 18px;
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.35;
}

.primary-button,
.secondary-button,
.signal-button {
  min-height: 44px;
  border-radius: var(--radius-button);
  padding: 10px 20px;
  font-weight: 500;
}

.primary-button {
  border: 1.5px solid var(--color-ink);
  background: var(--color-ink);
  color: var(--color-canvas);
}

.secondary-button {
  border: 1.5px solid var(--color-ink);
  background: var(--color-white);
  color: var(--color-ink);
}

.signal-button {
  border: 0;
  background: var(--color-signal);
  color: var(--color-white);
}

.compact {
  min-height: 40px;
  padding-inline: 16px;
  white-space: nowrap;
}

.wide {
  width: 100%;
}

.entry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.entry-card {
  min-height: 132px;
  padding: 18px;
  text-align: left;
  border: 1px solid rgba(20, 20, 19, 0.08);
  border-radius: 32px;
  background: var(--color-lifted);
  color: var(--color-ink);
}

.entry-card.selected {
  border-color: rgba(143, 46, 31, 0.35);
  box-shadow: inset 0 0 0 1px rgba(143, 46, 31, 0.12);
}

.entry-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: rgba(143, 46, 31, 0.1);
  color: var(--color-wine-rust);
  font-weight: 700;
}

.entry-card strong,
.entry-card small {
  display: block;
}

.entry-card strong {
  margin-bottom: 5px;
  font-size: 18px;
}

.entry-card small {
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.25;
}

.memory-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 14px;
  padding: 16px 18px;
}

.memory-strip strong {
  display: block;
  margin: 6px 0 3px;
}

.memory-strip p:last-child {
  margin: 0;
  color: var(--color-muted);
  font-size: 13px;
}

.usage-note {
  margin: 16px 0 0;
  color: var(--color-muted);
  text-align: center;
  font-size: 13px;
}

.screen-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
}

.back-button {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(20, 20, 19, 0.12);
  border-radius: 50%;
  background: var(--color-white);
  color: var(--color-ink);
  font-size: 22px;
}

.upload-panel,
.review-panel,
.result-panel,
.form-panel,
.lesson-detail,
.taste-preview {
  padding: 22px;
}

.upload-target {
  width: 100%;
  min-height: 220px;
  border: 1.5px dashed rgba(20, 20, 19, 0.2);
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--color-ink);
}

.camera-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 74px;
  height: 74px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: rgba(143, 46, 31, 0.12);
  color: var(--color-wine-rust);
  font-size: 34px;
}

.upload-target strong,
.upload-target small {
  display: block;
}

.upload-target small {
  max-width: 26ch;
  margin: 8px auto 0;
  color: var(--color-muted);
  line-height: 1.35;
}

.limit-pill {
  display: inline-flex;
  margin: 14px 0;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: rgba(207, 69, 0, 0.1);
  color: var(--color-signal);
  font-size: 13px;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

label {
  display: grid;
  gap: 8px;
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(20, 20, 19, 0.16);
  border-radius: 22px;
  background: var(--color-white);
  color: var(--color-ink);
  padding: 13px 16px;
  outline: 0;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-wine-rust);
  box-shadow: 0 0 0 3px rgba(143, 46, 31, 0.1);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.review-panel,
.form-panel {
  display: grid;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 0.68fr;
  gap: 12px;
}

.confidence {
  margin: 0;
  padding: 12px 14px;
  border-radius: 24px;
  background: rgba(243, 115, 56, 0.12);
  color: var(--color-charcoal);
  font-size: 13px;
  line-height: 1.35;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.chip-row span,
.chip-row button,
.choice {
  min-height: 38px;
  border: 1px solid rgba(20, 20, 19, 0.1);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.82);
  color: var(--color-ink);
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 700;
}

.choice.selected,
.chip-row button:hover {
  border-color: rgba(143, 46, 31, 0.35);
  color: var(--color-wine-rust);
}

.result-section {
  padding: 18px 0;
  border-top: 1px solid rgba(20, 20, 19, 0.08);
}

.result-section h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.result-section p,
.lesson-detail p,
.taste-preview p {
  margin: 0;
  color: var(--color-charcoal);
  line-height: 1.48;
}

.question-box,
.practice-card {
  padding: 16px;
  border-radius: 26px;
  background: rgba(143, 46, 31, 0.08);
}

.question-box p,
.practice-card p {
  margin: 6px 0 0;
  color: var(--color-charcoal);
}

.panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lesson-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.lesson-card {
  min-height: 92px;
  border: 1px solid rgba(20, 20, 19, 0.08);
  border-radius: 30px;
  background: var(--color-lifted);
  color: var(--color-ink);
  padding: 16px;
  text-align: left;
}

.lesson-card.active {
  background: var(--color-ink);
  color: var(--color-canvas);
}

.lesson-card strong,
.lesson-card small {
  display: block;
}

.lesson-card small {
  margin-top: 6px;
  opacity: 0.72;
  line-height: 1.25;
}

.lesson-detail {
  margin-top: 14px;
}

.practice-card {
  margin-top: 18px;
}

details {
  border: 1px solid rgba(20, 20, 19, 0.1);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.54);
  padding: 14px;
}

summary {
  min-height: 36px;
  font-weight: 700;
  cursor: pointer;
}

.slider-grid {
  display: grid;
  gap: 14px;
  padding-top: 14px;
}

.taste-preview {
  margin: 14px 0;
}

.taste-preview .signal-button {
  margin-top: 16px;
}

.record-list {
  display: grid;
  gap: 10px;
}

.record-item {
  padding: 16px;
  border-radius: 28px;
  background: var(--color-lifted);
  border: 1px solid rgba(20, 20, 19, 0.08);
}

.record-item strong {
  display: block;
  margin-bottom: 6px;
}

.record-item p {
  margin: 0;
  color: var(--color-muted);
  line-height: 1.35;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  width: min(calc(100vw - 36px), 390px);
  padding: 14px 18px;
  border-radius: var(--radius-pill);
  background: var(--color-ink);
  color: var(--color-canvas);
  text-align: center;
  box-shadow: var(--shadow-halo);
  transform: translate(-50%, 120px);
  opacity: 0;
  transition: 180ms ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

@media (min-width: 760px) {
  .desktop-canvas {
    padding: 34px;
  }

  .app-shell {
    min-height: calc(100vh - 68px);
    border: 1px solid rgba(20, 20, 19, 0.08);
    border-radius: 48px;
    box-shadow: var(--shadow-halo);
  }
}

@media (max-width: 374px) {
  .app-shell {
    padding-inline: 14px;
  }

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

  .wine-portrait {
    margin: 0 auto;
  }
}
