@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+KR:wght@400;500;600;700&display=swap");
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

:root {
  --ink: #261820;
  --ink-soft: #76616a;
  --paper: #f7f0e3;
  --paper-deep: #e5d0b0;
  --wine: #701f3a;
  --wine-dark: #24101a;
  --copper: #b99462;
  --sage: #68715c;
  --line: rgba(67, 29, 41, 0.17);
  --shadow: 0 24px 70px rgba(54, 16, 32, 0.14);
  --serif: "Noto Serif KR", "Noto Serif", "Apple SD Gothic Neo", serif;
  --display: var(--serif);
  --sans: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--ink); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid var(--copper);
  outline-offset: 3px;
}

.event-app { min-height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.topbar, .bottombar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem clamp(1.25rem, 4vw, 4.5rem);
  background: rgba(247, 240, 227, 0.96);
  backdrop-filter: blur(12px);
  z-index: 3;
}

.topbar { color: var(--paper); background: var(--wine-dark); border-bottom: 1px solid rgba(229, 207, 174, 0.22); }
.bottombar { color: var(--paper); background: var(--wine-dark); border-top: 1px solid rgba(229, 207, 174, 0.22); margin-top: auto; }

.brand { display: inline-flex; align-items: center; gap: 0.7rem; color: var(--paper); text-decoration: none; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.brand-mark { display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border: 1px solid var(--copper); border-radius: 50%; background: var(--copper); color: var(--wine-dark); font-family: var(--display); font-size: 1.2rem; font-style: italic; letter-spacing: 0; }
.topbar-actions { display: flex; align-items: center; gap: 1rem; }
.event-meta { color: #dec6a9; font-size: 0.72rem; letter-spacing: 0.07em; }
.icon-button, .text-button { border: 0; background: transparent; color: var(--ink-soft); font-size: 0.74rem; font-weight: 700; }
.icon-button { color: #dec6a9; }
.icon-button:hover, .text-button:hover { color: var(--copper); }

.progress-track { height: 3px; background: rgba(36, 16, 26, 0.16); }
.progress-track span { display: block; width: 16.666%; height: 100%; background: var(--wine); transition: width 240ms ease; }

.slides { width: 100%; flex: 1; }
.slide { display: none; width: 100%; min-height: min(760px, calc(100vh - 8.8rem)); padding: clamp(2.2rem, 6vw, 5.5rem) clamp(1.25rem, 7vw, 8rem); animation: enter 360ms ease both; }
.slide.is-active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.slide--hero { position: relative; display: none; grid-template-columns: minmax(0, 1fr) minmax(340px, 0.8fr); align-items: center; gap: clamp(2rem, 5vw, 5rem); color: var(--paper); background-image: linear-gradient(90deg, rgba(36, 16, 26, 0.98) 0%, rgba(36, 16, 26, 0.88) 35%, rgba(36, 16, 26, 0.45) 72%, rgba(36, 16, 26, 0.55) 100%), url("./assets/wine-hero.png"); background-position: center; background-size: cover; }
.slide--hero::before { content: ""; position: absolute; inset: 1.25rem; border: 1px solid rgba(185, 148, 98, 0.24); pointer-events: none; }
.slide--hero.is-active { display: grid; }
.hero-copy { position: relative; z-index: 1; padding: 2rem 0; }
.hero-copy::before { content: ""; position: absolute; left: -5rem; top: 0; width: 8px; height: 86%; background: var(--copper); opacity: 0.9; }
.eyebrow, .panel-kicker, .note-mark { margin: 0 0 1rem; color: var(--wine); font-size: 0.68rem; font-weight: 900; letter-spacing: 0.17em; text-transform: uppercase; }
.slide--hero .eyebrow { color: var(--copper); }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.045em; }
h1 { max-width: 760px; margin-bottom: 1.5rem; font-size: clamp(3.3rem, 8vw, 7.5rem); line-height: 0.95; }
h2 { margin-bottom: 1rem; font-size: clamp(2.55rem, 5vw, 5.2rem); line-height: 0.98; }
h1 em, h2 em { color: var(--wine); font-style: italic; }
.slide--hero h1 { color: var(--paper); }
.slide--hero h1 { max-width: none; font-size: clamp(2.2rem, 5.2vw, 4.5rem); letter-spacing: -0.08em; white-space: nowrap; }
.slide--hero h1 em { color: #e5ad93; }
.hero-lede, .section-intro > p:last-child, .closing-copy > p:last-child { color: var(--ink-soft); font-size: clamp(1rem, 1.4vw, 1.22rem); line-height: 1.7; }
.hero-lede { color: rgba(244, 234, 215, 0.76); }
.hero-stats { display: flex; gap: 2rem; margin-top: 3.2rem; }
.hero-stats div { display: flex; flex-direction: column; gap: 0.15rem; padding-right: 2rem; border-right: 1px solid rgba(229, 207, 174, 0.25); }
.hero-stats div:last-child { border-right: 0; }
.hero-stats strong { color: var(--wine); font-family: var(--serif); font-size: 2.2rem; font-weight: 400; }
.slide--hero .hero-stats strong { color: #e5ad93; }
.hero-stats span { color: rgba(244, 234, 215, 0.64); font-size: 0.73rem; font-weight: 800; letter-spacing: 0.08em; }

.panel { border: 1px solid rgba(185, 148, 98, 0.42); background: rgba(255, 250, 241, 0.94); box-shadow: var(--shadow); }
.setup-card { padding: clamp(1.4rem, 3vw, 2.6rem); }
.slide--hero .setup-card { position: relative; z-index: 1; border-color: rgba(229, 207, 174, 0.6); background: linear-gradient(135deg, rgba(255, 250, 241, 0.68), rgba(255, 250, 241, 0.45)); box-shadow: 0 24px 70px rgba(18, 5, 12, 0.28); backdrop-filter: blur(12px) saturate(112%); -webkit-backdrop-filter: blur(12px) saturate(112%); }
.panel-heading { margin-bottom: 2rem; }
.panel-heading h2 { margin: 0; font-size: clamp(1.65rem, 2.6vw, 2rem); }
.setup-card h2 { color: var(--ink); }
.setup-card label { display: block; margin: 1rem 0; color: var(--ink-soft); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.05em; }
.label-note { float: right; color: var(--copper); font-size: 0.67rem; font-weight: 600; }
.setup-card input, .setup-card textarea { display: block; width: 100%; margin-top: 0.45rem; padding: 0.75rem 0.85rem; border: 1px solid var(--line); border-radius: 0; color: var(--ink); background: rgba(255,255,255,0.52); resize: vertical; }
.slide--hero .setup-card input, .slide--hero .setup-card textarea { background: rgba(255, 255, 255, 0.32); }
.setup-card input::placeholder, .setup-card textarea::placeholder { color: #9a8d80; }
.form-hint { min-height: 1.4rem; margin: 1rem 0; color: var(--ink-soft); font-size: 0.74rem; line-height: 1.5; }
.form-hint.is-error { color: var(--wine); font-weight: 800; }

.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 1.5rem; min-height: 3.1rem; padding: 0.8rem 1.15rem; border: 1px solid transparent; font-size: 0.76rem; font-weight: 900; letter-spacing: 0.08em; }
.primary-button { color: var(--paper); background: var(--wine); }
.primary-button:hover { color: var(--wine-dark); background: var(--copper); }
.secondary-button { color: var(--wine); border-color: var(--wine); background: transparent; }
.secondary-button:hover { color: var(--paper); background: var(--wine); }
.primary-button:disabled, .secondary-button:disabled { cursor: not-allowed; opacity: 0.45; }

.section-intro { max-width: 720px; margin-bottom: 3.5rem; }
.section-intro h2 { max-width: 680px; }
.rules-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rule-card { min-height: 240px; padding: 1.6rem; border-right: 1px solid var(--line); }
.rule-card:last-child { border-right: 0; }
.rule-card--accent { background: var(--wine); color: var(--paper); }
.rule-card--accent .rule-number { color: #e9b78f; }
.rule-number { display: block; margin-bottom: 4.5rem; color: var(--copper); font-family: var(--serif); font-size: 1.4rem; font-style: italic; }
.rule-card h3 { margin-bottom: 0.75rem; font-family: var(--serif); font-size: 1.45rem; font-weight: 400; }
.rule-card p { margin: 0; color: var(--ink-soft); font-size: 0.86rem; line-height: 1.6; }
.rule-card--accent p { color: rgba(246,239,223,0.78); }
.host-note { display: flex; align-items: baseline; gap: 1.5rem; max-width: 700px; margin-top: 2.5rem; padding: 1.25rem 1.5rem; border-left: 4px solid var(--copper); background: rgba(189,115,72,0.1); }
.host-note .note-mark { flex: 0 0 auto; margin: 0; color: var(--copper); }
.host-note p { margin: 0; color: var(--ink-soft); font-size: 0.9rem; line-height: 1.5; }

.section-heading-row { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.section-heading-row h2 { margin: 0; }
.section-aside { margin: 0 0 0.3rem; color: var(--ink-soft); font-size: 0.82rem; line-height: 1.6; text-align: right; }
.lineup-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.85rem; }
.lineup-pagination { display: flex; align-items: center; gap: 0.45rem; }
.lineup-pagination > span { margin-right: 0.25rem; color: var(--copper); font-size: 0.56rem; font-weight: 900; letter-spacing: 0.14em; }
.lineup-pagination > strong { min-width: 2.3rem; color: var(--wine); font-size: 0.72rem; text-align: center; }
.lineup-page-button { display: grid; place-items: center; width: 2rem; height: 2rem; border: 1px solid var(--line); color: var(--wine); background: transparent; font-size: 0.9rem; }
.lineup-page-button:hover:not(:disabled) { color: var(--paper); background: var(--wine); }
.lineup-page-button:disabled { cursor: not-allowed; opacity: 0.28; }
.wine-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.wine-card { position: relative; min-height: 340px; padding: 1.35rem; border: 1px solid rgba(185, 148, 98, 0.35); background: linear-gradient(155deg, rgba(255,251,241,0.96), rgba(229,207,174,0.34)); overflow: hidden; }
.wine-card::after { content: ""; position: absolute; right: -2rem; bottom: -3.2rem; width: 8rem; height: 8rem; border-radius: 50%; background: var(--wine-color, var(--wine)); opacity: 0.11; }
.wine-card--sparkling { --wine-color: var(--copper); }
.wine-card--white { --wine-color: var(--sage); }
.wine-card--sweet { --wine-color: #c58e43; }
.wine-card--red { --wine-color: var(--wine); }
.wine-index { display: flex; justify-content: space-between; color: var(--wine); font-family: var(--display); font-size: 1.35rem; font-style: italic; }
.wine-kind { color: var(--ink-soft); font-family: var(--sans); font-size: 0.62rem; font-style: normal; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.wine-card h3 { min-height: 4.2rem; margin: 2.6rem 0 0.8rem; font-family: var(--serif); font-size: 1.45rem; font-weight: 400; line-height: 1.18; }
.wine-guide { min-height: 2.65rem; margin: 0 0 0.65rem; padding: 0.48rem 0.62rem; border-left: 3px solid var(--copper); color: var(--wine); background: rgba(185, 148, 98, 0.1); font-size: 0.76rem; font-weight: 700; line-height: 1.45; }
.wine-guide span { display: block; margin-bottom: 0.12rem; color: var(--copper); font-size: 0.56rem; font-weight: 900; letter-spacing: 0.04em; }
.wine-description { display: -webkit-box; min-height: 4.5rem; margin: 0; overflow: hidden; color: var(--ink-soft); font-size: 0.74rem; line-height: 1.6; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.wine-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem 0.6rem; margin-top: 1.45rem; }
.wine-fact { min-width: 0; }
.wine-fact--region { grid-column: 1 / -1; }
.wine-fact small { display: block; margin-bottom: 0.18rem; color: var(--ink-soft); font-size: 0.58rem; font-weight: 800; letter-spacing: 0.06em; }
.wine-fact strong { display: block; overflow-wrap: anywhere; color: var(--ink); font-size: 0.76rem; font-weight: 600; line-height: 1.35; }
.wine-fact--score strong { color: var(--wine); font-weight: 800; }

.draw-stage { min-height: 390px; padding: clamp(1rem, 3vw, 2.4rem); }
.empty-state { display: grid; min-height: 330px; place-items: center; align-content: center; gap: 1.2rem; text-align: center; }
.empty-seal { display: grid; place-items: center; width: 5rem; height: 5rem; border: 1px solid var(--copper); border-radius: 50%; color: var(--wine); font-family: var(--serif); font-size: 2.6rem; font-style: italic; }
.empty-state p { margin: 0; color: var(--ink-soft); }
.is-hidden { display: none !important; }
.order-table { width: 100%; border-collapse: collapse; }
.order-table th, .order-table td { padding: 1rem; border-bottom: 1px solid var(--line); text-align: left; }
.order-table th { color: var(--ink-soft); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; }
.order-table td { font-family: var(--serif); font-size: 1.2rem; }
.order-table td:first-child { width: 30%; color: var(--wine); font-style: italic; }
.order-table td:last-child { color: var(--ink-soft); font-family: var(--sans); font-size: 0.72rem; }
.draw-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }
.draw-footer p { margin: 0; color: var(--ink-soft); font-size: 0.8rem; }

.selection-counter { margin-bottom: 0.35rem; color: var(--wine); font-size: 0.76rem; font-weight: 900; letter-spacing: 0.06em; }
.selection-layout { display: grid; grid-template-columns: minmax(220px, 0.38fr) minmax(0, 1fr); gap: 1rem; }
.chooser-card { display: flex; min-height: 300px; flex-direction: column; justify-content: center; padding: 1.8rem; background: var(--wine); color: var(--paper); }
.chooser-card .panel-kicker { color: #e9b78f; }
.chooser-order { color: #e9b78f; font-family: var(--serif); font-size: 4rem; font-style: italic; line-height: 1; }
.chooser-card h3 { margin: 0.8rem 0; font-family: var(--serif); font-size: 2rem; font-weight: 400; }
.chooser-card p { margin: 0; color: rgba(246,239,223,0.75); font-size: 0.85rem; line-height: 1.5; }
.available-panel { padding: 1.2rem; border: 1px solid var(--line); background: rgba(255,255,255,0.32); }
.available-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.available-heading h3 { margin: 0; font-family: var(--serif); font-size: 1.45rem; font-weight: 400; }
.available-heading span { color: var(--wine); font-size: 0.72rem; font-weight: 900; }
.available-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.wine-choice { min-height: 125px; padding: 0.8rem; border: 1px solid var(--line); color: var(--ink); background: var(--paper); text-align: left; transition: transform 160ms ease, border-color 160ms ease, background 160ms ease; }
.wine-choice:hover { transform: translateY(-3px); border-color: var(--wine); background: #fffaf0; }
.wine-choice small { display: block; margin-bottom: 1.5rem; color: var(--wine); font-family: var(--serif); font-size: 1rem; font-style: italic; }
.wine-choice strong { display: block; font-family: var(--serif); font-size: 1rem; font-weight: 400; line-height: 1.2; }
.wine-choice span { display: block; margin-top: 0.4rem; color: var(--ink-soft); font-size: 0.68rem; }
.selection-log { margin-top: 1rem; padding: 1.2rem; }
.selection-table { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; }
.selection-row { padding: 0.8rem; border-top: 2px solid var(--paper-deep); }
.selection-row.is-current { border-top-color: var(--copper); background: rgba(189,115,72,0.08); }
.selection-row .selection-order { color: var(--wine); font-family: var(--serif); font-size: 1.2rem; font-style: italic; }
.selection-row strong { display: block; margin: 0.4rem 0; font-size: 0.82rem; }
.selection-row span { display: block; color: var(--ink-soft); font-size: 0.72rem; line-height: 1.35; }

.slide--closing { display: none; grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr); align-items: center; gap: clamp(2rem, 7vw, 7rem); background: var(--wine-dark); color: var(--paper); }
.slide--closing.is-active { display: grid; }
.slide--closing .eyebrow { color: #e9b78f; }
.slide--closing h2 { color: var(--paper); }
.slide--closing h2 em { color: #e9b78f; }
.slide--closing .closing-copy > p:last-child { color: rgba(246,239,223,0.72); }
.closing-card { padding: 1.5rem; border-color: rgba(246,239,223,0.2); background: rgba(36,28,29,0.22); box-shadow: none; }
.closing-card .panel-kicker { color: #e9b78f; }
.final-board { display: grid; gap: 0.55rem; }
.final-row { display: grid; grid-template-columns: 2.5rem 1fr; gap: 0.8rem; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid rgba(246,239,223,0.16); }
.final-row .final-order { color: #e9b78f; font-family: var(--serif); font-style: italic; }
.final-row strong { display: block; color: var(--paper); font-size: 0.82rem; }
.final-row span { display: block; margin-top: 0.2rem; color: rgba(246,239,223,0.65); font-size: 0.72rem; }
.leftover-note { margin-top: 1.2rem; color: #e9b78f; font-size: 0.74rem; line-height: 1.5; }

.nav-button { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border: 1px solid rgba(229, 207, 174, 0.32); color: var(--paper); background: transparent; font-size: 1.2rem; }
.nav-button:hover:not(:disabled) { color: var(--wine-dark); background: var(--copper); }
.nav-button:disabled { cursor: not-allowed; opacity: 0.3; }
.slide-dots { display: flex; gap: 0.45rem; margin-right: auto; }
.slide-dot { width: 0.42rem; height: 0.42rem; padding: 0; border: 0; border-radius: 50%; background: rgba(229,207,174,0.32); }
.slide-dot.is-active { background: var(--copper); transform: scale(1.35); }
.slide-counter { color: #dec6a9; font-family: var(--display); font-size: 0.95rem; font-style: italic; }
.toast { position: fixed; right: 1.5rem; bottom: 5.2rem; max-width: 320px; padding: 0.85rem 1rem; color: var(--paper); background: var(--ink); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity 180ms ease, transform 180ms ease; z-index: 5; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
  .wine-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .slide--hero, .slide--closing { grid-template-columns: 1fr; }
  .setup-card { max-width: 620px; }
  .wine-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rules-grid { grid-template-columns: repeat(2, 1fr); }
  .rule-card:nth-child(2) { border-right: 0; }
  .rule-card:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .selection-layout { grid-template-columns: 1fr; }
  .chooser-card { min-height: 190px; }
}

@media (max-width: 680px) {
  .topbar, .bottombar { padding: 0.9rem 1rem; }
  .event-meta { display: none; }
  .slide { min-height: calc(100vh - 7rem); padding: 2.4rem 1rem; }
  h1 { font-size: clamp(3rem, 15vw, 5rem); }
  .slide--hero h1 { font-size: clamp(2.1rem, 10vw, 3.6rem); }
  h2 { font-size: clamp(2.3rem, 11vw, 3.7rem); }
  .hero-copy::before { left: -1rem; width: 4px; }
  .hero-stats { gap: 1rem; margin-top: 2.2rem; }
  .hero-stats div { padding-right: 1rem; }
  .rules-grid { display: block; }
  .rule-card, .rule-card:nth-child(2) { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .rule-card:last-child { border-bottom: 0; }
  .rule-number { margin-bottom: 2rem; }
  .host-note { display: block; }
  .host-note .note-mark { display: block; margin-bottom: 0.5rem; }
  .section-heading-row, .draw-footer { display: block; }
  .section-aside { margin-top: 1rem; text-align: left; }
  .lineup-side { align-items: flex-start; }
  .lineup-pagination { margin-top: 0.2rem; }
  .section-heading-row .secondary-button, .draw-footer .primary-button { margin-top: 1.2rem; }
  .wine-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wine-card { min-height: 320px; padding: 0.9rem; }
  .wine-card h3 { min-height: 3.8rem; margin-top: 1.7rem; font-size: 1.15rem; }
  .wine-guide { min-height: 3.35rem; font-size: 0.68rem; }
  .wine-description { min-height: 4.5rem; font-size: 0.66rem; }
  .available-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .selection-table { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar .brand { font-size: 0.58rem; }
  .slide-dots { display: none; }
  .slide-counter { margin: 0 auto; }
  .toast { right: 1rem; bottom: 4.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media print {
  .topbar, .bottombar, .progress-track, .toast, .setup-card, .draw-footer, .secondary-button, .text-button { display: none !important; }
  .slide { display: block !important; min-height: auto; page-break-after: always; padding: 2rem; }
  .slide--hero, .slide--closing { display: grid !important; }
  .wine-grid { grid-template-columns: repeat(4, 1fr); }
}
