@font-face { font-family: 'Barlow C'; src: url('fonts/BarlowCondensed-Regular.ttf'); font-weight: 400; }
@font-face { font-family: 'Barlow C'; src: url('fonts/BarlowCondensed-Medium.ttf'); font-weight: 500; }
@font-face { font-family: 'Barlow C'; src: url('fonts/BarlowCondensed-SemiBold.ttf'); font-weight: 600; }
@font-face { font-family: 'Cormorant'; src: url('fonts/CormorantGaramond-VariableFont_wght.ttf'); font-weight: 300 700; }
:root { --ink: #1f1b17; --paper: #f3e8cf; --paper2: #e5d4b0; --gold: #d9a441; --gold2: #f0c76a; --frost: #a9cdeb; --frost2: #e9f4ff; --terra: #c4673f; --shade: #34426a; --card: rgba(31, 27, 23, .88); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--paper); font-family: 'Barlow C', 'Arial Narrow', sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
#cv { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* screens */
.scr { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; pointer-events: none; z-index: 20; }
.scr .card { pointer-events: auto; }
.card { background: var(--card); border: 1px solid rgba(217, 164, 65, .35); border-radius: 18px; padding: 26px 28px; width: min(420px, 94vw); max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .05); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); text-align: center; animation: rise .28s ease-out; }
.card.wide { width: min(760px, 96vw); }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.titleCard { background: rgba(26, 22, 19, .78); width: min(460px, 94vw); }
.logo { font-family: 'Cormorant', Georgia, serif; font-weight: 600; font-size: clamp(54px, 11vw, 84px); letter-spacing: .02em; line-height: 1; color: var(--paper); display: flex; align-items: center; justify-content: center; gap: 14px; }
.logo .mark { width: .62em; height: .62em; border-radius: 50%; background: radial-gradient(circle at 50% 50%, #fff3c4 0 34%, var(--gold) 36% 54%, transparent 56%); position: relative; box-shadow: 0 0 26px rgba(240, 199, 106, .55); }
.logo .mark::after { content: ''; position: absolute; left: 50%; top: 50%; width: .9em; height: .1em; background: linear-gradient(90deg, rgba(52, 66, 106, .9), rgba(52, 66, 106, 0)); transform-origin: 0 50%; transform: rotate(35deg); border-radius: 2px; }
.tag { font-family: 'Cormorant', Georgia, serif; font-style: italic; font-size: 21px; color: var(--paper2); margin: 10px 0 22px; line-height: 1.25; }
h2 { font-family: 'Cormorant', Georgia, serif; font-weight: 600; font-size: 34px; margin: 4px 0 10px; }
h3 { font-weight: 500; text-transform: uppercase; letter-spacing: .14em; font-size: 13px; color: var(--gold2); margin: 14px 0 8px; text-align: left; }
.eyebrow { text-transform: uppercase; letter-spacing: .2em; font-size: 13px; color: var(--frost); }
.eyebrow.warm { color: #f0a476; }
.muted { color: #cbbd9f; font-size: 17px; line-height: 1.35; margin: 4px 0 14px; }
.small { font-size: 14px; margin-top: 12px; }
.col { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.row2 { display: flex; gap: 10px; } .row2 > * { flex: 1; }
.col button, .set button { border: 1px solid rgba(243, 232, 207, .22); background: rgba(243, 232, 207, .06); border-radius: 12px; padding: 12px 14px; font-size: 20px; font-weight: 500; letter-spacing: .04em; transition: background .15s, transform .08s, border-color .15s; }
.col button:hover, .set button:hover { background: rgba(243, 232, 207, .13); border-color: rgba(240, 199, 106, .55); }
.col button:active { transform: scale(.98); }
button.big { background: linear-gradient(180deg, #e9b858, #c88f2f); color: #22190f; border-color: transparent; font-weight: 600; font-size: 23px; box-shadow: 0 6px 18px rgba(217, 164, 65, .28); }
button.big:hover { background: linear-gradient(180deg, #f2c66a, #d39a38); }
button small { font-size: 14px; opacity: .65; font-weight: 400; margin-left: 4px; text-transform: lowercase; }
button:disabled { opacity: .38; cursor: default; }
.foot { margin-top: 18px; font-size: 14px; color: #a89a7e; letter-spacing: .05em; }
.hdr { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.hdr h2 { flex: 1; text-align: left; margin: 0; }
.back { width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(243, 232, 207, .25); background: none; font-size: 26px; line-height: 1; padding-bottom: 4px; }
.pill { background: rgba(217, 164, 65, .16); border: 1px solid rgba(217, 164, 65, .4); padding: 4px 12px; border-radius: 99px; font-size: 17px; color: var(--gold2); white-space: nowrap; }
#tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 6px; }
.tab { flex: 1 1 110px; border: 1px solid rgba(243, 232, 207, .18); background: rgba(243, 232, 207, .04); border-radius: 10px; padding: 8px 6px; font-size: 16px; line-height: 1.15; }
.tab small { display: block; opacity: .65; font-size: 13px; }
.tab.on { background: rgba(217, 164, 65, .2); border-color: var(--gold); }
.tab.locked { opacity: .45; }
#worldBlurb { font-family: 'Cormorant', Georgia, serif; font-style: italic; font-size: 19px; color: var(--paper2); margin: 8px 0 12px; min-height: 24px; }
#lvGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.lv { border: 1px solid rgba(243, 232, 207, .2); background: rgba(243, 232, 207, .05); border-radius: 12px; padding: 12px 8px 10px; text-align: center; min-height: 92px; }
.lv:hover:not(:disabled) { border-color: var(--gold); background: rgba(243, 232, 207, .1); }
.lv .num { font-family: 'Cormorant', Georgia, serif; font-size: 28px; font-weight: 600; line-height: 1; }
.lv .nm { font-size: 15px; opacity: .85; margin: 4px 0; }
.lv .st { letter-spacing: 2px; font-size: 15px; color: rgba(243, 232, 207, .25); }
.lv .st b { color: var(--gold2); font-weight: 400; }
.lv.next { box-shadow: 0 0 0 2px rgba(217, 164, 65, .55) inset; }
.stars { display: flex; justify-content: center; gap: 14px; margin: 10px 0 12px; }
.stars span { width: 52px; height: 52px; background: rgba(243, 232, 207, .14); clip-path: polygon(50% 0, 61% 36%, 100% 38%, 69% 61%, 80% 100%, 50% 77%, 20% 100%, 31% 61%, 0 38%, 39% 36%); transition: background .3s, transform .3s; }
.stars span.on { background: linear-gradient(180deg, #ffe39a, #d9a441); animation: pop .45s cubic-bezier(.3, 1.6, .5, 1) both; }
.stars span:nth-child(2).on { animation-delay: .25s; } .stars span:nth-child(3).on { animation-delay: .5s; }
@keyframes pop { from { transform: scale(.2) rotate(-40deg); } to { transform: none; } }
#winStats, #endStats { font-size: 18px; line-height: 1.6; color: #e0d2b4; margin-bottom: 12px; }
#winStats .unlock, #endStats .unlock { color: var(--frost); }
.goalRow { display: flex; justify-content: space-between; gap: 10px; }
.goalRow .ok { color: var(--gold2); } .goalRow .no { color: #8d8270; }

/* settings */
.set { display: flex; flex-direction: column; gap: 12px; text-align: left; font-size: 18px; }
.set label { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.set input[type=range] { width: 56%; accent-color: var(--gold); }
.set input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--gold); }
.set select { font: inherit; font-size: 16px; background: #2b2520; color: var(--paper); border: 1px solid rgba(243, 232, 207, .25); border-radius: 8px; padding: 4px 6px; }
.danger { color: #f1a58a !important; border-color: rgba(241, 165, 138, .35) !important; margin-top: 6px; }

/* wardrobe */
.wardWrap { display: flex; gap: 18px; align-items: flex-start; }
#wardPreview { width: 200px; height: 200px; border-radius: 16px; background: radial-gradient(circle at 50% 40%, #efdcb2, #c9ad7d); flex: none; position: sticky; top: 0; }
.wardLists { flex: 1; min-width: 0; }
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.cos { border: 1px solid rgba(243, 232, 207, .18); background: rgba(243, 232, 207, .05); border-radius: 10px; padding: 8px 4px 6px; font-size: 14px; line-height: 1.1; min-height: 64px; }
.cos canvas { display: block; margin: 0 auto 4px; width: 34px; height: 34px; }
.cos.on { border-color: var(--gold); background: rgba(217, 164, 65, .18); }
.cos.locked { opacity: .45; }
.cos .req { display: block; font-size: 12px; opacity: .8; margin-top: 2px; }
@media (max-width: 560px) { .wardWrap { flex-direction: column; align-items: center; } #wardPreview { width: 150px; height: 150px; position: static; } .wardLists { width: 100%; } .card { padding: 20px 16px; } }

/* HUD */
#hud { position: fixed; left: 0; right: 0; top: 0; display: flex; align-items: flex-start; justify-content: space-between; padding: max(10px, env(safe-area-inset-top)) 12px 0; z-index: 10; pointer-events: none; }
#hud button { pointer-events: auto; }
#hudL { display: flex; flex-direction: column; gap: 6px; min-width: 130px; }
#frost { position: relative; width: 150px; height: 22px; border-radius: 11px; background: rgba(20, 18, 16, .55); border: 1px solid rgba(233, 244, 255, .35); overflow: hidden; }
#frostFill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: linear-gradient(90deg, #7fb3df, #e9f4ff); transition: background .2s; }
#frost.hot #frostFill { background: linear-gradient(90deg, #e9875c, #f6cfa4); }
#frost.low { animation: throb .5s ease-in-out infinite alternate; }
@keyframes throb { to { box-shadow: 0 0 14px rgba(240, 140, 90, .8); } }
#frostTxt { position: absolute; inset: 0; display: flex; align-items: center; padding-left: 10px; font-size: 14px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #1d2a3a; }
#blooms { display: flex; gap: 4px; font-size: 18px; }
#blooms i { font-style: normal; color: rgba(233, 244, 255, .3); text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
#blooms i.got { color: #e9f4ff; text-shadow: 0 0 8px rgba(169, 205, 235, .9); } #blooms i.lost { color: rgba(240, 150, 110, .55); }
#hudMid { text-align: center; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); padding-top: 2px; }
#hudName { font-family: 'Cormorant', Georgia, serif; font-size: 24px; font-weight: 600; line-height: 1; }
#hudSub { font-size: 14px; letter-spacing: .12em; text-transform: uppercase; opacity: .8; }
#hudR { display: flex; gap: 8px; }
.ico { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(243, 232, 207, .3); background: rgba(20, 18, 16, .55); display: flex; align-items: center; justify-content: center; padding: 0; }
.ico svg { width: 22px; height: 22px; fill: var(--paper); }
#toast { position: fixed; left: 50%; bottom: max(26px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: rgba(24, 21, 18, .86); border: 1px solid rgba(217, 164, 65, .4); padding: 10px 18px; border-radius: 12px; font-size: 18px; z-index: 15; max-width: 88vw; text-align: center; pointer-events: none; animation: rise .25s ease-out; }
#coach { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); font-family: 'Cormorant', Georgia, serif; font-size: 26px; font-weight: 600; text-align: center; color: #fff8e6; text-shadow: 0 2px 10px rgba(0, 0, 0, .75), 0 0 2px rgba(0, 0, 0, .9); z-index: 12; pointer-events: none; max-width: 86vw; line-height: 1.2; transition: opacity .3s; }
#coach small { display: block; font-family: 'Barlow C', sans-serif; font-size: 17px; font-weight: 500; letter-spacing: .06em; opacity: .9; margin-top: 6px; }

/* side panels (wide desktop only) */
.panel { position: fixed; top: 0; bottom: 0; width: 320px; padding: 26px 24px; z-index: 5; display: none; flex-direction: column; gap: 14px; overflow: hidden; color: var(--paper); }
.panel.show { display: flex; }
#panelL { left: 0; } #panelR { right: 0; } #panelR #dial { align-self: center; }
.pTitle { font-family: 'Cormorant', Georgia, serif; font-weight: 600; font-size: 30px; color: var(--paper); border-bottom: 1px solid rgba(217, 164, 65, .35); padding-bottom: 8px; width: 100%; }
.panel .sec { background: rgba(20, 18, 16, .5); border: 1px solid rgba(243, 232, 207, .1); border-radius: 14px; padding: 14px 16px; width: 100%; }
.panel .sec h4 { margin: 0 0 8px; font-weight: 500; text-transform: uppercase; letter-spacing: .16em; font-size: 13px; color: var(--gold2); }
.panel .big1 { font-family: 'Cormorant', Georgia, serif; font-size: 26px; font-weight: 600; line-height: 1.1; }
.panel p { margin: 6px 0; font-size: 17px; line-height: 1.35; color: #ddd0b4; }
.panel .kv { display: flex; justify-content: space-between; font-size: 17px; padding: 3px 0; color: #ddd0b4; }
.panel .kv b { font-weight: 500; color: var(--paper); }
.panel .goal { display: flex; align-items: center; gap: 10px; font-size: 17px; padding: 4px 0; }
.panel .goal .d { width: 18px; height: 18px; flex: none; clip-path: polygon(50% 0, 61% 36%, 100% 38%, 69% 61%, 80% 100%, 50% 77%, 20% 100%, 31% 61%, 0 38%, 39% 36%); background: rgba(243, 232, 207, .2); }
.panel .goal.ok .d { background: var(--gold2); } .panel .goal.bad { opacity: .5; text-decoration: line-through; }
.panel .keys span { display: inline-block; border: 1px solid rgba(243, 232, 207, .3); border-radius: 5px; padding: 0 6px; margin: 0 2px; font-size: 14px; }
#dial { width: 230px; height: 230px; }
#panelR .frostBig { width: 100%; }
.thermo { height: 14px; border-radius: 7px; background: rgba(0, 0, 0, .35); overflow: hidden; border: 1px solid rgba(233, 244, 255, .25); margin-top: 6px; }
.thermo i { display: block; height: 100%; background: linear-gradient(90deg, #7fb3df, #e9f4ff); }
.thermo.hot i { background: linear-gradient(90deg, #e9875c, #f6cfa4); }

/* refine 1: HUD fits phones and wide screens */
body.wide #hudMid { display: none; }
body.narrow #hudMid { position: absolute; left: 0; right: 0; top: max(60px, calc(env(safe-area-inset-top) + 50px)); }
body.narrow #hudName { font-size: 22px; } body.narrow #hudSub { font-size: 13px; }
body.narrow #frost { width: 132px; }
#blooms i.pop { animation: bpop .5s cubic-bezier(.3, 1.8, .5, 1); display: inline-block; }
@keyframes bpop { from { transform: scale(2.2); } to { transform: none; } }
#coach { top: 30%; }

/* refine 2 */
.lv { display: flex; flex-direction: column; align-items: center; }
.lv .thumb { width: 54px; height: 66px; border-radius: 6px; margin-bottom: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
