:root {
  --ground: #f0f2f7; --paper: #fff; --ink: #131a2b; --soft: #586176; --line: #d8dde8;
  --navy: #0b1838; --accent: #1e3c78; --brass: #86631f; --champagne: #e3c98f;
  --sparkling: #e6cf86; --white: #cdbd5a; --rose: #e39aa3; --red: #8e1c38; --dessert: #b9691f;
  --display: 'Hahmlet', 'AppleMyungjo', 'Noto Serif KR', serif;
  --body: 'Pretendard', -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  --nav-h: 60px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 16px/1.6 var(--body); word-break: keep-all; overflow-wrap: anywhere;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
:focus-visible { outline: 3px solid #3b5bd6; outline-offset: 2px; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px; }
h1, h2, h3, p { margin: 0; }

.draft { background: var(--champagne); color: #33230a; text-align: center; font-size: 14px; padding: 7px 16px; }

/* 표지: 시상식 무대 */
.hero { position: relative; overflow: hidden; color: #fff; text-align: center; padding: calc(34px + env(safe-area-inset-top)) 0 0; background: #040915 url(img/stage.svg) center top / cover no-repeat; }
.hero h1 { font: 400 clamp(34px, 10.4vw, 60px)/1.1 'Marcellus', var(--display); letter-spacing: -.012em; font-variant-numeric: lining-nums;
  color: #f3dcae; background: linear-gradient(#fff6df, #edcb8c 62%, #c99a52); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-ko { color: #f3dfb6; font: 400 18px/1.4 var(--display); margin-top: 10px; }
.hero-meta { color: #e6ebf7; font-size: 15px; line-height: 1.55; margin-top: 14px; }
.hero-meta span { display: block; }
.hero-meta span:first-child { font-weight: 600; font-size: 16px; color: #fff; }
.podium { display: block; width: 100%; max-width: 460px; margin: 18px auto 0; overflow: visible; }
.sheen { animation: sheen 1.6s .6s ease-out 1 both; }
@keyframes sheen { from { translate: 0 0; } to { translate: 260px 0; } }

/* 하단 메뉴 */
.nav { position: fixed; inset: auto 0 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--paper);
  border-top: 1px solid var(--line); padding: 0 max(8px, calc((100vw - 760px) / 2)) env(safe-area-inset-bottom); }
.nav button { height: var(--nav-h); color: var(--soft); font-size: 15px; border-top: 3px solid transparent; margin-top: -1px; }
.nav button[aria-current] { color: var(--accent); font-weight: 700; border-top-color: var(--accent); }

/* 검색, 필터 */
#filters { position: sticky; top: 0; z-index: 10; background: var(--ground); margin: 0 -20px; padding: 14px 20px 10px; border-bottom: 1px solid var(--line); }
.search { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.search input, select, textarea { width: 100%; background: var(--paper); border: 1px solid #aeb6c6; border-radius: 10px; font-size: 16px; }
.search input { height: 46px; padding: 0 14px; -webkit-appearance: none; appearance: none; }
#more { height: 46px; padding: 0 16px; border: 1px solid #aeb6c6; border-radius: 10px; background: var(--paper); white-space: nowrap; }
#more[aria-expanded=true], #more.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 10px -20px 0; padding: 2px 20px; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; min-height: 40px; padding: 0 14px; border-radius: 20px; background: #e0e5ef; font-size: 15px; white-space: nowrap; }
.chips button[aria-pressed=true] { background: var(--ink); color: #fff; }
.selects { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.selects label { font-size: 13px; color: var(--soft); min-width: 0; }
select { height: 46px; padding: 0 10px; color: var(--ink); display: block; margin-top: 3px; }

.count { display: flex; justify-content: space-between; align-items: center; min-height: 48px; font-size: 14px; color: var(--soft); }
#clear, .mine-actions button { min-height: 44px; color: var(--accent); text-decoration: underline; text-underline-offset: 4px; font-size: 15px; }
.index { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 8px; }
.index button { min-width: 38px; height: 40px; border-radius: 8px; font: 600 16px var(--display); color: var(--accent); }
.index button:active { background: #e0e5ef; }

/* 목록 */
.group { margin-bottom: 26px; scroll-margin-top: 128px; }
.group > h2 { font: 600 20px/1.35 var(--display); letter-spacing: -.02em; padding: 10px 0 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.group > h2 small { font: 400 14px var(--body); color: var(--soft); letter-spacing: 0; white-space: nowrap; }
.sheet { background: var(--paper); border-radius: 14px; overflow: hidden; }
.wine + .wine { border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 22px 1fr auto; gap: 14px; width: 100%; text-align: left; padding: 15px 16px; align-items: start; }
.dot { width: 22px; height: 22px; border-radius: 50%; background: var(--c); margin-top: 2px; box-shadow: inset 0 0 0 1px #0000001f; }
.row b { font-weight: 600; font-size: 17px; line-height: 1.4; display: block; }
.row .orig { color: var(--soft); font-size: 14px; line-height: 1.4; display: block; }
.row .by { color: var(--soft); font-size: 14px; display: block; margin-top: 3px; }
.medal { font-size: 13px; font-weight: 600; color: var(--brass); white-space: nowrap; display: grid; justify-items: end; gap: 4px; margin-top: 3px; }
.medal.silver { color: #596270; }
.medal { justify-items: center; min-width: 56px; }
/* 메달: 받은 원본 그림을 그대로 쓰고, 여백만 CSS로 잘라 보인다. disc는 앞면 원, badge는 전체 */
.disc, .badge { display: block; background-repeat: no-repeat; }
.disc { width: 46px; height: 46px; border-radius: 50%; }
.badge { width: 100%; aspect-ratio: 572 / 274; }
.grand_gold .disc, .badge.grand_gold { background-image: url(img/medal-grand_gold.png); }
.gold .disc, .badge.gold { background-image: url(img/medal-gold.png); }
.silver .disc, .badge.silver { background-image: url(img/medal-silver.png); }
.grand_gold .disc { background-size: 272.79% auto; background-position: 44.47% 48.41%; }
.gold .disc { background-size: 233.09% auto; background-position: 28.18% 46.96%; }
.silver .disc { background-size: 236.76% auto; background-position: 23.66% 48.21%; }
.badge.grand_gold { background-size: 129.72% auto; background-position: 82.35% 48.62%; }
.badge.gold { background-size: 110.84% auto; background-position: 51.61% 47.17%; }
.badge.silver { background-size: 112.78% auto; background-position: 26.03% 48.45%; }
.detail .badge { max-width: 210px; margin: 0 0 14px; }
.medals button { display: grid; grid-template-columns: minmax(0, 170px) 1fr auto; gap: 12px; align-items: center; width: 100%; padding: 14px 16px; text-align: left; }
.medals button + button { border-top: 1px solid var(--line); }
.medals b { font: 600 18px/1.4 var(--display); white-space: nowrap; }
.medals button > span:last-child { color: var(--soft); font-size: 14px; white-space: nowrap; }
.mark { color: var(--accent); }
.detail { padding: 0 16px 18px 52px; }
.detail dl { margin: 0 0 14px; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 15px; }
.detail dt { color: var(--soft); }
.detail dd { margin: 0; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--ground); border-radius: 10px; padding: 3px; }
.seg button { min-height: 44px; border-radius: 8px; font-size: 15px; }
.seg button[aria-pressed=true] { background: var(--paper); font-weight: 600; box-shadow: 0 1px 3px #131a2b33; }
.seg button[data-s=pick][aria-pressed=true] { background: var(--accent); color: #fff; }
.stars { display: flex; margin: 8px 0 8px -8px; }
.stars button { width: 46px; height: 46px; font-size: 27px; line-height: 1; color: #9aa3b5; }
.stars button.on { color: var(--brass); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tags button { min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 19px; font-size: 14px; }
textarea { min-height: 92px; padding: 10px 12px; display: block; resize: vertical; }
.empty { padding: 36px 0; text-align: center; color: var(--soft); }

/* 참가사 */
#company-view { padding-top: 20px; }
.co { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; width: 100%; text-align: left; padding: 15px 16px; }
.co + .co { border-top: 1px solid var(--line); }
.co b { font: 600 18px/1.4 var(--display); }
.co span { color: var(--soft); font-size: 14px; }
.co .n { text-align: right; white-space: nowrap; }
.booth { color: var(--accent) !important; font-weight: 700; }
.lead { color: var(--soft); margin-bottom: 14px; }

/* 내 시음, 안내 */
#mine-head { padding-top: 20px; }
.mine-sum { font: 600 22px/1.45 var(--display); letter-spacing: -.02em; }
.mine-actions { display: flex; gap: 24px; margin-top: 4px; }
#reset.armed { color: #b3001b; font-weight: 700; }
#guide-view { padding-top: 6px; max-width: 62ch; }
#guide-view h2 { font: 600 24px/1.35 var(--display); letter-spacing: -.025em; margin: 32px 0 12px; }
#guide-view p + p { margin-top: 8px; }
.facts { margin: 16px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; }
.facts dt { color: var(--soft); }
.facts dd { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
.go { width: 100%; min-height: 52px; margin-top: 20px; border-radius: 12px; background: var(--navy); color: #f6e3b8; font-weight: 600; font-size: 17px; }
.steps { padding-left: 22px; margin: 0 0 14px; }
.steps li { padding-left: 4px; margin-bottom: 10px; }
.steps li::marker { color: var(--accent); font-weight: 700; }
.note { background: var(--paper); border-radius: 14px; padding: 16px 18px; margin-top: 16px; }
.updated { color: var(--soft); font-size: 14px; }
.load { padding: 40px 0; text-align: center; }
.load button { color: var(--accent); text-decoration: underline; min-height: 44px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px); transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 15px;
  padding: 10px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30; width: max-content; max-width: calc(100vw - 40px); }
.toast.on { opacity: 1; }
@media (max-width: 350px) { .detail { padding-left: 16px; } .stars button { width: 42px; } }
@media (prefers-reduced-motion: reduce) { .sheen { display: none; } * { transition: none !important; scroll-behavior: auto !important; } }
