:root {
  --bg: #121216;
  --panel: #1c1c23;
  --panel2: #25252e;
  --line: #34343f;
  --text: #ece9e3;
  --muted: #9b99a5;
  --accent: #e0aa45;
  --yellow: #f3d34a;
  --red: #dd5a50;
  --green: #5fbf80;
  --blue: #5b8fd6;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { overscroll-behavior-y: none; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 12px; padding: 12px 16px;
  background: var(--accent); color: #1c1608; font-weight: 700; touch-action: manipulation; }
button:active { transform: scale(.97); }
button:disabled { opacity: .4; cursor: not-allowed; transform: none; }
button.ghost { background: var(--panel2); color: var(--text); font-weight: 600; }
button.danger { background: var(--red); color: #fff; }
button.small { padding: 6px 12px; font-size: 14px; border-radius: 10px; }
button.wide { width: 100%; }
input, textarea, select { font: inherit; font-size: 16px; color: var(--text); background: var(--panel2);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; width: 100%; }
h2 { font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 13px; margin: 18px 0 8px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.muted { color: var(--muted); }
.small-text { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 12px; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: var(--panel2); border: 1px solid var(--line); margin: 0 4px 2px 0; white-space: nowrap; }
.badge.red { background: #3b1d1a; border-color: #6f2c27; color: #f4aaa3; }
.badge.gold { background: #3b301a; border-color: #705a28; color: #f2d08a; }
.badge.blue { background: #18263b; border-color: #2c4b75; color: #aecbf3; }
.badge.green { background: #18311f; border-color: #2c5c3a; color: #a8deb9; }
table.kv { width: 100%; border-collapse: collapse; font-size: 15px; }
table.kv td { padding: 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.kv td:first-child { color: var(--muted); width: 42%; }

/* ---------- onboarding ---------- */
#onboard { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.onboard-card { max-width: 440px; width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 24px; }
.brand { font-size: 26px; font-weight: 800; margin-bottom: 14px; }
.brand span { color: var(--accent); }
#tut p, #tut li { color: #d3d0d9; }
#tut ul { padding-left: 20px; }
.tut-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
#tutDots span { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line); margin: 0 3px; }
#tutDots span.on { background: var(--accent); }
#nameForm { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
#nameForm label { color: var(--muted); }

/* ---------- váz ---------- */
#game { max-width: 520px; margin: 0 auto; min-height: 100dvh; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 12px); }
#top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px; background: rgba(18,18,22,.94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); }
#top .money { font-size: 22px; font-weight: 800; color: var(--accent); }
#top .loc { font-size: 13px; color: var(--muted); line-height: 1.2; }
#top .loc b { color: var(--text); }
.iconbtn { background: var(--panel2); color: var(--text); padding: 8px 10px; border-radius: 12px; font-weight: 600; font-size: 14px; }
#stars { display: flex; gap: 6px; overflow-x: auto; padding: 8px 14px 0; scrollbar-width: none; }
#stars:empty { display: none; }
.chip { background: var(--panel2); color: var(--text); border-radius: 99px; padding: 6px 12px; font-size: 14px; font-weight: 600; white-space: nowrap; }
#view { padding: 12px 14px; }
.back { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.back h2 { margin: 0; }

#nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b); display: flex; justify-content: center; background: rgba(22,22,28,.97);
  border-top: 1px solid var(--line); backdrop-filter: blur(8px); }
#nav .inner { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; max-width: 520px; }
#nav button { background: none; color: var(--muted); font-size: 12px; font-weight: 600; padding: 8px 0 6px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; border-radius: 0; }
#nav button svg { width: 24px; height: 24px; }
#nav button.on { color: var(--accent); }

.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff;
  font-size: 12px; line-height: 20px; text-align: center; font-weight: 700; }
.banner { border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; font-weight: 600; font-size: 15px; }
.banner.red { background: #3b1d1a; border: 1px solid #6f2c27; }
.banner.gold { background: #3b301a; border: 1px solid #705a28; }
.banner.blue { background: #18263b; border: 1px solid #2c4b75; }

/* ---------- Home: akta ---------- */
.akta { cursor: pointer; }
.akta .name { font-size: 20px; font-weight: 800; }
.akta .role { color: var(--accent); font-weight: 700; }
.akta .props { color: var(--muted); font-size: 14px; margin-top: 6px; }
.akta .more { font-size: 13px; color: var(--muted); text-align: center; margin-top: 8px; }

/* ---------- Home: 2×2 akciógomb töltősávval ---------- */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.act { --p: 1; padding: 4px; border-radius: 22px; color: var(--text); aspect-ratio: 1.15;
  background: conic-gradient(var(--accent) calc(var(--p) * 360deg), var(--line) 0); }
.act > span { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  height: 100%; border-radius: 18px; background: var(--panel); }
.act .ic { font-size: 30px; line-height: 1; }
.act .lbl { font-size: 18px; font-weight: 800; }
.act .cdt { font-size: 13px; font-weight: 600; color: var(--muted); }
.act.ready .cdt { color: var(--green); }
.act.mail { background: var(--line); }
.act.mail.new { background: var(--yellow); }
.act.mail.new > span { background: #3a3415; }
.act.mail.new .lbl { color: var(--yellow); }
.act:disabled { opacity: 1; }
.act:disabled > span { opacity: .55; }
.progress { height: 8px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress > div { height: 100%; background: var(--accent); }
.linkrow { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; margin-bottom: 10px; cursor: pointer; width: 100%; color: var(--text); font-weight: 600; text-align: left; }

/* ---------- listák ---------- */
.group { font-size: 13px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin: 16px 2px 8px; }
.group:first-child { margin-top: 0; }
.item { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; margin-bottom: 8px; cursor: pointer; width: 100%; color: var(--text); text-align: left; font-weight: 500; }
.item:disabled { opacity: .45; }
.item .t { font-weight: 700; }
.item .s { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .price { font-weight: 800; color: var(--accent); white-space: nowrap; }
.star { background: none; color: var(--muted); padding: 0 4px; font-size: 22px; line-height: 1; }
.star.on { color: var(--accent); }
.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--panel2); border-radius: 14px; padding: 4px; margin-bottom: 12px; }
.tabs button { background: none; color: var(--muted); padding: 10px; border-radius: 10px; }
.tabs button.on { background: var(--accent); color: #1c1608; }

/* ---------- levelezés ---------- */
.msgs { display: flex; flex-direction: column; gap: 8px; padding-bottom: 10px; }
.msg { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 9px 13px; max-width: 86%; align-self: flex-start; }
.msg.mine { align-self: flex-end; background: #2c2717; border-color: #50452a; }
.msg.unread { border-color: var(--accent); }
.msg .meta { font-size: 12px; color: var(--muted); }
.plus { color: var(--green); font-weight: 700; }
.minus { color: var(--red); font-weight: 700; }
#composer { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 4; display: flex; justify-content: center;
  background: rgba(18,18,22,.97); border-top: 1px solid var(--line); }
#composer form { display: flex; gap: 8px; align-items: flex-end; width: 100%; max-width: 520px; padding: 10px 14px; }
#composer .amt { width: 92px; flex: none; }
#composer textarea { resize: none; min-height: 46px; max-height: 120px; }
#composer .send { width: 46px; height: 46px; padding: 0; flex: none; font-size: 22px; border-radius: 50%; }
.thread-pad { height: 80px; }

/* ---------- nyomok ---------- */
.clue { display: flex; gap: 10px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line);
  border-left: 5px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 8px; }
.clue.jo { border-left-color: var(--green); }
.clue.kozepes { border-left-color: var(--accent); }
.clue.rossz { border-left-color: var(--red); }

/* ---------- térkép ---------- */
.mapwrap { border-radius: 20px; overflow: hidden; border: 1px solid var(--line); background: #1a2520; }
.mapwrap svg { display: block; width: 100%; height: auto; }
.mapwrap .dist { fill: #2a2f2a; stroke: #45503f; stroke-width: 2; cursor: pointer; transition: fill .15s; }
.mapwrap .dist.home { fill: #3a3424; }
.mapwrap .dist:active { fill: #3a4136; }
.mapwrap .lbl { fill: var(--text); font-size: 15px; font-weight: 800; text-anchor: middle; pointer-events: none; }
.mapwrap .sub { fill: var(--muted); font-size: 11px; font-weight: 600; text-anchor: middle; pointer-events: none; }
.mapwrap .river { fill: none; stroke: #2d5277; stroke-width: 12; stroke-linecap: round; opacity: .9; pointer-events: none; }
.mapwrap .road { fill: none; stroke: #3b4238; stroke-width: 2; stroke-dasharray: 3 5; pointer-events: none; }
.mapwrap .pin { fill: var(--red); stroke: #fff; stroke-width: 1.5; pointer-events: none; }
.mapwrap .here { fill: var(--accent); pointer-events: none; }
.mapwrap .here-ring { fill: none; stroke: var(--accent); stroke-width: 2; pointer-events: none; animation: pulse 1.6s infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { from { opacity: .9; transform: scale(.6); } to { opacity: 0; transform: scale(1.8); } }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin: 10px 2px; }

/* ---------- alsó panel (sheet) ---------- */
#sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.55); animation: fade .15s; }
.sheet-box { position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 520px; max-height: 88dvh; overflow-y: auto;
  background: var(--panel); border-radius: 22px 22px 0 0; border: 1px solid var(--line); border-bottom: 0;
  padding: 10px 18px calc(18px + var(--safe-b)); animation: up .2s ease-out; }
.sheet-box::before { content: ''; display: block; width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 14px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.sheet-actions.three { grid-template-columns: 1fr 1fr 1fr; }
.big-price { font-size: 30px; font-weight: 800; color: var(--accent); margin: 8px 0; }
@keyframes up { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }

/* gyűrűs kisgomb a játékos-kártyán */
.ring { --p: 1; padding: 3px; border-radius: 16px; color: var(--text); background: conic-gradient(var(--accent) calc(var(--p) * 360deg), var(--line) 0); }
.ring > span { display: flex; flex-direction: column; align-items: center; border-radius: 13px; background: var(--panel2); padding: 10px 6px; }
.ring .cdt { font-size: 12px; color: var(--muted); font-weight: 600; }
.ring.ready .cdt { color: var(--green); }
.ring:disabled { opacity: 1; }
.ring:disabled > span { opacity: .55; }

/* ---------- pénzjelzés és üzenetek ---------- */
#flash { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 40;
  display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.flash { padding: 8px 18px; border-radius: 99px; font-weight: 800; font-size: 17px; box-shadow: 0 6px 24px rgba(0,0,0,.45);
  animation: flashIn .25s ease-out, flashOut .4s ease-in 2.2s forwards; }
.flash.plus { background: #1d3b27; color: #8ee6aa; border: 1px solid #2f6a43; }
.flash.minus { background: #3e1d1a; color: #ffab9f; border: 1px solid #77302a; }
@keyframes flashIn { from { transform: translateY(-20px); opacity: 0; } }
@keyframes flashOut { to { transform: translateY(-20px); opacity: 0; } }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
  z-index: 15; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 480px); pointer-events: none; }
.toast { background: #2c2c37; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 14px;
  padding: 11px 14px; box-shadow: 0 6px 24px rgba(0,0,0,.45); font-size: 15px; }
.toast.err { border-left-color: var(--red); }

table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
