:root {
  --ink: #4a3340; --soft: rgba(74, 51, 64, .66); --line: rgba(74, 51, 64, .12); --card: rgba(255, 250, 242, .95); --cream: #fffaf2; --pink: #e86a9a; --pink-d: #cf4e80;
  --green: #57a84c; --gold: #f2b53a; --blue: #5b9cf5; --shadow: 0 12px 30px rgba(90, 50, 70, .22); --sans: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #eedfd6; font: 600 15px/1.4 var(--sans); color: var(--ink); -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
kbd { display: inline-block; min-width: 20px; margin: 0 2px; padding: 1px 6px; border-radius: 7px; background: rgba(74, 51, 64, .12); font: 800 11px var(--sans); text-align: center; }
h1 span, h2 span { color: var(--pink); }

/* ---------- hud ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud > * { pointer-events: auto; }
.tl { position: absolute; left: 18px; top: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; max-width: 46vw; }
.pill { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 20px 0 10px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); }
.pill b { font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums; }
.coin { display: inline-block; flex: none; width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 34% 30%, #fff6c8 0 14%, #ffd75a 34%, #f2b53a 68%, #cf8f1c); box-shadow: inset 0 -3px 0 rgba(160, 100, 10, .35); }
.coin.s { width: 16px; height: 16px; vertical-align: -3px; box-shadow: none; }
.level { padding-left: 18px; }
.level small { font-weight: 800; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--soft); }
.level b { display: grid; place-items: center; min-width: 34px; height: 34px; border-radius: 50%; background: var(--green); color: #fff; font-size: 19px; }
.xp { width: 110px; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.xp i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--green); transition: width .4s; }
.level span { font-size: 12px; font-weight: 700; color: var(--soft); white-space: nowrap; }
.who { display: flex; gap: 6px; }
.who div { position: relative; display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 16px 0 5px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-weight: 800; }
.who img { width: 42px; height: 42px; border-radius: 50%; background: #ffe3ee; }
.who div::after { content: ''; position: absolute; left: 36px; bottom: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--green); border: 2px solid #fff; }
.tr { position: absolute; right: 18px; top: 18px; display: flex; gap: 8px; }
.tr button { position: relative; height: 46px; padding: 0 16px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-weight: 800; }
.tr button:hover { background: #fff; }
.tr button.off { opacity: .5; text-decoration: line-through; }
.tr i { position: absolute; right: -4px; top: -6px; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--pink); font: 800 12px var(--sans); color: #fff; }
#orders { position: absolute; right: 18px; top: 82px; display: flex; flex-direction: column; gap: 10px; width: 290px; max-height: calc(100vh - 230px); overflow-y: auto; padding: 2px; }
.order { padding: 12px 14px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow); }
.order header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.order b { font-size: 15.5px; font-weight: 900; }
.order small { font-size: 12.5px; color: var(--soft); }
.order ul { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.order li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.order li img { width: 30px; height: 30px; }
.order li span { flex: 1; min-width: 0; }
.order li em { font-style: normal; font-weight: 800; color: var(--pink-d); font-variant-numeric: tabular-nums; }
.order li.ok em { color: var(--green); }
.order footer { display: flex; align-items: center; gap: 8px; }
.order footer span { flex: 1; font-weight: 900; }
.btn { padding: 9px 16px; border-radius: 999px; background: var(--pink); font-weight: 800; font-size: 14px; color: #fff; box-shadow: 0 5px 12px rgba(232, 106, 154, .4); }
.btn:hover { background: var(--pink-d); }
.btn:disabled { background: #e8dcd6; box-shadow: none; color: var(--soft); cursor: default; }
.btn.ghost { background: #f3e9e2; box-shadow: none; color: var(--ink); }
.btn.ghost:hover { background: #ecdfd6; }
.btn.tiny { padding: 6px 10px; font-size: 12px; }
#tray { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; align-items: stretch; gap: 8px; max-width: calc(100vw - 36px); padding: 8px; border-radius: 26px; background: var(--card); box-shadow: var(--shadow); overflow-x: auto; }
.chip { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: none; width: 82px; height: 92px; padding: 4px 4px 7px; border-radius: 18px; background: #f6ece4; border: 3px solid transparent; font-size: 11.5px; font-weight: 800; line-height: 1.15; text-align: center; }
.chip:hover { background: #fff; }
.chip.on { border-color: var(--pink); background: #fff; box-shadow: 0 6px 14px rgba(232, 106, 154, .3); }
.chip img { width: 52px; height: 52px; margin-bottom: 1px; }
.chip i { position: absolute; right: 4px; top: 4px; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; background: var(--ink); font: 800 12px var(--sans); color: #fff; }
.chip.tool { justify-content: center; gap: 4px; font-size: 12.5px; }
.chip.tool u { font-size: 30px; text-decoration: none; line-height: 1; }
.chip.empty { width: auto; padding: 0 18px; justify-content: center; background: none; font-size: 13.5px; font-weight: 700; color: var(--soft); cursor: default; }
.sep { flex: none; width: 2px; margin: 8px 2px; border-radius: 2px; background: var(--line); }
#help { position: absolute; left: 18px; bottom: 22px; max-width: 300px; padding: 10px 14px; border-radius: 16px; background: rgba(255, 250, 242, .82); font-size: 12.5px; font-weight: 700; color: var(--soft); transition: opacity .6s; }
#help.off { opacity: 0; pointer-events: none; }
#tip { position: fixed; z-index: 12; padding: 8px 12px; border-radius: 14px; background: var(--ink); box-shadow: var(--shadow); font-size: 13px; font-weight: 700; color: #fff; pointer-events: none; white-space: nowrap; transform: translate(14px, 14px); }
#tip b { display: block; font-size: 14.5px; font-weight: 900; }
#tip small { display: block; opacity: .82; }
#floats { position: fixed; inset: 0; z-index: 11; pointer-events: none; overflow: hidden; }
.fl { position: absolute; transform: translate(-50%, -50%); font: 900 20px var(--sans); color: #fff; text-shadow: 0 2px 0 rgba(74, 51, 64, .55), 0 0 10px rgba(74, 51, 64, .5); white-space: nowrap; animation: fl 1.5s ease-out forwards; }
.fl.gold { color: #ffe27a; } .fl.pink { color: #ffc6dc; } .fl.green { color: #c9f5a8; } .fl.big { font-size: 34px; }
@keyframes fl { 0% { opacity: 0; margin-top: 10px; } 15% { opacity: 1; } 100% { opacity: 0; margin-top: -70px; } }
#toast { position: fixed; left: 50%; bottom: 132px; z-index: 30; transform: translate(-50%, 16px); padding: 11px 22px; border-radius: 999px; background: var(--ink); box-shadow: var(--shadow); font-weight: 800; color: #fff; opacity: 0; transition: opacity .25s, transform .3s; pointer-events: none; white-space: nowrap; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#banner { position: fixed; left: 50%; top: 26%; z-index: 30; transform: translate(-50%, -50%) scale(.8); text-align: center; opacity: 0; pointer-events: none; }
#banner b { display: block; font: 900 64px var(--sans); color: #fff; text-shadow: 0 5px 0 var(--pink-d), 0 14px 36px rgba(74, 51, 64, .5); }
#banner span { display: inline-block; margin-top: 8px; padding: 8px 20px; border-radius: 999px; background: var(--card); font-weight: 800; }
#banner.show { animation: ban 3.2s ease-out forwards; }
@keyframes ban { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.7); } 10% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } 16% { transform: translate(-50%, -50%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- picker and modals ---------- */
.screen, .modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(255, 240, 232, .55); -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); }
.card, .sheet { width: min(620px, 100%); max-height: calc(100vh - 40px); padding: 28px; border-radius: 30px; background: var(--cream); box-shadow: 0 26px 60px rgba(90, 50, 70, .3); overflow-y: auto; }
.card { text-align: center; }
.card small { font-weight: 900; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--pink-d); }
.card h1 { margin: 4px 0 18px; font-size: 36px; font-weight: 900; letter-spacing: -.02em; }
.card p { min-height: 1.4em; margin: 14px 0 0; color: var(--soft); }
.avatars { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.avatars button { padding: 16px 12px 18px; border-radius: 24px; background: #f6ece4; border: 3px solid transparent; }
.avatars button:hover { border-color: var(--pink); background: #fff; }
.avatars img { width: min(190px, 100%); aspect-ratio: 1; border-radius: 50%; background: linear-gradient(180deg, #ffdbe8, #fff3e6); }
.avatars b { display: block; margin-top: 8px; font-size: 22px; font-weight: 900; }
.sheet { width: min(900px, 100%); }
.sheet.narrow { width: min(540px, 100%); }
.sheet header { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.sheet h2 { margin: 0; font-size: 30px; font-weight: 900; letter-spacing: -.02em; }
.sheet header small { color: var(--soft); font-weight: 800; }
.sheet .x { margin-left: auto; padding: 9px 16px; border-radius: 999px; background: #f3e9e2; font-weight: 800; }
.lede { margin: 0 0 12px; color: var(--soft); }
.tabs { display: flex; gap: 6px; padding: 5px; border-radius: 999px; background: #f3e9e2; }
.tabs button { padding: 8px 16px; border-radius: 999px; background: none; font-weight: 800; }
.tabs button.on { background: var(--pink); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.item { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px; border-radius: 22px; background: #f6ece4; text-align: center; }
.item img { width: 84px; height: 84px; }
.item b { font-size: 16px; font-weight: 900; }
.item small { font-size: 12.5px; color: var(--soft); }
.item .row { display: flex; gap: 6px; margin-top: 6px; }
.item.locked { opacity: .55; }
.item.locked img { filter: grayscale(1); }
.item.wide { grid-column: 1 / -1; flex-direction: row; text-align: left; gap: 16px; padding: 16px 20px; }
.item.wide div { flex: 1; }
.book .item.unknown img { filter: brightness(0); opacity: .16; }
.book .item.unknown b { color: var(--soft); }
.rows { display: flex; flex-direction: column; gap: 8px; }
.rows .r { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 18px; background: #f6ece4; }
.rows img { width: 44px; height: 44px; }
.rows .r div { flex: 1; min-width: 0; }
.rows b { display: block; font-weight: 900; }
.rows small { color: var(--soft); }
.rows .empty, .notes .empty { padding: 16px; color: var(--soft); text-align: center; }
.notes { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; margin-bottom: 12px; }
.note { padding: 10px 14px; border-radius: 16px 16px 16px 4px; background: #fff0c9; user-select: text; -webkit-user-select: text; }
.note b { font-weight: 900; }
.note small { margin-left: 6px; color: var(--soft); font-size: 12px; }
.note p { margin: 2px 0 0; }
#noteForm { display: flex; gap: 8px; }
#noteIn { flex: 1; min-width: 0; padding: 12px 16px; border: 2px solid var(--line); border-radius: 999px; background: #fff; font: inherit; color: inherit; user-select: text; -webkit-user-select: text; }
.cta { padding: 12px 22px; border-radius: 999px; background: var(--pink); font-weight: 900; color: #fff; box-shadow: 0 6px 14px rgba(232, 106, 154, .4); }

@media (max-width: 900px) { #orders { width: 230px; } #help { display: none; } .tr button kbd { display: none; } }
