:root {
  --bg-map: #cfc8be;
  --panel: #fbf7f1;
  --panel-2: #f3ece2;
  --line: #e6ddd0;
  --ink: #2a2530;
  --muted: #847c8c;
  --accent: #1343d3;
  --accent-ink: #ffffff;
  --accent-soft: #e3e9fb;
  --live: #2fb36b;
  --remote: #6d5fe0;
  --warn: #e0732f;
  --shadow: 0 1px 2px rgba(40, 30, 20, .08), 0 6px 18px rgba(40, 30, 20, .10);
  --radius: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg-map);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

#app { display: flex; height: 100dvh; }

/* ---- Map stage ---- */
#stage { position: relative; flex: 1; min-width: 0; overflow: hidden; }
#game { display: block; width: 100%; height: 100%; cursor: pointer; touch-action: none; }
#game.dragging { cursor: grabbing; }

.topbar {
  position: absolute; top: 14px; left: 14px; right: 14px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: var(--shadow); font-weight: 600; font-size: 14px; white-space: nowrap;
}
.brand { color: var(--ink); }
.brand svg { color: var(--accent); }
.chip.icon { width: 40px; padding: 0; justify-content: center; }
.chip.icon:hover { background: var(--panel-2); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.dot-live { background: var(--live); box-shadow: 0 0 0 3px rgba(47, 179, 107, .18); }
.dot-office { background: var(--live); }
.dot-remote { background: var(--remote); }

.location svg { color: var(--accent); }

.seg { padding: 0 4px; gap: 2px; }
.seg button {
  border: 0; background: transparent; height: 32px; padding: 0 12px; border-radius: 999px; font-weight: 600; font-size: 13px;
}
.seg button.active { background: var(--accent); color: var(--accent-ink); }

.zoom {
  position: absolute; left: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px;
}
.zoom button {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); box-shadow: var(--shadow); font-size: 20px; font-weight: 600;
  display: grid; place-items: center;
}
.zoom button:hover { background: var(--panel-2); }

.hint {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  background: rgba(36, 32, 44, .86); color: #f2eee8; padding: 8px 14px; border-radius: 999px;
  font-size: 13px; white-space: nowrap; pointer-events: none;
}
kbd {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12px; font-weight: 700;
  background: rgba(255, 255, 255, .14); padding: 2px 6px; border-radius: 5px;
}

.toast {
  position: absolute; left: 50%; top: 72px; transform: translate(-50%, -8px);
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.conn {
  position: absolute; left: 50%; top: 72px; transform: translateX(-50%);
  background: var(--warn); color: #fff; padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 13px;
}

/* ---- Sidebar ---- */
#side {
  width: 360px; flex: none; display: flex; flex-direction: column;
  background: var(--panel); border-left: 1px solid var(--line);
}
.tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); }
.tab {
  display: inline-flex; align-items: center; gap: 8px; border: 0; background: none;
  padding: 10px 12px 12px; font-weight: 600; font-size: 15px; color: var(--muted);
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-count { color: var(--muted); font-weight: 500; }
.tab-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--warn); color: #fff;
  font-size: 11px; display: inline-grid; place-items: center;
}

.panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#panel-people { overflow-y: auto; padding: 14px 12px; }
.search {
  width: 100%; height: 42px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel-2); outline: none;
}
.search:focus { border-color: var(--accent); background: #fff; }

.group-title {
  display: flex; align-items: center; gap: 8px; margin: 18px 6px 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.group-title b { color: var(--ink); font-weight: 700; }
.empty { color: var(--muted); font-size: 14px; padding: 4px 6px; }

.person {
  display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 12px;
}
.person:hover { background: var(--panel-2); }
.face { position: relative; width: 40px; height: 40px; flex: none; }
.face img { width: 40px; height: 40px; border-radius: 50%; background: #efe6da; }
.face .dot { position: absolute; right: 0; bottom: 1px; border: 2px solid var(--panel); width: 12px; height: 12px; }
.who { min-width: 0; flex: 1; }
.who strong { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who strong em { font-style: normal; font-weight: 500; color: var(--muted); }
.who span { display: block; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.go {
  flex: none; border: 1px solid var(--line); background: var(--panel); border-radius: 10px;
  height: 32px; padding: 0 10px; font-size: 13px; font-weight: 600;
}
.go:hover { border-color: var(--accent); color: var(--accent); }

.messages { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 10px; }
.msg img { width: 32px; height: 32px; border-radius: 50%; background: #efe6da; flex: none; }
.msg .meta { font-size: 13px; color: var(--muted); }
.msg .meta strong { color: var(--ink); margin-right: 6px; }
.msg .tag { font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; margin-left: 4px; }
.msg p { margin: 2px 0 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }

.composer { border-top: 1px solid var(--line); padding: 10px 12px 12px; display: grid; gap: 8px; }
.scope { display: flex; gap: 4px; }
.scope button {
  border: 1px solid var(--line); background: transparent; border-radius: 999px; height: 28px; padding: 0 10px; font-size: 12px; font-weight: 600; color: var(--muted);
}
.scope button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.scope button:disabled { opacity: .45; cursor: not-allowed; }
.compose-row { display: flex; gap: 8px; }
.compose-row input {
  flex: 1; min-width: 0; height: 42px; border-radius: 12px; border: 1px solid var(--line); padding: 0 14px; background: #fff; outline: none;
}
.compose-row input:focus { border-color: var(--accent); }
.compose-row button { width: 42px; height: 42px; border-radius: 12px; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; }

.me { border-top: 1px solid var(--line); background: var(--panel-2); padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.me .who strong { font-size: 15px; }

/* ---- Stairs / elevator chooser ---- */
.travel {
  position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%); z-index: 4;
  width: min(360px, calc(100% - 32px)); padding: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.travel h2 { margin: 0; font-size: 17px; }
.travel p { margin: 4px 0 12px; color: var(--muted); font-size: 14px; }
.travel-opts { display: grid; gap: 8px; margin-bottom: 8px; }
.travel button { width: 100%; height: 42px; border-radius: 12px; font-weight: 700; }
.fade {
  position: absolute; inset: 0; background: #16141a; opacity: 0; pointer-events: none;
  transition: opacity .25s; z-index: 6;
}
.fade.on { opacity: 1; }

/* ---- Join modal ---- */
.modal {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: rgba(30, 26, 36, .45); backdrop-filter: blur(4px); z-index: 10;
}
.card {
  width: min(640px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto;
  background: var(--panel); border-radius: 20px; padding: 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.card h1 { margin: 0; font-size: 24px; }
.card .sub { margin: 6px 0 18px; color: var(--muted); }
.builder { display: grid; grid-template-columns: 200px 1fr; gap: 20px; }
.preview { background: linear-gradient(#e9dfd1, #d9c9b4); border-radius: 16px; display: grid; place-items: center; }
.preview canvas { width: 200px; height: 220px; }
.opts { display: grid; gap: 12px; align-content: start; }
.opt-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; outline: 1px solid rgba(0, 0, 0, .12); }
.swatch.active { border-color: var(--panel); outline: 2px solid var(--ink); }
.pill-opt { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 13px; font-weight: 600; text-transform: capitalize; }
.pill-opt.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.name { display: grid; gap: 6px; margin-top: 18px; font-weight: 600; font-size: 14px; }
.name input { height: 46px; border-radius: 12px; border: 1px solid var(--line); padding: 0 14px; background: #fff; outline: none; font-size: 16px; }
.name input:focus { border-color: var(--accent); }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.actions button { height: 44px; padding: 0 18px; border-radius: 12px; font-weight: 700; }
.ghost { background: transparent; border: 1px solid var(--line); }
.primary { background: var(--accent); color: #fff; border: 0; }

.only-narrow { display: none; }

.join-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

/* ---- Remote: where are you working from ---- */
.remote-menu {
  position: fixed; z-index: 8; width: 270px; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.remote-menu p { margin: 4px 8px 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.remote-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: transparent; text-align: left;
}
.remote-menu button:hover { background: var(--accent-soft); }
.remote-menu button.active { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }

/* ---- Challenges ---- */
.go.challenge { margin-left: 6px; color: var(--accent); }
.challenge-menu {
  position: fixed; z-index: 8; width: 250px; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.cm-head { display: flex; align-items: center; gap: 10px; padding: 4px 6px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.cm-head img { width: 34px; height: 34px; border-radius: 50%; background: #efe6da; }
.cm-head strong { display: block; font-size: 14px; }
.cm-head span { display: block; font-size: 12px; color: var(--muted); }
.cm-opt {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 10px;
  background: transparent; text-align: left;
}
.cm-opt:hover:not(:disabled) { background: var(--accent-soft); }
.cm-opt:disabled { opacity: .45; cursor: not-allowed; }
.cm-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--panel-2); display: grid; place-items: center; font-size: 16px; flex: none; }
.cm-text b { display: block; font-size: 14px; }
.cm-text small { display: block; font-size: 12px; color: var(--muted); }
.cm-walk { width: 100%; margin-top: 4px; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: transparent; font-weight: 600; font-size: 13px; }

.invites { position: absolute; top: 72px; right: 14px; display: grid; gap: 8px; z-index: 7; width: min(340px, calc(100% - 28px)); }
.invite {
  position: relative; overflow: hidden; display: grid; grid-template-columns: 40px 1fr; gap: 6px 12px; align-items: center;
  padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.invite img { width: 40px; height: 40px; border-radius: 50%; background: #efe6da; }
.invite strong { display: block; font-size: 14px; }
.invite span { font-size: 13px; color: var(--muted); }
.inv-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.inv-actions button { height: 34px; padding: 0 14px; border-radius: 10px; font-weight: 700; font-size: 13px; }
.inv-timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--accent); transform-origin: left; animation: shrink linear forwards; }
@keyframes shrink { to { transform: scaleX(0); } }

.waiting {
  position: absolute; left: 50%; top: 72px; transform: translateX(-50%); z-index: 7; display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: #fff; padding: 6px 6px 6px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; max-width: calc(100% - 28px);
}
.waiting button { border: 0; background: rgba(255, 255, 255, .16); color: #fff; height: 28px; padding: 0 12px; border-radius: 999px; font-weight: 700; font-size: 12px; }

.match-card { width: min(1000px, 100%); padding: 18px; }
.match-head .icon-btn { width: 40px; padding: 0; font-size: 16px; }
.match-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.match-head > div { flex: 1; min-width: 0; }
.match-head h2 { margin: 0; font-size: 20px; }
.match-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.match-head button { height: 40px; padding: 0 16px; border-radius: 12px; font-weight: 700; }
.match-stage { position: relative; }
.game-canvas { display: block; width: 100%; height: auto; border-radius: 14px; background: #e9e4dc; touch-action: none; }
.game-help { margin: 10px 0 0; text-align: center; color: var(--muted); font-size: 13px; }
.game-help kbd { background: var(--panel-2); border: 1px solid var(--line); color: var(--ink); margin: 0 2px; }
.game-pad { display: none; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.game-pad button { min-width: 64px; height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); font-weight: 700; user-select: none; touch-action: none; }
@media (pointer: coarse) { .game-pad { display: flex; } .game-help { display: none; } }

.match-overlay {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center; border-radius: 14px;
  background: rgba(22, 20, 26, .35); color: #fff; font-size: 84px; font-weight: 800; pointer-events: none;
  text-shadow: 0 4px 24px rgba(0, 0, 0, .35);
}
.match-overlay.result { font-size: 16px; background: rgba(22, 20, 26, .6); gap: 6px; }
.match-overlay.result b { font-size: 44px; }
.match-overlay.win b { color: #ffd166; }

.chess-status { margin: 0 0 10px; text-align: center; font-weight: 600; color: var(--muted); }
.chess-status.turn { color: var(--accent); }
.chess-board {
  display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  width: min(520px, 100%, calc(100dvh - 300px)); aspect-ratio: 1; margin: 0 auto;
  border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 4px #6b4c36, 0 10px 30px rgba(40, 30, 20, .25);
}
.sq {
  position: relative; min-width: 0; min-height: 0; border: 0; padding: 0;
  font-size: min(48px, 9vw); line-height: 1; display: grid; place-items: center; user-select: none;
}
.sq.light { background: #eedfc6; }
.sq.dark { background: #b58863; }
.sq[data-side="w"] { color: #fbf8f2; -webkit-text-stroke: 1.2px #2a2530; paint-order: stroke fill; text-shadow: 0 2px 2px rgba(0, 0, 0, .25); }
.sq[data-side="b"] { color: #1d1a26; text-shadow: 0 2px 2px rgba(0, 0, 0, .2); }
.sq i { position: absolute; font: normal 700 11px 'DM Sans', sans-serif; -webkit-text-stroke: 0; text-shadow: none; opacity: .8; }
.sq .file { right: 4px; bottom: 3px; }
.sq .rank { left: 4px; top: 3px; }
.sq.light i { color: #9a7353; }
.sq.dark i { color: #f3e6d0; }
.chess-taken { min-height: 26px; margin: 4px auto; width: min(520px, 100%); font-size: 20px; letter-spacing: -2px; line-height: 26px; }
.chess-taken[data-side="w"] { color: #fbf8f2; -webkit-text-stroke: 1px #2a2530; paint-order: stroke fill; }
.chess-taken[data-side="b"] { color: #1d1a26; }
.chess-taken span { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 0; -webkit-text-stroke: 0; margin-left: 6px; }
.sq.last { box-shadow: inset 0 0 0 100px rgba(255, 214, 102, .38); }
.sq.sel { box-shadow: inset 0 0 0 100px rgba(19, 67, 211, .45); }
.sq.target::after { content: ''; position: absolute; width: 28%; height: 28%; border-radius: 50%; background: rgba(19, 67, 211, .55); }
.sq.capture::after { width: 86%; height: 86%; background: transparent; border: 4px solid rgba(19, 67, 211, .65); }

/* ---- Shop: Loynova blue on the app's own light panels ---- */
.shop-card { width: min(1180px, 100%); padding: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--panel); }
.shop-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.shop-head > div:first-child { flex: 1; }
.shop-head h2 { margin: 0; font-size: 24px; }
.shop-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.shop-wallet { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 16px; }
.shop-body { padding: 18px 22px 22px; overflow-y: auto; max-height: calc(100dvh - 190px); background: var(--panel-2); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 16px; }

.shop-card-item {
  --rarity: #8a8494;
  display: flex; flex-direction: column; overflow: hidden; border-radius: 16px; background: #fff;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.shop-card-item.equipped { border: 2px solid var(--accent); box-shadow: 0 0 0 3px rgba(19, 67, 211, .14), var(--shadow); }
.sc-art { position: relative; background: linear-gradient(#eef2fc, #e3e9fb); aspect-ratio: 2 / 1; }
.sc-art canvas { display: block; width: 100%; height: 100%; }
.sc-badge { position: absolute; top: 10px; height: 26px; padding: 0 11px; border-radius: 999px; display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 700; }
.sc-limited { left: 10px; background: var(--ink); color: #fff; }
.sc-state { right: 10px; background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.sc-state.equipped { background: var(--accent); color: var(--accent-ink); }
.sc-body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 18px; }
.sc-rarity { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--rarity); }
.shop-card-item.rarity-normal .sc-rarity { color: var(--muted); }
.sc-name { margin: 6px 0 0; font-size: 18px; font-weight: 600; }
.sc-desc { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.sc-stat { margin-top: 8px; color: #2f8a5f; font-weight: 600; font-size: 14px; }
.sc-foot { margin-top: auto; padding-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sc-price { color: var(--accent); font-weight: 800; font-size: 16px; }
.sc-btn { height: 38px; padding: 0 16px; border-radius: 12px; font-weight: 700; font-size: 14px; border: 1px solid transparent; white-space: nowrap; }
.sc-btn.buy { background: var(--accent); color: var(--accent-ink); }
.sc-btn.buy:hover { filter: brightness(1.1); }
.sc-btn.short { background: transparent; border: 1px dashed #d3c8b8; color: var(--muted); cursor: default; font-weight: 600; }
.sc-btn.equip { background: var(--accent-soft); color: var(--accent); }
.sc-btn.off { background: #fff; border-color: var(--line); color: var(--ink); }

/* ---- Whiteboard ---- */
.board-card { width: min(560px, 100%); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.board-head { display: flex; align-items: flex-start; gap: 10px; padding: 20px 20px 12px; }
.board-head > div { flex: 1; }
.board-head h2 { margin: 0; font-size: 22px; }
.board-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; flex: none; }
.board-list {
  flex: 1; min-height: 120px; max-height: 46dvh; overflow-y: auto; margin: 0 20px; padding: 14px;
  background: #fff; border: 6px solid #d6d9dc; border-radius: 10px; display: grid; gap: 14px; align-content: start;
}
.thought { display: flex; gap: 10px; }
.thought img { width: 34px; height: 34px; border-radius: 50%; background: #efe6da; flex: none; }
.thought .meta { font-size: 13px; color: var(--muted); }
.thought .meta strong { color: var(--ink); margin-right: 6px; }
.thought p { margin: 2px 0 0; font-size: 15px; line-height: 1.45; color: #1d2f7a; overflow-wrap: anywhere; }
.thought.mine p { color: var(--accent); font-weight: 600; }
.board-form { display: grid; gap: 8px; padding: 14px 20px 20px; }
.board-form label { font-weight: 600; font-size: 14px; }
.board-form textarea {
  resize: vertical; min-height: 56px; border-radius: 12px; border: 1px solid var(--line); padding: 10px 14px; font: inherit; background: #fff; outline: none;
}
.board-form textarea:focus { border-color: var(--accent); }
.board-actions { display: flex; justify-content: flex-end; gap: 8px; }
.board-actions button { height: 40px; padding: 0 18px; border-radius: 12px; font-weight: 700; }

@media (max-width: 900px) {
  .only-narrow { display: inline-flex; }
  #side {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 100%); z-index: 5;
    transform: translateX(100%); transition: transform .25s; box-shadow: -10px 0 30px rgba(0, 0, 0, .15);
  }
  #side.open { transform: none; }
  .hint { display: none; }
  .builder { grid-template-columns: 1fr; }
  .preview canvas { width: 160px; height: 176px; }
}

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


/* =====================================================================
   Game theme: chunky ink outlines, a hard drop shadow under everything
   you can press, rounded display type, and buttons that squash when
   clicked. Layered on top of the base styles above.
   ===================================================================== */
:root {
  --ink: #1d1a26;
  --muted: #6e6878;
  --panel: #fffaf1;
  --panel-2: #f6eedf;
  --line: #1d1a26;
  --soft-line: #e8dcc8;
  --accent: #1343d3;
  --accent-dark: #0b2a8f;
  --accent-soft: #dfe7ff;
  --sun: #ffcc4d;
  --sun-dark: #d99a14;
  --live: #3ac47d;
  --remote: #8b6cf0;
  --warn: #ff7a45;
  --edge: 2.5px solid var(--ink);
  --drop: 0 4px 0 var(--ink);
  --drop-sm: 0 3px 0 var(--ink);
  --shadow: 0 4px 0 var(--ink), 0 12px 24px rgba(29, 26, 38, .16);
  --radius: 18px;
  --display: 'Fredoka', 'DM Sans', system-ui, sans-serif;
}
body { background: #cfc8be; }
h1, h2, h3, .chip, .tab, button, .group-title, .opt-label, .sc-rarity, .sc-price { font-family: var(--display); }

/* Anything pressable squashes down onto its shadow. */
.chip, .zoom button, .primary, .ghost, .go, .sc-btn, .pill-opt, .travel button, .actions button,
.compose-row button, .scope button, .seg button, .cm-opt, .cm-walk, .inv-actions button,
.match-head button, .board-actions button, .game-pad button, .icon-btn {
  transition: transform .08s, box-shadow .08s, background-color .15s, filter .15s;
}
.chip:is(button):active, .zoom button:active, .primary:active, .ghost:active, .go:active, .sc-btn:not(:disabled):active,
.pill-opt:active, .travel button:active, .actions button:active, .compose-row button:active, .inv-actions button:active,
.match-head button:active, .board-actions button:active, .game-pad button:active, .icon-btn:active {
  transform: translateY(3px); box-shadow: 0 1px 0 var(--ink);
}

/* ---- Top bar ---- */
.topbar { top: 16px; left: 16px; right: 16px; gap: 10px; }
.chip {
  height: 44px; padding: 0 16px; border: var(--edge); border-radius: 16px;
  background: var(--panel); box-shadow: var(--drop); font-weight: 600; font-size: 15px;
}
.chip.icon { width: 44px; }
.chip.icon:hover, .zoom button:hover { background: #fff; filter: brightness(1.02); }
.brand { background: var(--accent); color: #fff; font-weight: 700; letter-spacing: .01em; }
.brand svg { color: var(--sun); }
.dot { width: 10px; height: 10px; border: 2px solid var(--ink); }
.dot-live { box-shadow: none; }
.location svg { color: var(--accent); }
.wallet { gap: 10px; padding: 0 6px 0 6px; }
.wallet .lv {
  height: 30px; padding: 0 10px; border-radius: 10px; border: 2px solid var(--ink);
  background: var(--sun); display: inline-flex; align-items: center; font-weight: 700; font-size: 14px;
}
.wallet .kp { display: inline-flex; align-items: center; gap: 6px; padding-right: 8px; font-weight: 700; }
.wallet .kp b { font-size: 16px; }
.seg { padding: 0 4px; gap: 4px; }
.seg button { height: 32px; border-radius: 11px; padding: 0 14px; font-weight: 600; font-size: 14px; }
.seg button.active { border: 2px solid var(--ink); background: var(--accent); }

.zoom { left: 16px; bottom: 16px; gap: 10px; }
.zoom button { width: 46px; height: 46px; border-radius: 14px; border: var(--edge); background: var(--panel); box-shadow: var(--drop); font-family: var(--display); font-size: 22px; }
.hint { bottom: 18px; background: var(--ink); border-radius: 14px; padding: 9px 16px; font-weight: 500; box-shadow: 0 4px 0 rgba(0,0,0,.25); }
kbd { background: rgba(255,255,255,.16); border-radius: 6px; }
.toast {
  top: 80px; background: var(--sun); color: var(--ink); border: var(--edge); box-shadow: var(--drop);
  border-radius: 14px; padding: 9px 16px; font-family: var(--display); font-weight: 600; font-size: 15px;
}
.toast.show { animation: pop .28s cubic-bezier(.2, 1.6, .5, 1); }
@keyframes pop { from { transform: translate(-50%, -6px) scale(.85); } to { transform: translate(-50%, 0) scale(1); } }
.conn { top: 80px; border: var(--edge); box-shadow: var(--drop); background: var(--warn); }

/* ---- Sidebar: people and chat ---- */
#side { width: 372px; background: var(--panel); border-left: var(--edge); }
.tabs { padding: 12px 12px; gap: 8px; border-bottom: var(--edge); background: var(--panel-2); }
.tab {
  flex: 1; justify-content: center; height: 44px; padding: 0 12px; border-radius: 14px; border: var(--edge);
  background: var(--panel); box-shadow: var(--drop-sm); margin: 0; color: var(--ink); font-weight: 600; font-size: 15px;
}
.tab.active { background: var(--accent); color: #fff; border-bottom-color: var(--ink); }
.tab.active .tab-count { color: rgba(255,255,255,.8); }
.tab-badge { background: var(--warn); border: 2px solid var(--ink); min-width: 22px; height: 22px; font-weight: 700; }
#panel-people { padding: 14px; }
.search { height: 46px; border: var(--edge); border-radius: 14px; background: #fff; font-size: 15px; }
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.group-title { margin: 18px 4px 8px; font-size: 13px; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.group-title b { background: var(--ink); color: #fff; border-radius: 8px; padding: 0 7px; font-size: 12px; line-height: 20px; }
.person { padding: 8px; border-radius: 16px; border: 2px solid transparent; gap: 12px; }
.person:hover { background: #fff; border-color: var(--soft-line); }
.face, .face img { width: 46px; height: 46px; }
.face img { border-radius: 14px; border: var(--edge); background: var(--accent-soft); }
.face .dot { right: -3px; bottom: -3px; width: 15px; height: 15px; border: 2.5px solid var(--ink); }
.who strong { font-family: var(--display); font-weight: 600; font-size: 16px; }
.who strong .plv { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 7px; border: 2px solid var(--ink); background: var(--sun); font-size: 11px; line-height: 16px; font-weight: 700; vertical-align: 2px; }
.go { height: 34px; border: var(--edge); border-radius: 11px; background: #fff; box-shadow: var(--drop-sm); font-weight: 600; font-size: 13px; }
.go:hover { border-color: var(--ink); color: var(--ink); background: var(--panel-2); }
.go.challenge { background: var(--sun); color: var(--ink); }

.messages { padding: 16px; gap: 14px; }
.msg img { width: 36px; height: 36px; border-radius: 11px; border: 2px solid var(--ink); background: var(--accent-soft); }
.msg > div { background: #fff; border: 2px solid var(--soft-line); border-radius: 4px 16px 16px 16px; padding: 8px 12px; max-width: 100%; }
.msg .meta strong { font-family: var(--display); font-weight: 600; font-size: 14px; }
.msg .tag { border: 1.5px solid var(--accent); }
.composer { border-top: var(--edge); padding: 12px; background: var(--panel-2); }
.scope button { height: 30px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; color: var(--ink); font-weight: 600; }
.scope button.active { background: var(--ink); }
.compose-row input { height: 46px; border: var(--edge); border-radius: 14px; font-size: 15px; }
.compose-row input:focus { box-shadow: 0 0 0 4px var(--accent-soft); }
.compose-row button { width: 46px; height: 46px; border: var(--edge); border-radius: 14px; box-shadow: var(--drop-sm); }
.me { border-top: var(--edge); background: var(--accent-soft); padding: 12px 14px; }

/* ---- Cards, menus and dialogs ---- */
.modal { background: rgba(29, 26, 38, .5); }
.card { border: 3px solid var(--ink); border-radius: 24px; box-shadow: 0 6px 0 var(--ink), 0 24px 60px rgba(0,0,0,.3); animation: rise .25s cubic-bezier(.2, 1.4, .5, 1); }
@keyframes rise { from { transform: translateY(14px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.card h1, .card h2 { font-family: var(--display); font-weight: 700; }
.primary { background: var(--accent); color: #fff; border: var(--edge); box-shadow: var(--drop); font-family: var(--display); font-weight: 600; }
.primary:hover { filter: brightness(1.1); }
.ghost { background: #fff; border: var(--edge); box-shadow: var(--drop-sm); font-family: var(--display); font-weight: 600; }
.icon-btn { border: var(--edge) !important; box-shadow: var(--drop-sm); border-radius: 12px; background: #fff; }
.actions button, .travel button, .board-actions button, .match-head button { border-radius: 14px; }

.travel, .challenge-menu, .remote-menu, .invite { border: var(--edge); box-shadow: var(--shadow); border-radius: 20px; background: var(--panel); }
.travel { padding: 18px; }
.travel h2 { font-family: var(--display); font-size: 20px; }
.travel button { height: 48px; font-size: 16px; }
.cm-head { border-bottom: 2px dashed var(--soft-line); }
.cm-head img, .invite img { border-radius: 12px; border: 2px solid var(--ink); background: var(--accent-soft); }
.cm-opt { border-radius: 14px; }
.cm-opt:hover:not(:disabled) { background: var(--accent-soft); }
.cm-icon { border: 2px solid var(--ink); border-radius: 10px; background: var(--sun); }
.cm-walk { border: var(--edge); border-radius: 12px; box-shadow: var(--drop-sm); background: #fff; }
.remote-menu button.active { box-shadow: inset 0 0 0 2.5px var(--accent); }
.inv-timer { height: 5px; background: var(--sun); }
.waiting { border: var(--edge); box-shadow: var(--drop); background: var(--ink); }

/* Character builder */
.preview { border: var(--edge); border-radius: 20px; background: radial-gradient(circle at 50% 70%, #fff6dd, #ffe2a8); box-shadow: inset 0 -6px 0 rgba(0,0,0,.06); }
.opt-label { font-size: 13px; letter-spacing: .04em; color: var(--ink); font-weight: 600; }
.swatch { width: 32px; height: 32px; border: 2.5px solid var(--ink); outline: none; box-shadow: var(--drop-sm); transition: transform .1s; }
.swatch:hover { transform: translateY(-2px); }
.swatch.active { outline: 3px solid var(--accent); outline-offset: 2px; border-color: var(--ink); }
.pill-opt { height: 34px; border: 2px solid var(--ink); border-radius: 12px; box-shadow: var(--drop-sm); font-family: var(--display); font-weight: 600; font-size: 14px; }
.pill-opt.active { background: var(--accent); border-color: var(--ink); }
.name input { border: var(--edge); border-radius: 14px; font-family: var(--display); font-size: 17px; }
.name input:focus { box-shadow: 0 0 0 4px var(--accent-soft); }

/* Whiteboard and games */
.board-list { border: 4px solid var(--ink); border-radius: 14px; box-shadow: inset 0 0 0 3px #d6d9dc; }
.thought img { border-radius: 10px; border: 2px solid var(--ink); }
.board-form textarea { border: var(--edge); border-radius: 14px; }
.game-canvas { border: var(--edge); border-radius: 16px; }
.game-pad button { border: var(--edge); box-shadow: var(--drop-sm); font-family: var(--display); }
.chess-board { border: 3px solid var(--ink); box-shadow: 0 0 0 4px #6b4c36, 0 0 0 7px var(--ink), 0 10px 30px rgba(40,30,20,.25); }

/* ---- Mall stores ---- */
.shop-card { background: var(--panel); }
.shop-head { border-bottom: var(--edge); background: var(--accent); color: #fff; padding: 20px 22px; }
.shop-head p { color: rgba(255,255,255,.85); }
.shop-wallet { border: var(--edge); box-shadow: var(--drop-sm); background: var(--sun); color: var(--ink); font-family: var(--display); }
.shop-body { background: var(--panel-2); }
.shop-grid { gap: 18px; }
.shop-card-item { border: var(--edge); border-radius: 20px; box-shadow: var(--drop); transition: transform .12s; }
.shop-card-item:hover { transform: translateY(-3px); }
.shop-card-item.equipped { border: 3px solid var(--ink); box-shadow: 0 0 0 4px var(--accent), 0 4px 0 var(--ink); }
.sc-art { border-bottom: var(--edge); background: radial-gradient(circle at 50% 75%, #ffffff, #dfe7ff); }
.sc-badge { border: 2px solid var(--ink); font-family: var(--display); font-weight: 600; }
.sc-limited { background: var(--ink); color: var(--sun); }
.sc-state.equipped { background: var(--accent); }
.sc-name { font-family: var(--display); font-weight: 600; font-size: 19px; }
.sc-stat { color: #1f9a5a; }
.sc-btn { height: 40px; border-radius: 13px; font-family: var(--display); font-weight: 600; font-size: 15px; }
.sc-btn.buy { border: var(--edge); box-shadow: var(--drop-sm); }
.sc-btn.equip { border: var(--edge); box-shadow: var(--drop-sm); background: var(--sun); color: var(--ink); }
.sc-btn.off { border: var(--edge); box-shadow: var(--drop-sm); }
.sc-btn.short { border: 2px dashed #c9bba3; }

@media (max-width: 900px) {
  #side { border-left: none; border-right: var(--edge); }
}

/* ---- Collapsible people/chat panel: an arrow tab on its left edge ---- */
#app.side-collapsed #side { display: none; }
.side-handle {
  position: absolute; right: 0; top: 50%; z-index: 5; transform: translateY(-50%);
  width: 30px; height: 64px; padding: 0 0 0 3px; display: grid; place-items: center;
  border: var(--edge); border-right: none; border-radius: 14px 0 0 14px;
  background: var(--panel); color: var(--ink); box-shadow: -3px 3px 0 var(--ink);
  transition: width .12s, background-color .15s;
}
.side-handle:hover { width: 36px; background: #fff; }
.side-handle svg { transition: transform .2s; }
#app.side-collapsed .side-handle svg { transform: rotate(180deg); }
#app.side-collapsed .side-handle { background: var(--accent); color: #fff; }
.side-dot { position: absolute; top: -7px; left: -7px; width: 14px; height: 14px; border-radius: 50%; background: var(--warn); border: 2.5px solid var(--ink); }
@media (max-width: 900px) {
  #app.side-collapsed #side { display: flex; }
  .side-handle { display: none; }
}

/* ---- Brand ---- */
.brand img { display: block; filter: drop-shadow(0 1px 0 rgba(0,0,0,.35)); }
.admin-chip { background: var(--ink); color: var(--sun); font-weight: 700; }
.admin-chip:hover { filter: brightness(1.15); }

/* ---- Sign in ---- */
.auth { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background: radial-gradient(circle at 30% 20%, #3b63e6, #1343d3 45%, #0b2a8f); }
.auth-card { width: min(440px, 100%); padding: 28px; }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.auth-brand h1 { margin: 0; font-size: 26px; }
.auth-brand p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.auth form { display: grid; gap: 12px; }
.auth h2 { margin: 0; font-family: var(--display); font-size: 21px; }
.field { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.field input { height: 48px; border: var(--edge); border-radius: 14px; padding: 0 14px; font-size: 16px; background: #fff; outline: none; }
.field input:focus { box-shadow: 0 0 0 4px var(--accent-soft); }
.field input[readonly] { background: var(--panel-2); color: var(--muted); }
.auth .primary { height: 50px; border-radius: 14px; font-size: 17px; margin-top: 4px; }
.auth .primary:disabled { opacity: .6; }
.auth-error { margin: 0; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--ink); background: #ffe1d6; font-size: 14px; font-weight: 600; }
.auth-note { margin: 0; color: var(--muted); font-size: 14px; text-align: center; }
#inviteForm .auth-note { text-align: left; margin-top: -6px; }

/* ---- Radio player ---- */
.radio {
  position: absolute; left: 78px; bottom: 16px; z-index: 3; display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 8px 0 12px; max-width: min(380px, calc(100% - 100px));
  background: var(--panel); border: var(--edge); border-radius: 16px; box-shadow: var(--drop);
}
.radio-icon { font-size: 22px; }
.radio-text { min-width: 0; display: grid; line-height: 1.15; }
.radio-text b { font-family: var(--display); font-size: 14px; }
.radio-text span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.radio.on .radio-text span { color: var(--accent); font-weight: 600; }
.radio.on .radio-icon { animation: bob 0.6s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-2px) rotate(-6deg); } }
.radio input[type=range] { width: 70px; accent-color: var(--accent); }
.radio:not(.on) input[type=range] { display: none; }
#radioToggle { width: 36px; height: 36px; border-radius: 11px; border: 2px solid var(--ink); background: var(--sun); box-shadow: var(--drop-sm); font-size: 14px; flex: none; }
.radio.on #radioToggle { background: var(--accent); color: #fff; }
.radio-frame { position: fixed; left: -400px; top: 0; width: 200px; height: 112px; opacity: 0; pointer-events: none; }
.hint { left: 58%; }
@media (max-width: 900px) { .radio-text span { max-width: 120px; } }

/* ---- Admin panel ---- */
.admin-card { width: min(860px, 100%); padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.admin-head { display: flex; align-items: center; gap: 14px; padding: 16px 20px; background: var(--ink); color: #fff; border-bottom: var(--edge); }
.admin-head h2 { margin: 0; font-size: 22px; color: var(--sun); }
.admin-tabs { display: flex; gap: 6px; flex: 1; }
.admin-tabs button { height: 38px; padding: 0 16px; border-radius: 12px; border: 2px solid #fff3; background: transparent; color: #fff; font-weight: 600; }
.admin-tabs button.active { background: var(--sun); color: var(--ink); border-color: var(--ink); }
.admin-body { padding: 8px 20px 20px; overflow-y: auto; max-height: calc(100dvh - 140px); background: var(--panel); }
.admin-body section { padding-top: 14px; }
.admin-body h3 { margin: 0 0 6px; font-family: var(--display); font-size: 17px; }
.a-help { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.a-empty { margin: 0; color: var(--muted); font-size: 14px; padding: 6px 2px; }
.a-invite { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.a-input { height: 42px; border: var(--edge); border-radius: 12px; padding: 0 12px; background: #fff; font-size: 15px; outline: none; min-width: 0; }
.a-invite .a-input { flex: 1; min-width: 200px; }
.a-input:focus { box-shadow: 0 0 0 4px var(--accent-soft); }
.a-check { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.a-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.a-invite .primary, .a-actions .primary, .a-actions .ghost { height: 42px; padding: 0 16px; border-radius: 12px; }
.a-fresh { margin-top: 12px; display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 12px; border: var(--edge); border-radius: 14px; background: #e7f8ee; }
.a-fresh div { display: grid; }
.a-fresh span { color: var(--muted); font-size: 13px; }
.a-fresh code { grid-column: 1 / -1; display: block; padding: 8px 10px; border-radius: 10px; background: #fff; border: 2px solid var(--soft-line); font-size: 12.5px; overflow-wrap: anywhere; }
.a-fresh .ghost { grid-row: 1; grid-column: 2; height: 36px; padding: 0 14px; border-radius: 11px; }
.a-list { display: grid; gap: 8px; }
.a-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 2px solid var(--soft-line); border-radius: 14px; background: #fff; }
.a-row.off { opacity: .6; }
.a-row.playing { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.a-main { flex: 1; min-width: 0; display: grid; }
.a-main b { font-family: var(--display); font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-main span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-tag { margin-left: 8px; padding: 0 7px; border-radius: 7px; border: 2px solid var(--ink); background: var(--sun); font-size: 11px; line-height: 16px; vertical-align: 2px; }
.a-tag.off { background: #ffd6cc; }
.a-you { font-size: 13px; color: var(--muted); font-weight: 600; padding: 0 6px; }
.ghost.sm { height: 32px; padding: 0 11px; border-radius: 10px; font-size: 13px; box-shadow: 0 2px 0 var(--ink); }
.ghost.danger { color: #c0392b; }
.ghost:disabled { opacity: .4; }
.a-thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; border: 2px solid var(--ink); }
.a-now { display: flex; align-items: center; gap: 12px; padding: 12px; border: var(--edge); border-radius: 16px; background: var(--accent-soft); }
.a-now img { width: 112px; height: 63px; object-fit: cover; border-radius: 10px; border: 2px solid var(--ink); }
.a-now.idle { background: var(--panel-2); }
.a-now .ghost { height: 38px; padding: 0 14px; border-radius: 12px; }
.a-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 12px; }
.a-field { display: grid; gap: 5px; font-size: 13px; font-weight: 600; }
.a-field[hidden] { display: none; }
.a-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* ---- Boda's quests ---- */
.quest-card { width: min(560px, 100%); padding: 0; overflow: hidden; }
.quest-head { display: flex; align-items: center; gap: 14px; padding: 16px 20px; background: var(--sun); border-bottom: var(--edge); }
.quest-head canvas { width: 64px; height: 64px; border-radius: 16px; border: var(--edge); background: #fff6dd; flex: none; }
.quest-head > div { flex: 1; }
.quest-head h2 { margin: 0; font-size: 21px; }
.quest-head p { margin: 2px 0 0; font-size: 14px; font-weight: 600; }
.quest-list { padding: 16px 20px 20px; display: grid; gap: 10px; max-height: calc(100dvh - 160px); overflow-y: auto; }
.quest { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: var(--edge); border-radius: 16px; background: #fff; box-shadow: var(--drop-sm); }
.quest.ready { background: #e7f8ee; }
.quest.claimed { opacity: .6; box-shadow: none; }
.q-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.q-main b { font-family: var(--display); font-weight: 600; font-size: 16px; }
.q-main span { font-size: 13px; color: var(--muted); font-weight: 600; }
.q-bar { height: 10px; border-radius: 6px; border: 2px solid var(--ink); background: var(--panel-2); overflow: hidden; }
.q-bar i { display: block; height: 100%; background: var(--live); transition: width .3s; }
.q-side { display: grid; justify-items: end; gap: 6px; }
.q-reward { font-family: var(--display); font-weight: 700; color: var(--accent); }
.q-side button { height: 36px; padding: 0 14px; border-radius: 11px; }
.q-side button:disabled { opacity: .5; cursor: default; }

.admin-head .icon-btn { color: var(--ink); }
.a-nothumb { display: grid; place-items: center; width: 112px; height: 63px; border-radius: 10px; border: 2px solid var(--ink); background: var(--sun); font-size: 22px; font-weight: 700; flex: none; }
.a-nothumb.a-thumb { width: 64px; height: 48px; font-size: 18px; }

/* ---- Dropdowns: our own chevron, inset from the edge, same type as inputs ---- */
select.a-input {
  appearance: none; -webkit-appearance: none;
  padding: 0 40px 0 12px; font: inherit; font-size: 15px; color: var(--ink); cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d1a26' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 14px 14px;
}
.a-input { font-family: inherit; }

/* ---- Admin: members, items and activity ---- */
.admin-tabs { flex-wrap: wrap; }
.a-link { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.a-link:hover { border-color: var(--ink); }
.a-stats { display: flex; gap: 18px; flex: none; }
.a-stats span { display: grid; font-size: 12px; color: var(--muted); text-align: right; }
.a-stats b { font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--ink); }
.a-chev { font-size: 22px; color: var(--muted); padding: 0 2px 2px; }
.a-back { height: 34px; padding: 0 12px; border-radius: 11px; margin-bottom: 12px; }
.a-profile { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.a-profile .a-main b { font-size: 22px; }
.a-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.a-kpis div { display: grid; align-content: start; gap: 2px; padding: 10px 12px; border: 2px solid var(--soft-line); border-radius: 14px; background: #fff; }
.a-kpis span { font-size: 12px; color: var(--muted); font-weight: 600; }
.a-kpis b { font-family: var(--display); font-weight: 600; font-size: 20px; }
.a-kpis small { font-size: 12px; color: var(--muted); }
.a-gap { height: 10px; }
.a-invite .ghost { height: 42px; padding: 0 16px; border-radius: 12px; }
.a-record { display: flex; flex-wrap: wrap; gap: 8px; }
.a-record div { display: grid; padding: 8px 12px; border: 2px solid var(--soft-line); border-radius: 12px; background: #fff; }
.a-record b { font-family: var(--display); font-weight: 600; }
.a-record span { font-size: 13px; color: var(--muted); }
.a-table { display: grid; border: 2px solid var(--soft-line); border-radius: 14px; background: #fff; overflow: hidden; }
.a-tr { display: flex; align-items: center; gap: 12px; padding: 8px 12px; font-size: 14px; }
.a-tr + .a-tr { border-top: 1px solid var(--soft-line); }
.a-when { flex: none; width: 112px; color: var(--muted); font-size: 12.5px; }
.a-who { flex: none; width: 110px; padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--accent); text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-who:hover { text-decoration: underline; }
.a-what { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-what em { color: var(--muted); font-style: normal; }
.a-kind { display: inline-block; margin-right: 8px; padding: 0 7px; border-radius: 7px; font-size: 11.5px; font-weight: 700; line-height: 18px; background: var(--panel-2); color: var(--ink); }
.a-kind.k-match { background: #e0ecff; }
.a-kind.k-quest { background: #fff1c2; }
.a-kind.k-purchase { background: #f1e4ff; }
.a-kind.k-admin { background: #ffe0d6; }
.a-amt { flex: none; min-width: 64px; text-align: right; font-family: var(--display); font-weight: 600; }
.a-amt.pos { color: #1f7a4a; }
.a-amt.neg { color: #b2362b; }
.a-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.a-chips button { height: 34px; padding: 0 14px; border-radius: 11px; border: 2px solid var(--soft-line); background: #fff; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; }
.a-chips button.active { border-color: var(--ink); background: var(--sun); }
.a-item-art { flex: none; border-radius: 10px; background: var(--panel-2); }
.a-item-form { padding: 14px; border: var(--edge); border-radius: 16px; background: #fff; }
.a-item-top { display: flex; gap: 14px; align-items: flex-start; }
.a-item-top .a-grid { flex: 1; }
.a-preview .a-item-art { border-radius: 14px; }
.a-field.wide { grid-column: 1 / -1; }
.a-color { padding: 4px; cursor: pointer; }
.a-qstat { color: var(--accent) !important; }
@media (max-width: 700px) {
  .a-stats { display: none; }
  .a-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .a-tr { flex-wrap: wrap; gap: 2px 10px; }
  .a-when { width: auto; flex: 1; }
  .a-who { width: auto; order: -1; }
  .a-amt { order: 0; }
  .a-what { flex-basis: 100%; order: 1; white-space: normal; }
  .a-item-top { flex-direction: column; }
}
