/* Rosegate: one night-time look. Parchment pixel panels on a plum night, gold and rose accents. */
:root {
  --night: #1a0f2c;
  --plum: #33204a;
  --plum-2: #4a2b63;
  --ink: #1f1230;
  --shadow: #0c0616;
  --parchment: #f6e8d7;
  --parchment-2: #ead3bd;
  --cream: #fff4e6;
  --muted-ink: #6b4f78;
  --rose: #e2507b;
  --rose-deep: #a42d58;
  --rose-light: #f7a9c1;
  --gold: #f4c443;
  --gold-deep: #b5822a;
  --gold-light: #ffe39a;
  --gold-ink: #835511;
  --violet: #9a78e0;
  --violet-light: #cdb8ff;
  --mint: #7fd6a4;
  --mist: #cbb8e6;
  --font-display: "Jacquarda Bastarda 9", "Old English Text MT", Georgia, serif;
  --font-label: "Silkscreen", "Courier New", monospace;
  --font-body: "Pixelify Sans", "Trebuchet MS", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--cream); font-family: var(--font-body); font-size: 16px; line-height: 1.4; }
button, input { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px dashed var(--gold); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { display: inline-block; flex: none; background-repeat: no-repeat; background-size: 100% 100%; image-rendering: crisp-edges; image-rendering: pixelated; vertical-align: middle; }

/* ---------- shared pixel parts ---------- */
.panel { background: var(--parchment); color: var(--ink); border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--shadow); }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; background: var(--parchment-2); border-bottom: 3px solid var(--ink); }
.panel-h h2 { margin: 0; font-family: var(--font-label); font-weight: 700; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; }
.panel-b { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.dots { display: flex; gap: 5px; }
.dots i { width: 10px; height: 10px; border: 2px solid var(--ink); display: block; }
.dots i:nth-child(1) { background: var(--rose); } .dots i:nth-child(2) { background: var(--gold); } .dots i:nth-child(3) { background: var(--mint); }
.px-btn { appearance: none; cursor: pointer; font-family: var(--font-label); font-weight: 700; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--cream); background: var(--rose); border: 3px solid var(--ink); padding: 9px 14px; box-shadow: inset 0 -4px 0 var(--rose-deep), inset 0 3px 0 var(--rose-light), 3px 3px 0 var(--ink); }
.px-btn:active { transform: translate(2px, 2px); box-shadow: inset 0 -4px 0 var(--rose-deep), 1px 1px 0 var(--ink); }
.px-btn.gold { background: var(--gold); color: var(--ink); box-shadow: inset 0 -4px 0 var(--gold-deep), inset 0 3px 0 var(--gold-light), 3px 3px 0 var(--ink); }
.px-btn.ghost { background: var(--cream); color: var(--ink); box-shadow: inset 0 -4px 0 var(--parchment-2), 3px 3px 0 var(--ink); }
.px-btn.sm { font-size: 11px; padding: 6px 10px; }
.px-btn.wide { width: 100%; }
.px-btn[disabled] { opacity: .5; cursor: default; transform: none; }
.bar { display: block; height: 12px; border: 2px solid var(--ink); background: var(--ink); position: relative; flex: 1; min-width: 40px; }
.bar > span { display: block; height: 100%; transition: width .3s steps(5); }
.bar.gold > span { background: var(--gold); box-shadow: inset 0 2px 0 var(--gold-light); }
.bar.violet > span { background: var(--violet); box-shadow: inset 0 2px 0 var(--violet-light); }
.bar.rose > span { background: var(--rose); box-shadow: inset 0 2px 0 var(--rose-light); }
input { width: 100%; font-size: 16px; padding: 9px 10px; border: 3px solid var(--ink); background: var(--cream); color: var(--ink); border-radius: 0; }
input::placeholder { color: var(--muted-ink); }
label, legend { font-family: var(--font-label); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-ink); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; }
.err { margin: 0; min-height: 1.2em; color: var(--rose-deep); font-size: 14px; }

/* ---------- sign in / create ---------- */
.auth { min-height: 100%; padding-block: max(20px, env(safe-area-inset-top, 0px)) max(28px, env(safe-area-inset-bottom, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background-image: radial-gradient(ellipse 120% 520px at 50% 0%, var(--plum) 0%, transparent 75%), radial-gradient(circle, var(--mist) 1px, transparent 1.6px), radial-gradient(circle, var(--rose-light) 1px, transparent 1.6px);
  background-size: 100% 900px, 97px 113px, 151px 89px; background-position: 0 0, 13px 21px, 70px 40px; background-repeat: no-repeat, repeat, repeat; }
.auth-in { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.logo { margin: 8px 0 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(68px, 20vw, 120px); line-height: .85; color: var(--gold);
  text-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink), 3px 3px 0 var(--ink), -3px 3px 0 var(--ink), 3px -3px 0 var(--ink), -3px -3px 0 var(--ink), 0 8px 0 var(--rose-deep), 3px 8px 0 var(--rose-deep), -3px 8px 0 var(--rose-deep), 0 11px 0 var(--ink); }
.tag { margin: 6px 0 0; font-family: var(--font-label); font-size: clamp(13px, 3.7vw, 17px); text-transform: uppercase; letter-spacing: .05em; }
.tag span { color: var(--rose-light); }
.tabs { display: flex; gap: 8px; }
.tab { flex: 1; cursor: pointer; font-family: var(--font-label); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 9px; background: var(--plum); color: var(--mist); border: 3px solid var(--ink); }
.tab.on { background: var(--gold); color: var(--ink); }
.form .panel-b > label { margin-bottom: -6px; }
.creator { display: flex; gap: 14px; align-items: stretch; }
.preview { flex: none; width: 116px; display: grid; place-items: center; border: 3px solid var(--ink); background: linear-gradient(#4a2b63, #2a6046 78%, #376b43 78%); }
#preview { width: 72px; height: 96px; image-rendering: crisp-edges; image-rendering: pixelated; }
.fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.courts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.court { cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; background: var(--cream); color: var(--ink); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); min-width: 0; }
.court b { font-family: var(--font-label); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.court b i { width: 12px; height: 12px; border: 2px solid var(--ink); display: inline-block; }
.court small { font-size: 13px; color: var(--muted-ink); line-height: 1.25; }
.court[aria-pressed="true"] { background: var(--gold-light); outline: 3px solid var(--rose); outline-offset: -7px; }
.looks { display: grid; grid-template-columns: repeat(3, auto); gap: 12px 18px; justify-content: start; }
@media (max-width: 460px) { .looks { grid-template-columns: 1fr; } }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { cursor: pointer; width: 30px; height: 30px; border: 3px solid var(--ink); padding: 0; box-shadow: 2px 2px 0 var(--ink); }
.swatch[aria-pressed="true"] { outline: 3px solid var(--rose); outline-offset: 2px; }

/* ---------- game screen ---------- */
.game { position: fixed; inset: 0; overflow: hidden; background: #140a26; touch-action: none; user-select: none; -webkit-user-select: none; }
#world, #ui { position: absolute; left: 0; top: 0; }
#world { image-rendering: crisp-edges; image-rendering: pixelated; }
#ui { cursor: pointer; touch-action: none; }

.hud { position: absolute; top: 0; left: 0; right: 0; padding-top: calc(8px + env(safe-area-inset-top, 0px)); padding-left: max(10px, env(safe-area-inset-left, 0px)); padding-right: max(10px, env(safe-area-inset-right, 0px)); pointer-events: none; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hud-bar { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: var(--plum); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); padding: 5px 9px; width: min(100%, 420px); }
.hearts { display: flex; gap: 3px; }
.lv { flex: 1; display: flex; align-items: center; gap: 7px; min-width: 0; }
.lv-badge { font-family: var(--font-label); font-size: 12px; font-weight: 700; background: var(--gold); color: var(--ink); border: 2px solid var(--ink); padding: 0 5px; white-space: nowrap; }
.mini { flex: 1; height: 10px; border: 2px solid var(--ink); background: var(--ink); min-width: 30px; }
.mini > span { display: block; height: 100%; background: var(--rose); box-shadow: inset 0 2px 0 var(--rose-light); transition: width .4s steps(5); }
.crowns { display: flex; align-items: center; gap: 5px; font-family: var(--font-label); font-weight: 700; font-size: 13px; background: var(--ink); border: 2px solid var(--gold-deep); padding: 2px 7px; color: var(--gold); font-variant-numeric: tabular-nums; }
.hud-meters { display: flex; gap: 6px; width: min(100%, 420px); }
.meter { flex: 1; display: flex; align-items: center; gap: 6px; background: rgba(31, 18, 48, .82); border: 2px solid var(--ink); padding: 3px 6px; font-family: var(--font-label); font-size: 10px; text-transform: uppercase; min-width: 0; }
.meter b { font-size: 11px; min-width: 2.2em; text-align: right; font-variant-numeric: tabular-nums; }
.m-l { color: var(--mist); }
.chips { display: flex; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-label); font-size: 10px; text-transform: uppercase; background: rgba(31, 18, 48, .82); border: 2px solid var(--ink); padding: 2px 7px; color: var(--cream); }
.chip.warn { color: var(--gold-light); border-color: var(--gold-deep); }
.dot { width: 7px; height: 7px; background: var(--mint); box-shadow: 0 0 0 2px var(--ink); display: inline-block; }

.chatlog { position: absolute; left: max(10px, env(safe-area-inset-left, 0px)); bottom: calc(112px + env(safe-area-inset-bottom, 0px)); width: min(70vw, 380px); display: flex; flex-direction: column; gap: 3px; pointer-events: none; }
.chatlog p { margin: 0; font-size: 14px; line-height: 1.3; padding: 3px 7px; background: rgba(20, 8, 34, .72); border-left: 3px solid var(--ink); overflow-wrap: anywhere; transition: opacity .6s; }
.chatlog p.old { opacity: .45; }
.chatlog p.sys { color: var(--gold-light); }
.chatlog b { font-family: var(--font-label); font-size: 11px; margin-right: 6px; }

.bottom { position: absolute; left: 0; right: 0; bottom: 0; padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); padding-left: max(10px, env(safe-area-inset-left, 0px)); padding-right: max(10px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 6px; align-items: stretch; pointer-events: none; }
.bottom > * { pointer-events: auto; }
.chatbar { display: flex; gap: 6px; width: min(100%, 520px); }
.chatbar input { padding: 7px 9px; font-size: 16px; }
.menu { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; background: var(--plum); border: 3px solid var(--ink); padding: 4px; width: min(100%, 520px); }
.menu button { appearance: none; cursor: pointer; position: relative; background: none; border: 2px solid transparent; color: var(--mist); font-family: var(--font-label); font-size: 10px; letter-spacing: .03em; text-transform: uppercase; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; }
.menu button:hover, .menu button:active { background: var(--ink); color: var(--gold); }
.badge { position: absolute; top: 0; left: calc(50% + 8px); background: var(--rose); color: var(--cream); font-size: 10px; min-width: 16px; height: 16px; display: grid; place-items: center; border: 2px solid var(--ink); }
.emotes { position: absolute; left: max(10px, env(safe-area-inset-left, 0px)); bottom: calc(112px + env(safe-area-inset-bottom, 0px)); display: flex; flex-wrap: wrap; gap: 6px; background: var(--plum); border: 3px solid var(--ink); padding: 6px; box-shadow: 4px 4px 0 var(--shadow); max-width: calc(100% - 20px); }
.emotes button { cursor: pointer; min-width: 44px; height: 40px; display: grid; place-items: center; background: var(--cream); color: var(--ink); border: 3px solid var(--ink); font-family: var(--font-label); font-size: 11px; padding: 0 8px; }

.sheet-wrap { position: absolute; inset: 0; display: grid; place-items: center; padding-block: 20px; padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px)); background: rgba(12, 6, 22, .55); z-index: 5; }
.sheet { width: min(100%, 440px); max-height: calc(100% - 20px); display: flex; flex-direction: column; }
.sheet .panel-b { overflow-y: auto; }
.x { appearance: none; cursor: pointer; background: var(--cream); border: 2px solid var(--ink); width: 30px; height: 30px; font-size: 14px; color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.sheet p { margin: 0; line-height: 1.45; }
.sheet .lead { font-size: 17px; }
.sheet .soft { color: var(--muted-ink); font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row .grow { flex: 1; min-width: 0; }
.quests { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.quests li { display: flex; align-items: center; gap: 10px; }
.check { flex: none; width: 24px; height: 24px; border: 3px solid var(--ink); background: var(--cream); display: grid; place-items: center; }
.check.on { background: var(--rose); }
.q-prog { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-family: var(--font-label); font-size: 11px; color: var(--muted-ink); }
.reward { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-label); font-size: 12px; font-weight: 700; color: var(--gold-ink); }
.claimed { font-family: var(--font-label); font-size: 11px; color: var(--muted-ink); text-transform: uppercase; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin: 0; }
.stats div { display: flex; justify-content: space-between; border-bottom: 2px dashed var(--parchment-2); padding-bottom: 3px; }
.stats dt { color: var(--muted-ink); font-size: 14px; }
.stats dd { margin: 0; font-family: var(--font-label); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choices .px-btn { text-transform: none; font-family: var(--font-body); font-weight: 600; font-size: 15px; letter-spacing: 0; text-align: left; }
.letter { background: var(--cream); border: 2px dashed var(--muted-ink); padding: 12px; }
.hearts-row { display: flex; gap: 2px; flex-wrap: wrap; align-items: center; }
.roses { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.roses li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 2px dashed var(--parchment-2); padding-bottom: 4px; }
.roses time { color: var(--muted-ink); font-size: 13px; white-space: nowrap; }
.court-pill { font-family: var(--font-label); font-size: 11px; font-weight: 700; color: var(--cream); padding: 2px 6px; border: 2px solid var(--ink); }
.help { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.lvl-big { font-family: var(--font-display); font-size: 70px; line-height: 1; color: var(--gold); text-align: center; text-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink), 0 7px 0 var(--rose-deep); }

.toast { position: absolute; z-index: 6; left: 50%; transform: translateX(-50%); bottom: calc(150px + env(safe-area-inset-bottom, 0px)); width: min(calc(100% - 24px), 440px); background: var(--ink); color: var(--cream); border: 3px solid var(--gold); padding: 9px 13px; font-size: 15px; box-shadow: 4px 4px 0 var(--shadow); pointer-events: none; }
.toast.bad { border-color: var(--rose); }
.toast.show { animation: pop .22s steps(3); }
@keyframes pop { from { transform: translateX(-50%) scale(.93); } to { transform: translateX(-50%) scale(1); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (min-width: 760px) {
  .hud { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .hud-meters { width: 360px; }
  .chatlog, .emotes { bottom: calc(118px + env(safe-area-inset-bottom, 0px)); }
}
