/* Light the Village: in-level HUD styling (menus and dialogs are css/shell.css). Colours follow data/theme.json. */
:root {
  --bg: var(--gs-bg, #0e1426);
  --bg2: var(--gs-bg2, #1a2340);
  --text: var(--gs-fg, #e8ecf6);
  --muted: var(--gs-muted, #9aa6c4);
  --accent: var(--gs-accent, #ffc864);
  --line: #33406a;
  --good: #8fd6a0;
  --bad: #ff7a6a;
  --coin: #ffd25e;
  --glass: rgba(20, 28, 54, .88);
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  font: 15px/1.35 var(--gs-font-body, system-ui), -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
#game { position: fixed; inset: 0; touch-action: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
i.coin { display: inline-block; width: .9em; height: .9em; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff2b0, var(--coin) 55%, #b07a18); box-shadow: 0 0 0 1px #6b4708; vertical-align: -.08em; margin-right: 3px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; transition: opacity .35s; zoom: var(--gs-text, 1); }
#hud.away { opacity: 0; }
#hud.away * { pointer-events: none !important; }
#hud > * { pointer-events: auto; }
#top { position: absolute; left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); top: max(8px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 6px; background: var(--glass); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); backdrop-filter: blur(6px); }
#top .gs-icon { width: 42px; height: 42px; flex: none; }
#top .grow { flex: 1; }
#lvl { display: flex; flex-direction: column; line-height: 1.12; min-width: 0; }
#lvl b { font: 700 17px/1.1 var(--gs-font-display, sans-serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--accent); letter-spacing: .3px; }
#lvl small { color: var(--muted); font-size: 12px; }
#stats { display: flex; gap: 6px; }
.pill { background: rgba(10, 15, 32, .6); border: 1px solid var(--line); border-radius: 12px; padding: 3px 10px 4px; display: flex; flex-direction: column; line-height: 1.12; min-width: 70px; position: relative; }
.pill small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.pill b { font-size: 16px; white-space: nowrap; }
.pill b.ok { color: var(--good); }
.pill b.bad { color: var(--bad); }
.pill b em { font-style: normal; color: var(--bad); font-size: 13px; }
.pill .over { color: var(--bad); }
.pill .bonus { position: absolute; top: -7px; right: -6px; background: var(--coin); color: #3a2408; font-weight: 900; font-size: 11px; border-radius: 9px; padding: 0 5px; }

#wind { position: absolute; top: 76px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; background: rgba(150, 200, 255, .16); border: 1px solid rgba(180, 220, 255, .35); color: #d8ecff; border-radius: 999px; padding: 4px 12px 4px 8px; font-weight: 700; font-size: 13px; pointer-events: none; }
#wind .arrow { width: 22px; height: 22px; display: inline-block; background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 12h14M12 6l6 6-6 6' fill='none' stroke='%23d8ecff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); animation: gust 1.4s ease-in-out infinite; }
/* grid directions on screen: north = up-right, east = down-right, south = down-left, west = up-left. The arrow shows where the wind GOES. */
#wind .a-n { transform: rotate(153deg); } #wind .a-e { transform: rotate(-153deg); } #wind .a-s { transform: rotate(-27deg); } #wind .a-w { transform: rotate(27deg); }
@keyframes gust { 50% { opacity: .55; } }

#tipbox { position: absolute; left: 50%; bottom: 136px; transform: translateX(-50%); width: min(520px, calc(100% - 16px)); background: rgba(255, 200, 100, .12); border: 1px solid rgba(255, 200, 100, .55); border-radius: 14px; padding: 9px 14px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); backdrop-filter: blur(6px); transition: opacity .25s, transform .25s; cursor: pointer; }
#tipbox b { color: var(--accent); font: 700 13px/1 var(--gs-font-display, sans-serif); letter-spacing: 1px; text-transform: uppercase; }
#tipbox span { font-size: 14px; }
#tipbox span b { font: inherit; text-transform: none; letter-spacing: 0; color: var(--accent); font-weight: 800; }
#tipbox small { color: var(--muted); font-size: 11px; align-self: flex-end; }
#tipbox.gone { opacity: 0; transform: translate(-50%, -8px); }

#bottom { position: absolute; left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); display: flex; align-items: flex-end; justify-content: center; gap: 10px; }
#tray { display: flex; gap: 8px; padding: 7px; background: var(--glass); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); backdrop-filter: blur(6px); }
.card { position: relative; width: 98px; height: 108px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 1px; padding: 5px 4px; background: rgba(10, 15, 32, .55); border: 1px solid var(--line); border-radius: 14px; transition: transform .12s, border-color .12s; }
.card img { width: 46px; height: 46px; object-fit: contain; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .4)); }
.card b { font-size: 12px; line-height: 1.1; text-align: center; }
.card .cost { font-weight: 900; color: var(--coin); font-size: 14px; }
.card .rad { font-size: 11px; color: var(--muted); }
.card .max { position: absolute; top: 4px; left: 6px; font-style: normal; font-size: 11px; font-weight: 800; color: var(--muted); }
.card kbd { position: absolute; top: 4px; right: 6px; font: 700 10px/1 var(--gs-font-body, sans-serif); color: var(--muted); opacity: .7; }
.card.on { border-color: var(--accent); background: rgba(255, 200, 100, .16); box-shadow: 0 0 0 2px var(--accent), 0 0 18px rgba(255, 200, 100, .35); transform: translateY(-3px); }
.card.poor { opacity: .45; }
.card.used { opacity: .35; }
#acts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 7px; background: var(--glass); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.act { display: flex; align-items: center; gap: 6px; min-width: 92px; height: 30px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(10, 15, 32, .55); font-weight: 700; font-size: 13px; }
.act i { font-style: normal; color: var(--accent); font-size: 16px; width: 16px; text-align: center; }
.act:disabled { opacity: .4; cursor: default; }
.act:not(:disabled):active { transform: translateY(1px); }

/* ---------- phone ---------- */
body.phone #top { flex-wrap: wrap; row-gap: 6px; border-radius: 16px; }
body.phone #lvl { flex: 1 1 0; }
body.phone #top .grow { display: none; }
body.phone #stats { order: 3; flex: 1 1 100%; }
body.phone .pill { flex: 1 1 0; min-width: 0; padding: 2px 8px 3px; }
body.phone .pill b { font-size: 14px; }
body.phone #wind { top: 112px; }
body.phone #tipbox { bottom: 160px; }
body.phone #bottom { flex-direction: column; align-items: stretch; gap: 6px; }
body.phone #tray { justify-content: center; padding: 6px; gap: 6px; }
body.phone .card { flex: 1 1 0; width: auto; max-width: 96px; height: 96px; }
body.phone .card img { width: 38px; height: 38px; }
body.phone #acts { display: flex; flex-direction: row; justify-content: center; padding: 5px; }
body.phone .act { flex: 1 1 0; justify-content: center; min-width: 0; }
body.short .card { height: 84px; } body.short .card img { width: 32px; height: 32px; } body.short .card .rad { display: none; }
body.short #acts { display: flex; flex-direction: row; }

/* ---------- menus (inside shell dialogs) ---------- */
.side-top { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 0 10px; }
.side-top b { color: var(--accent); font: 700 20px/1 var(--gs-font-display, sans-serif); }
.side-top .streak { color: #bfe3ff; font-weight: 800; }
.ch-line { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.ch-line.locked { color: var(--muted); }
.ch-line .stars-t { color: var(--accent); font-weight: 800; }
.ch-line .pbar { grid-column: 1 / -1; height: 5px; border-radius: 4px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.ch-line .pbar b { display: block; height: 100%; background: linear-gradient(90deg, #ffb347, var(--accent)); }
.daily-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px 0; flex-wrap: wrap; }
.daily-row b { color: var(--accent); font-family: var(--gs-font-display, sans-serif); }
.daily-row span { flex: 1; color: var(--muted); }
.help-d .srcs img { width: 26px; height: 26px; vertical-align: middle; margin-right: 4px; }
.help-d .tips li { margin: 4px 0; }
.help-d .tips b { color: var(--accent); }
.star-why { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; font-size: 14px; }
.star-why li { color: var(--muted); display: flex; gap: 8px; align-items: center; }
.star-why li i { font-style: normal; color: var(--muted); width: 1.2em; text-align: center; }
.star-why li.ok { color: var(--text); }
.star-why li.ok i { color: var(--accent); }
