:root {
  color-scheme: dark;
  --bg: #0f0e0d;
  --bg-2: #171513;
  --line: #2a2724;
  --line-2: #3a3632;
  --text: #ede7dd;
  --text-2: #b4ada3;
  --muted: #7c766d;
  --gold: #c9a55e;
  --peat: #c27a55;
  --tile: #f2efe9;
  --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(56px + env(safe-area-inset-top, 0px)) 20px calc(40px + env(safe-area-inset-bottom, 0px));
}

/* ---------- 머리 ---------- */
.masthead { text-align: center; padding-bottom: 28px; }
.mark { margin: 0 0 18px; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--gold); font-size: .7rem; }
.mark span { width: 36px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.mark span:last-child { transform: scaleX(-1); }
.masthead h1 {
  margin: 0;
  font-size: clamp(1.7rem, 6vw, 2.3rem);
  font-weight: 300;
  letter-spacing: .42em;
  margin-right: -.42em; /* 자간 보정 */
  color: var(--text);
}
.sub { margin: 14px 0 0; font-size: .72rem; letter-spacing: .32em; text-transform: uppercase; color: var(--muted); }

/* ---------- 정렬 ---------- */
.sortbar { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 0 0 16px; }
.sort-toggle {
  border: 1px solid var(--line); background: none; border-radius: 999px; cursor: pointer;
  padding: 6px 14px; font-size: .76rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px;
}
.sort-toggle b { color: var(--text-2); font-weight: 500; }
.sort-toggle i { font-style: normal; font-size: .7em; transition: transform .15s; }
.sort-toggle[aria-expanded="true"] i { transform: rotate(180deg); }
.sort-toggle:hover { border-color: var(--line-2); }
.sort { display: flex; justify-content: center; flex-wrap: wrap; row-gap: 6px; }
.sort button {
  border: 0; background: none; cursor: pointer; padding: 2px 14px; line-height: 1;
  font-size: .8rem; color: var(--muted); border-left: 1px solid var(--line-2);
  display: inline-flex; align-items: center; gap: 4px;
}
.sort button:first-child { border-left: 0; }
.sort button:hover { color: var(--text-2); }
.sort button[aria-pressed="true"] { color: var(--gold); }
.sort button i { font-style: normal; font-size: .9em; }

/* ---------- 분류 바 ---------- */
.tabs {
  position: sticky; top: 0; z-index: 5;
  margin: 0 -20px;
  background: rgba(15, 14, 13, .92);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.tabs-in {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 26px;
  padding: 14px 20px;
}
.tabs a {
  flex: none; position: relative;
  font-size: .86rem; color: var(--muted); text-decoration: none; white-space: nowrap; padding: 2px 0;
  transition: color .15s;
}
.tabs a:hover { color: var(--text-2); }
.tabs a.on { color: var(--text); }
.tabs a.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: var(--gold); }

/* ---------- 섹션 ---------- */
.section { padding-top: 52px; scroll-margin-top: 56px; }
.sec-head { display: flex; align-items: baseline; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line-2); }
.sec-head h2 { margin: 0; font-size: .78rem; font-weight: 600; letter-spacing: .28em; text-transform: uppercase; color: var(--gold); }
.sec-head .ko { font-size: .78rem; color: var(--muted); }
.sec-head .cnt { margin-left: auto; font-size: .72rem; color: var(--muted); }

.items { list-style: none; margin: 0; padding: 0; }
.items > li.rv-init { opacity: 0; transform: translateY(10px); transition: opacity .5s ease, transform .5s ease; }
.items > li.rv-init.in { opacity: 1; transform: none; }
.item {
  width: 100%; display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 18px; align-items: start;
  padding: 16px 0; background: none; border: 0; border-bottom: 1px solid var(--line);
  text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.item:active { background: var(--bg-2); }
@media (hover: hover) { .item:hover .name { color: #fff; } .item:hover .thumb { transform: translateY(-2px); } }

.thumb {
  width: 64px; height: 80px; border-radius: 6px; overflow: hidden;
  background: var(--tile); display: grid; place-items: center; transition: transform .2s ease;
}
.thumb { position: relative; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* 배경 지운 병: 어두운 칸 + 아래에서 올라오는 은은한 조명 */
.thumb.cut, .sheet .media.cut {
  background:
    radial-gradient(ellipse 75% 55% at 50% 100%, rgba(201, 165, 94, .20), transparent 70%),
    linear-gradient(180deg, #1c1916, #121110);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}
.thumb.cut img { object-fit: contain; padding: 7px 6px 5px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.55)); }
.ph { width: 100%; height: 100%; display: grid; place-items: center; background: var(--tile); }
.ph svg { width: 30%; max-width: 64px; height: auto; fill: none; stroke: #b8b0a2; stroke-width: 1.6; stroke-linejoin: round; }

.main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.name { font-size: 1rem; font-weight: 500; line-height: 1.4; color: var(--text); transition: color .15s; }

/* ★점수 │ 도수 │ 숙성 │ 피트 */
.meta { display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px; font-size: .82rem; color: var(--text-2); line-height: 1; }
.meta > span { padding: 0 10px; border-left: 1px solid var(--line-2); }
.meta > span:first-child { padding-left: 0; border-left: 0; }
.score { color: var(--gold); font-weight: 600; display: inline-flex; align-items: baseline; gap: 3px; }
.score .star { font-size: .82em; }
.peat { color: var(--peat); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.bars { display: inline-flex; gap: 2px; align-items: center; }
.bars i { width: 2px; height: 10px; background: var(--line-2); }
.bars i.on { background: var(--peat); }
.peat-line { font-size: .76rem; line-height: 1; }
.item .line { margin-top: 2px; font-size: .86rem; line-height: 1.5; color: var(--text-2); }
.item .notes { font-size: .78rem; line-height: 1.5; color: var(--muted); }
.item .rv { display: flex; gap: 8px; align-items: baseline; margin-top: 2px; font-size: .8rem; color: var(--text-2); min-width: 0; }
.item .rv q { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: italic; }
.item .rv q::before { content: "“"; color: var(--gold); } .item .rv q::after { content: "”"; color: var(--gold); }
.item .rv .who { flex: none; font-size: .72rem; color: var(--muted); }
.item .rv .g { flex: none; font-size: .76rem; color: var(--gold); font-weight: 600; }

/* 개인 점수 */
.pts { color: var(--gold); font-weight: 600; font-size: .84rem; }
.pts small { font-size: .7em; margin-left: 1px; color: var(--muted); font-weight: 400; }
.sheet .rv h3 .avg { margin-left: 12px; letter-spacing: 0; font-weight: 400; color: var(--muted); }
.sheet .rv h3 .avg b { color: var(--gold); font-weight: 600; }
.rate { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.rate-l { font-size: .8rem; color: var(--muted); flex: none; }
#rate-range { flex: 1; min-width: 0; width: auto; padding: 0; background: none; border: 0; accent-color: #5a544c; height: 28px; opacity: .7; }
#rate-range.set { opacity: 1; }
#rate-range.set { accent-color: var(--gold); }
#rate-num {
  width: 64px; flex: none; text-align: center; font-size: 1.1rem; font-weight: 600; color: var(--gold);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 4px; -moz-appearance: textfield;
}
#rate-num::-webkit-outer-spin-button, #rate-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#rate-num::placeholder { color: var(--muted); }

.price { text-align: right; white-space: nowrap; padding-top: 1px; }
.price b { display: block; font-size: 1.02rem; font-weight: 500; color: var(--text); letter-spacing: .01em; }
.price small { display: block; margin-top: 2px; font-size: .66rem; color: var(--muted); letter-spacing: .06em; }

.foot {
  margin-top: 64px; padding-top: 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap;
  font-size: .72rem; color: var(--muted); letter-spacing: .04em;
}
.foot p { margin: 0; }

/* ---------- 상세 ---------- */
.sheet {
  width: min(820px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  padding: 0; border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg); color: var(--text);
  box-shadow: 0 40px 100px -20px rgba(0,0,0,.8);
}
.sheet::backdrop { background: rgba(0,0,0,.7); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet[open] { animation: rise .22s ease; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-inner { display: grid; grid-template-columns: 300px minmax(0, 1fr); }
.sheet .media { position: relative; background: var(--tile); min-height: 400px; }
.sheet .media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sheet .media.cut img { object-fit: contain; padding: 36px 32px 28px; filter: drop-shadow(0 14px 18px rgba(0,0,0,.6)); }
.sheet .media.cut { border-right: 1px solid var(--line); }
.sheet .media .ph { position: absolute; inset: 0; }
.sheet .content { padding: 36px 36px 30px; min-width: 0; }
.sheet .close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(15,14,13,.75); color: var(--text); font-size: .95rem; line-height: 1;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.sheet .kicker { margin: 0 0 10px; font-size: .7rem; letter-spacing: .24em; text-transform: uppercase; color: var(--gold); }
.sheet h2 { margin: 0; padding-right: 32px; font-size: 1.45rem; font-weight: 600; line-height: 1.35; }
.sheet .en { margin: 6px 0 0; font-size: .88rem; color: var(--muted); }
.sheet .origin { margin: 2px 0 0; font-size: .82rem; color: var(--muted); }
.sheet .desc { margin: 20px 0; font-size: 1rem; line-height: 1.65; color: var(--text-2); }

.spec { padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.spec .big { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 14px; }
.score.lg { font-size: 2.4rem; font-weight: 500; letter-spacing: -.01em; gap: 6px; }
.score.lg .star { font-size: .55em; }
.spec .cap { font-size: .74rem; color: var(--muted); text-decoration: none; }
.spec .cap:hover { color: var(--text-2); text-decoration: underline; }
.spec .nums { display: flex; align-items: center; flex-wrap: wrap; row-gap: 8px; font-size: 1.05rem; font-weight: 500; line-height: 1; }
.spec .nums > span { padding: 0 14px; border-left: 1px solid var(--line-2); }
.spec .nums > span:first-child { padding-left: 0; border-left: 0; }
.spec .nums .peat { font-size: .86rem; }
.spec .nums .bars i { height: 12px; }
.spec .subs { margin: 10px 0 0; font-size: .74rem; color: var(--muted); }
.spec .glass { margin: 14px 0 0; font-size: .82rem; color: var(--muted); }
.spec .glass b { font-size: 1.15rem; font-weight: 500; color: var(--text); margin: 0 3px; }
.spec .glass span { font-size: .72rem; }

.notes-list { margin: 20px 0 0; display: grid; gap: 10px; }
.notes-list div { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 14px; font-size: .9rem; }
.notes-list dt { font-size: .76rem; color: var(--muted); padding-top: 2px; }
.notes-list dd { margin: 0; color: var(--text-2); }
.notes-list .tasting dd { color: var(--text); }
.notes-list .owner dt { color: var(--gold); }
.notes-list .owner dd { color: var(--text); }
.notes-list a { color: var(--text-2); text-underline-offset: 3px; }
.sheet .sources { margin: 18px 0 0; font-size: .72rem; color: var(--muted); }
.sheet .sources a { color: var(--muted); text-underline-offset: 3px; }

/* 후기 */
.sheet .rv { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); }
.sheet .rv h3 { margin: 0 0 12px; font-size: .74rem; font-weight: 600; letter-spacing: .24em; color: var(--gold); }
.sheet .rv h3 .n { color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.review-form { display: grid; gap: 8px; }
.review-form textarea, .review-form input:not(.hp) {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 11px 12px; color: var(--text); font-size: 1rem; outline: none;
}
.review-form textarea:focus, .review-form input:focus { border-color: var(--line-2); }
.review-form textarea { resize: vertical; min-height: 72px; line-height: 1.55; }
.review-form ::placeholder { color: var(--muted); }
.review-form .form-foot { display: flex; gap: 8px; }
.review-form .form-foot input { flex: 1; min-width: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.btn {
  border: 0; border-radius: 8px; background: var(--text); color: var(--bg);
  font-weight: 600; font-size: .9rem; padding: 0 20px; cursor: pointer;
}
.btn:hover { background: #fff; }
.btn:disabled { opacity: .5; cursor: progress; }
.hint { margin: 0; min-height: 1em; font-size: .78rem; color: var(--muted); }
.hint.err { color: #e08a6c; }
.hint.ok { color: #9cbf8a; }
.review-list { list-style: none; margin: 8px 0 0; padding: 0; }
.review { padding: 14px 0; border-top: 1px solid var(--line); }
.review header { display: flex; align-items: baseline; gap: 10px; font-size: .78rem; color: var(--muted); }
.review header strong { color: var(--text); font-weight: 600; font-size: .86rem; }
.review p { margin: 6px 0 0; white-space: pre-wrap; color: var(--text-2); font-size: .92rem; }
.link { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-size: .78rem; text-decoration: underline; text-underline-offset: 3px; }
.review .del { margin-left: auto; }

.sheet .nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.sheet .nav .link { max-width: 48%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; color: var(--text-2); font-size: .82rem; }
.sheet .nav .link:hover { color: var(--text); }

/* ---------- 모바일 ---------- */
@media (max-width: 640px) {
  .page { padding: calc(36px + env(safe-area-inset-top, 0px)) 16px calc(32px + env(safe-area-inset-bottom, 0px)); }
  .masthead { padding-bottom: 22px; }
  .mark { margin-bottom: 14px; }
  .sortbar { margin-bottom: 10px; }
  .tabs { margin: 0 -16px; }
  .tabs-in { padding: 12px 16px; gap: 6px 18px; }
  .tabs a { font-size: .82rem; }
  .item .notes { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .section { padding-top: 40px; }
  .item { grid-template-columns: 72px minmax(0, 1fr) auto; gap: 14px; padding: 16px 0; align-items: start; }
  .thumb { width: 72px; height: 92px; }
  .name { font-size: .98rem; }
  .meta { font-size: .8rem; }
  .meta > span { padding: 0 8px; }
  .price b { font-size: .98rem; }

  .sheet { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .sheet-inner { grid-template-columns: 1fr; }
  .sheet .media { min-height: 46vh; }
  .sheet .content { padding: 24px 20px calc(32px + env(safe-area-inset-bottom, 0px)); }
  .sheet .close { top: calc(12px + env(safe-area-inset-top, 0px)); }
  .score.lg { font-size: 2.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
