/* Yksin Lapissa 3D – käyttöliittymän tyylit (HUD, valikot, reppu, dialogit, kartta, loppuruutu).
 * Kaikki luokat alkavat .g3- (ei sekoitu css/style.css:ään). Kylmät sävyt, lämmin oranssi korostus, ohuet viivat.
 * HUD on läpinäkyvä (pointer-events: none); vain painikkeet, pikapaikat ja modaalit ottavat kosketuksen vastaan.
 */

.g3-root {
  --g3-bg: rgba(9, 16, 25, .66);
  --g3-bg-strong: rgba(11, 19, 30, .92);
  --g3-line: rgba(170, 200, 225, .18);
  --g3-line-2: rgba(170, 200, 225, .34);
  --g3-text: #e9f1f8;
  --g3-muted: #a3b8ca;
  --g3-dim: #6d8294;
  --g3-accent: #ffb14a;
  --g3-accent-2: #ff8a3d;
  --g3-ice: #9fd8ff;
  --g3-good: #8fe3b0;
  --g3-warn: #ffd27a;
  --g3-bad: #ff9a9a;
  --g3-crit: #ff6f4f;
  --g3-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --g3-sa-t: env(safe-area-inset-top, 0px);
  --g3-sa-r: env(safe-area-inset-right, 0px);
  --g3-sa-b: env(safe-area-inset-bottom, 0px);
  --g3-sa-l: env(safe-area-inset-left, 0px);
  position: relative;
  overflow: hidden;
  font-family: var(--g3-sans);
  color: var(--g3-text);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
.g3-root *, .g3-root *::before, .g3-root *::after { box-sizing: border-box; }
.g3-root button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.g3-root :focus-visible { outline: 2px solid var(--g3-accent); outline-offset: 2px; }
.g3-root h2, .g3-root h3, .g3-root p, .g3-root dl, .g3-root dd, .g3-root dt { margin: 0; }
.g3-hide { display: none !important; }
.g3-muted { color: var(--g3-muted); font-size: 14px; }
.g3-glass {
  background: var(--g3-bg);
  border: 1px solid var(--g3-line);
  border-radius: 12px;
  -webkit-backdrop-filter: blur(8px) saturate(1.1);
  backdrop-filter: blur(8px) saturate(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
}

/* ---------- HUD: vasen yläkulma (kello, sää) ---------- */
.g3-ui { position: absolute; inset: 0; z-index: 2; pointer-events: none; font-variant-numeric: tabular-nums; }
.g3-tl {
  position: absolute;
  left: calc(10px + var(--g3-sa-l));
  top: calc(10px + var(--g3-sa-t));
  max-width: min(252px, 56vw);
}
.g3-card { padding: 7px 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.g3-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.g3-clock { font-size: 15px; font-weight: 650; letter-spacing: .01em; white-space: nowrap; }
.g3-speed {
  font-size: 11.5px; font-weight: 600; color: var(--g3-accent); white-space: nowrap;
  border: 1px solid rgba(255, 177, 74, .45); border-radius: 999px; padding: 0 7px; line-height: 18px;
}
.g3-date { font-size: 12px; color: var(--g3-muted); white-space: nowrap; }
.g3-wx { display: flex; flex-wrap: wrap; align-items: center; gap: 0 5px; font-size: 12px; color: var(--g3-muted); white-space: nowrap; }
.g3-wx b { font-weight: 600; color: var(--g3-text); }
.g3-wxic { font-size: 14px; }
.g3-sep { opacity: .5; }

/* ---------- HUD: oikea yläkulma (painikkeet) ---------- */
.g3-tr {
  position: absolute;
  top: calc(10px + var(--g3-sa-t));
  right: calc(10px + var(--g3-sa-r));
  display: flex; gap: 6px;
  pointer-events: none;
}
.g3-ibtn {
  pointer-events: auto;
  width: 44px; height: 44px; padding: 0;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--g3-line-2);
  background: var(--g3-bg-strong);
  font-size: 19px; line-height: 1;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background .15s, border-color .15s, transform .08s;
}
.g3-ibtn:hover { background: rgba(24, 40, 58, .95); border-color: rgba(200, 225, 245, .5); }
.g3-ibtn:active { transform: scale(.94); }

/* ---------- HUD: kompassi (yläreuna, keskellä) ---------- */
.g3-cmp {
  position: absolute;
  top: calc(12px + var(--g3-sa-t));
  left: 50%;
  transform: translateX(-50%);
  width: 260px; height: 40px;
}
.g3-cmp-strip {
  position: absolute; inset: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent);
}
.g3-cmp-band {
  position: absolute; left: 0; top: 0; height: 100%;
  background-image: repeating-linear-gradient(90deg, rgba(200, 225, 245, .5) 0 1px, transparent 1px 30px);
  background-size: 100% 6px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  will-change: transform;
}
.g3-cmp-lab {
  position: absolute; top: 19px;
  transform: translateX(-50%);
  font-size: 10.5px; font-weight: 650; letter-spacing: .03em;
  color: var(--g3-muted);
  white-space: nowrap;
}
.g3-cmp-lab.n { color: var(--g3-accent); }
.g3-cmp-val {
  position: absolute; left: 50%; top: 0;
  transform: translateX(-50%);
  padding: 0 9px; height: 16px; line-height: 15px;
  border-radius: 999px;
  background: rgba(9, 16, 25, .88);
  border: 1px solid var(--g3-line-2);
  font-size: 11.5px; font-weight: 650;
  white-space: nowrap;
}

/* ---------- HUD: vasen alakulma (tiedotteet, statukset, palkit, paino) ---------- */
.g3-bl {
  position: absolute;
  left: calc(12px + var(--g3-sa-l));
  bottom: calc(12px + var(--g3-sa-b));
  width: 196px;
  display: flex; flex-direction: column; gap: 6px;
}
.g3-toasts {
  position: absolute; left: 0; bottom: 100%; margin-bottom: 8px;
  width: 290px; max-width: calc(100vw - 24px);
  display: flex; flex-direction: column; gap: 6px;
  pointer-events: none;
}
.g3-toast {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 8px 12px 8px 10px;
  border-radius: 10px;
  background: rgba(10, 18, 28, .86);
  border: 1px solid var(--g3-line);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
  font-size: 13.5px; line-height: 1.3;
  opacity: 0; transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease;
  --c: var(--g3-ice);
}
.g3-toast::before { content: ''; flex: 0 0 3px; align-self: stretch; border-radius: 2px; background: var(--c); }
.g3-toast.good { --c: var(--g3-good); }
.g3-toast.warn { --c: var(--g3-warn); }
.g3-toast.bad { --c: var(--g3-bad); }
.g3-toast.on { opacity: 1; transform: none; }
.g3-toast.out { opacity: 0; transform: translateY(-4px); }
.g3-status { display: flex; flex-wrap: wrap; gap: 5px; pointer-events: none; }
.g3-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; line-height: 16px; white-space: nowrap;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(10, 18, 28, .82);
  border: 1px solid var(--g3-line);
  color: var(--g3-text);
}
.g3-chip.good { border-color: rgba(143, 227, 176, .5); color: var(--g3-good); }
.g3-chip.warn { border-color: rgba(255, 210, 122, .5); color: var(--g3-warn); }
.g3-chip.bad { border-color: rgba(255, 154, 154, .55); color: var(--g3-bad); }
.g3-ci { font-size: 12px; }
.g3-stats { padding: 8px 10px 7px; display: flex; flex-direction: column; gap: 5px; }
.g3-st {
  display: grid; grid-template-columns: 16px 56px minmax(0, 1fr) 24px;
  align-items: center; gap: 6px;
  font-size: 12px; color: var(--g3-muted);
}
.g3-st .ic { font-size: 13px; line-height: 1; text-align: center; }
.g3-st .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g3-st .tr { position: relative; display: block; height: 6px; border-radius: 3px; background: rgba(160, 190, 215, .16); overflow: hidden; }
.g3-st .fl {
  position: absolute; left: 0; top: 0; bottom: 0; right: 0;
  background: linear-gradient(90deg, #5a9fd0, #9fd8ff);
  transform-origin: 0 50%;
  transform: scaleX(1);
}
.g3-st[data-k="health"] .fl { background: linear-gradient(90deg, #b8606c, #ec8c96); }
.g3-st[data-k="food"] .fl { background: linear-gradient(90deg, #a98347, #e7b875); }
.g3-st[data-k="water"] .fl { background: linear-gradient(90deg, #3d89b8, #7cd0f7); }
.g3-st[data-k="warmth"] .fl { background: linear-gradient(90deg, #b8683d, #ff9a5c); }
.g3-st[data-k="morale"] .fl { background: linear-gradient(90deg, #4f72b8, #9bb8ff); }
.g3-st[data-k="stamina"] .fl { background: linear-gradient(90deg, #3f9b7c, #8fe0c4); }
.g3-st.low .fl { background: var(--g3-warn) !important; }
.g3-st.crit .fl { background: var(--g3-crit) !important; animation: g3-blink 1s steps(2, start) infinite; }
.g3-st .v { font-size: 11px; text-align: right; color: var(--g3-text); }
.g3-weight { font-size: 12px; color: var(--g3-muted); padding-top: 1px; white-space: nowrap; }
@keyframes g3-blink { 50% { opacity: .3; } }

/* ---------- HUD: risti ja kehote ---------- */
.g3-ch { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; pointer-events: none; }
.g3-ch svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 2px rgba(0, 0, 0, .55)); }
.g3-ch[data-k="none"] { display: none; }
.g3-ch[data-k="dot"] .c-hand, .g3-ch[data-k="dot"] .c-axe,
.g3-ch[data-k="hand"] .c-dot, .g3-ch[data-k="hand"] .c-axe,
.g3-ch[data-k="axe"] .c-dot, .g3-ch[data-k="axe"] .c-hand { display: none; }

.g3-prompt {
  position: absolute; left: 50%; top: calc(50% + 28px);
  transform: translateX(-50%);
  max-width: min(88vw, 340px);
  padding: 7px 12px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-align: center;
  opacity: 0;
  transition: opacity .15s ease;
  pointer-events: none;
}
.g3-prompt.on { opacity: 1; }
.g3-prow { display: flex; align-items: center; gap: 8px; max-width: 100%; }
.g3-kbd {
  min-width: 22px; height: 22px; padding: 0 6px;
  display: inline-grid; place-items: center;
  border-radius: 6px; border: 1px solid var(--g3-line-2);
  background: rgba(255, 255, 255, .06);
  font-size: 12px; font-weight: 700; line-height: 1;
}
.g3-ptxt { font-size: 14.5px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.g3-psub { font-size: 12px; color: var(--g3-muted); line-height: 1.3; }
.g3-pbar { width: 120px; height: 3px; border-radius: 2px; background: rgba(160, 190, 215, .2); overflow: hidden; }
.g3-pfill { display: block; height: 100%; background: var(--g3-accent); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------- HUD: pikapaikat (alareuna, keskellä) ---------- */
.g3-hb {
  position: absolute; left: 50%; bottom: calc(12px + var(--g3-sa-b));
  transform: translateX(-50%);
  display: grid; grid-template-columns: repeat(10, 50px); gap: 6px;
  padding: 6px;
  pointer-events: none;
}
.g3-slot {
  pointer-events: auto;
  position: relative;
  width: 50px; height: 50px; padding: 0;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid var(--g3-line);
  background: rgba(11, 19, 30, .78);
  transition: border-color .12s, background .12s, transform .08s;
}
.g3-slot:active { transform: scale(.95); }
.g3-slot.empty { border-style: dashed; border-color: rgba(170, 200, 225, .14); background: rgba(11, 19, 30, .5); }
.g3-slot.sel {
  border-color: var(--g3-accent);
  background: rgba(255, 177, 74, .12);
  box-shadow: 0 0 0 1px var(--g3-accent) inset, 0 0 14px rgba(255, 177, 74, .22);
}
.g3-slot .k { position: absolute; left: 4px; top: 2px; font-size: 10px; font-weight: 650; color: var(--g3-dim); line-height: 1; }
.g3-slot.sel .k { color: var(--g3-accent); }
.g3-slot .ic { font-size: 22px; line-height: 1; }
.g3-slot .ct {
  position: absolute; right: 3px; bottom: 3px;
  padding: 0 4px; border-radius: 5px;
  font-size: 10.5px; font-weight: 700; line-height: 14px;
  background: rgba(9, 16, 25, .9);
}

/* ---------- HUD: banneri ja häivytys ---------- */
.g3-banner {
  position: absolute; left: 0; right: 0; top: 24%;
  text-align: center;
  font-size: clamp(22px, 5vw, 34px); font-weight: 650; letter-spacing: .08em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .75);
  opacity: 0; transform: translateY(-6px);
  transition: opacity .45s ease, transform .45s ease;
  pointer-events: none;
}
.g3-banner.on { opacity: 1; transform: none; }
.g3-fade { display: none; position: absolute; inset: 0; background: #02050a; opacity: 0; pointer-events: none; }
.g3-fade.on { display: block; }

/* ---------- modaalit: kerros ja paneeli ---------- */
.g3-layer {
  position: absolute; inset: 0; z-index: 20;
  display: none;
  align-items: center; justify-content: center;
  padding: calc(12px + var(--g3-sa-t)) calc(12px + var(--g3-sa-r)) calc(12px + var(--g3-sa-b)) calc(12px + var(--g3-sa-l));
  background: rgba(3, 8, 14, .58);
  pointer-events: auto;
}
.g3-layer.open { display: flex; animation: g3-fadein .16s ease-out; }
.g3-layer.end { background: radial-gradient(120% 90% at 50% 18%, rgba(30, 50, 72, .94), rgba(4, 8, 14, .98)); }
.g3-layer.map { padding: 10px; }
@keyframes g3-fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes g3-pop { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes g3-sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.g3-panel {
  position: relative;
  width: 100%; max-width: 440px; max-height: 100%;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(20, 33, 48, .97), rgba(10, 18, 28, .97));
  border: 1px solid var(--g3-line-2);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
  overflow: hidden;
  animation: g3-pop .18s ease-out;
}
.g3-phead {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px 11px 16px;
  border-bottom: 1px solid var(--g3-line);
}
.g3-ptitle { flex: 1 1 auto; min-width: 0; }
.g3-phead h2, .g3-mtitle { font-size: 17px; font-weight: 650; letter-spacing: .01em; }
.g3-psub { margin-top: 2px; font-size: 12.5px; color: var(--g3-muted); line-height: 1.35; }
.g3-pbody {
  flex: 1 1 auto; min-height: 0;
  padding: 12px 16px 14px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.g3-pfoot {
  flex: 0 0 auto;
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 10px 14px calc(10px + var(--g3-sa-b));
  border-top: 1px solid var(--g3-line);
}
.g3-sq { min-width: 44px; padding: 8px 10px; }
.g3-root .g3-sq.ghost { border-color: transparent; background: transparent; color: var(--g3-muted); font-size: 18px; }

/* ---------- painikkeet ja valinnat ---------- */
.g3-btn {
  min-height: 44px; padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--g3-line-2);
  background: rgba(255, 255, 255, .04);
  font-size: 14.5px; font-weight: 600;
  cursor: pointer;
  transition: background .12s, transform .08s;
}
.g3-btn:hover { background: rgba(160, 200, 235, .1); }
.g3-btn:active { transform: scale(.97); }
.g3-btn.primary { background: linear-gradient(180deg, #ffc27a, #f59a3c); color: #2a1603; border-color: #ffd39a; }
.g3-btn.primary:hover { background: linear-gradient(180deg, #ffcb8e, #ffa64f); }
.g3-btn.ghost { background: transparent; border-color: transparent; color: var(--g3-muted); }
.g3-btn.ghost:hover { color: var(--g3-text); background: rgba(255, 255, 255, .05); }
.g3-btn.danger { border-color: rgba(255, 120, 120, .5); color: #ffc2c2; }
.g3-btn.sm { min-height: 44px; padding: 8px 12px; font-size: 13.5px; }

.g3-opts { display: flex; flex-direction: column; gap: 8px; }
.g3-opt {
  width: 100%; min-height: 56px;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  text-align: left;
  border-radius: 12px;
  border: 1px solid var(--g3-line);
  background: rgba(255, 255, 255, .03);
  transition: background .12s, border-color .12s, transform .08s;
  cursor: pointer;
}
.g3-opt:hover:not(:disabled) { background: rgba(160, 200, 235, .08); border-color: var(--g3-line-2); }
.g3-opt:active:not(:disabled) { transform: scale(.99); }
.g3-opt.primary { border-color: rgba(255, 177, 74, .55); background: rgba(255, 177, 74, .08); }
.g3-opt.danger b { color: #ffb8b8; }
.g3-opt.off { opacity: .5; cursor: not-allowed; }
.g3-opt-ic { flex: 0 0 30px; width: 30px; font-size: 22px; line-height: 1; text-align: center; }
.g3-opt-tx { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.g3-opt-tx b { font-size: 15px; font-weight: 600; }
.g3-opt-tx small { font-size: 12.5px; line-height: 1.35; color: var(--g3-muted); }
.g3-opt-tx .g3-why { color: var(--g3-warn); }
.g3-cost {
  flex: 0 1 auto; max-width: 45%;
  font-size: 12px; line-height: 1.35;
  padding: 2px 8px; border-radius: 12px;
  color: var(--g3-accent);
  border: 1px solid rgba(255, 177, 74, .35);
}
/* kapea näyttö: hinta (tarvikkeet) omalle rivilleen tekstin alle, ettei kuvaus kutistu sanan levyiseksi */
@media (max-width: 519px) {
  .g3-opt { flex-wrap: wrap; row-gap: 6px; }
  .g3-opt .g3-opt-tx { flex-basis: calc(100% - 42px); }
  .g3-opt .g3-cost { margin-left: 42px; max-width: calc(100% - 42px); }
}

.g3-seg { display: flex; border-radius: 10px; border: 1px solid var(--g3-line-2); overflow: hidden; flex: 0 0 auto; }
.g3-seg-b {
  flex: 1 1 auto;
  min-height: 40px; padding: 6px 12px;
  background: transparent; border: 0;
  font-size: 13.5px; font-weight: 600; color: var(--g3-muted);
  cursor: pointer;
}
.g3-seg-b + .g3-seg-b { border-left: 1px solid var(--g3-line); }
.g3-seg-b.on { background: rgba(255, 177, 74, .16); color: var(--g3-text); }
.g3-seg-b:hover { color: var(--g3-text); }

/* asetukset (taukovalikko) */
.g3-set { display: flex; flex-direction: column; gap: 8px; padding: 10px 0 12px; border-bottom: 1px solid var(--g3-line); }
.g3-set:last-of-type { border-bottom: 0; }
.g3-set-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; }
.g3-set-l { font-weight: 600; }
.g3-set-v { color: var(--g3-accent); font-variant-numeric: tabular-nums; }
.g3-set-h { font-size: 12.5px; color: var(--g3-muted); }
.g3-range { width: 100%; height: 36px; accent-color: var(--g3-accent); margin: 0; }

/* ---------- menu & dialogi ---------- */
.g3-dialog { max-width: 460px; }
.g3-dlg-em { font-size: 46px; line-height: 1; text-align: center; padding: 16px 0 2px; }
.g3-dlg-h { font-size: 19px; font-weight: 650; text-align: center; margin-bottom: 8px; }
.g3-dlg-t { font-size: 15px; line-height: 1.5; text-align: center; color: var(--g3-text); opacity: .94; margin-bottom: 14px; }
.g3-dlg-t b { color: var(--g3-accent); font-weight: 650; }
.g3-choices { margin-top: 0; }
.g3-menu .g3-pbody { padding-bottom: 12px; }

/* ---------- reppu ---------- */
.g3-inv { max-width: 780px; height: min(640px, 100%); }
.g3-cap {
  flex: 0 0 auto;
  font-size: 12px; color: var(--g3-ice);
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid rgba(159, 216, 255, .35);
  white-space: nowrap;
}
.g3-inv-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 248px;
  gap: 14px;
  align-items: start;
}
.g3-inv-main { min-width: 0; }
.g3-grp + .g3-grp { margin-top: 14px; }
.g3-grp h3 {
  margin: 0 0 7px;
  font-size: 11px; font-weight: 650;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--g3-ice);
}
.g3-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.g3-tile {
  position: relative;
  min-height: 84px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 6px 8px;
  border-radius: 12px;
  border: 1px solid var(--g3-line);
  background: rgba(255, 255, 255, .03);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.g3-tile:hover { background: rgba(160, 200, 235, .08); }
.g3-tile .ic { font-size: 26px; line-height: 1.15; }
.g3-tile .nm {
  max-width: 100%;
  font-size: 11.5px; line-height: 1.2; text-align: center; color: var(--g3-muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere; hyphens: auto;
}
.g3-tile .ct {
  position: absolute; top: 4px; right: 5px;
  padding: 0 5px; border-radius: 6px;
  font-size: 10.5px; font-weight: 700; line-height: 15px;
  background: rgba(9, 16, 25, .9);
}
.g3-tile.sel { border-color: var(--g3-accent); background: rgba(255, 177, 74, .1); box-shadow: 0 0 0 1px var(--g3-accent) inset; }
/* ruoan tuoreus (Sim.freshInfo): "tuore · ~12 h", "syö pian", "alkaa haista", "jäässä" */
.g3-tile .fr { max-width: 100%; font-size: 10px; line-height: 1.15; text-align: center; color: var(--g3-muted); opacity: .9; overflow-wrap: anywhere; }
.g3-tile .fr.warn, .g3-fresh.warn { color: var(--g3-warn); }
.g3-tile .fr.bad, .g3-fresh.bad { color: var(--g3-bad); }
.g3-tile.sel .nm { color: var(--g3-text); }
.g3-inv-side {
  position: sticky; top: 0;
  padding: 12px;
  border: 1px solid var(--g3-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .03);
}
.g3-det-top { display: flex; align-items: center; gap: 12px; }
.g3-det-ic { flex: 0 0 56px; height: 56px; display: grid; place-items: center; font-size: 36px; line-height: 1; border-radius: 14px; background: rgba(255, 255, 255, .04); }
.g3-det-tx { min-width: 0; }
.g3-det-tx h3 { font-size: 16px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.g3-det-meta { font-size: 12.5px; color: var(--g3-muted); margin-top: 3px; }
.g3-det-d { margin-top: 10px; font-size: 13.5px; line-height: 1.45; color: var(--g3-text); opacity: .9; }
.g3-acts { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.g3-acts .g3-btn { width: 100%; }
.g3-pk-wrap { display: flex; flex-direction: column; gap: 6px; }
.g3-pk-l { font-size: 12.5px; color: var(--g3-muted); }
.g3-pk-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.g3-pk {
  min-height: 44px; border-radius: 10px;
  border: 1px solid var(--g3-line-2);
  background: rgba(255, 255, 255, .04);
  font-size: 14px; font-weight: 650;
  cursor: pointer;
}
.g3-pk:hover { background: rgba(255, 177, 74, .12); border-color: var(--g3-accent); }

/* ---------- kartta ---------- */
.g3-map { max-width: 1000px; height: min(94%, 880px); }
.g3-mhead { flex-wrap: wrap; row-gap: 8px; }
.g3-mhead .g3-mtitle { flex: 0 0 auto; }
.g3-mctl { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.g3-mview {
  position: relative;
  flex: 1 1 auto; min-height: 200px;
  overflow: hidden;
  background: #081018;
  touch-action: none;
  cursor: grab;
  outline: none;
}
.g3-mview:active { cursor: grabbing; }
.g3-mview:focus, .g3-mview:focus-visible { outline: none; }
.g3-mworld {
  position: absolute; left: 0; top: 0;
  width: 820px; height: 1305px;
  transform-origin: 0 0;          /* ei will-change: transform – Chrome jättäisi tason alkuperäiseen rasterointimittakaavaan ja nimet sumenisivat lähennettäessä */
  --inv: 1;
}
.g3-mimg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; pointer-events: none; -webkit-user-drag: none; }
.g3-mgrid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(190, 220, 240, .18) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(190, 220, 240, .18) 1px, transparent 1px);
}
.g3-mmsg {
  display: none;
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 8px 14px; border-radius: 10px;
  background: rgba(9, 16, 25, .9); border: 1px solid var(--g3-line-2);
  font-size: 13px; color: var(--g3-muted);
}
.g3-mmsg.on { display: block; }
.g3-marea {           /* arvioalue (esim. veneen avain): maailman mittakaavassa, reunaviiva vakiopaksu */
  position: absolute; box-sizing: border-box; border-radius: 50%; pointer-events: none;
  background: rgba(255, 140, 40, .17);
  border: calc(2px * var(--inv, 1)) dashed rgba(255, 168, 70, .95);
  box-shadow: 0 0 0 calc(1px * var(--inv, 1)) rgba(0, 0, 0, .3), inset 0 0 0 calc(1px * var(--inv, 1)) rgba(0, 0, 0, .25);
}
.g3-marea-tx { position: absolute; width: 0; height: 0; transform: scale(var(--inv, 1)); pointer-events: none; }
.g3-marea-tx > span {
  position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%);
  white-space: nowrap; font-size: 11.5px; font-weight: 650; color: #ffd29a;
  text-shadow: 0 1px 3px #000, 0 0 2px #000;
}
.g3-marea-tx > span.dn { bottom: auto; top: 3px; }     /* kartan yläreunassa: nimi ympyrän sisään (UI.showMap edgeFit) */
.g3-mk { position: absolute; width: 0; height: 0; transform: scale(var(--inv, 1)); pointer-events: none; }
.g3-mk-ic {
  position: absolute; left: -13px; top: -13px;
  width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--g3-accent);
  background: rgba(10, 18, 28, .92);
  font-size: 14px; line-height: 1;
}
.g3-mk-tx {
  position: absolute; left: 50%; top: 15px; transform: translateX(-50%);
  white-space: nowrap;
  font-size: 12px; font-weight: 650;
  text-shadow: 0 1px 3px #000, 0 0 2px #000;
}
.g3-mk-tx.up { top: auto; bottom: 15px; }               /* kartan alareunassa: nimi kuvakkeen yläpuolelle (edgeFit) */
.g3-me { position: absolute; width: 0; height: 0; transform: scale(var(--inv, 1)); pointer-events: none; }
.g3-me-rot { position: absolute; left: -17px; top: -17px; width: 34px; height: 34px; }
.g3-me-tri {
  position: absolute; left: 50%; top: 0;
  transform: translate(-50%, -2px);
  width: 0; height: 0;
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-bottom: 11px solid var(--g3-accent);
  filter: drop-shadow(0 0 2px #000);
}
.g3-me-dot {
  position: absolute; left: -6px; top: -6px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--g3-ice);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .35);
}
.g3-me-tx {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11px; font-weight: 700; color: var(--g3-accent);
  text-shadow: 0 1px 3px #000;
}
.g3-me-tx.up { top: auto; bottom: 18px; }               /* kartan alareunassa: "Sinä" suuntanuolen yläpuolelle (edgeFit) */
.g3-mfoot {
  flex: 0 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  padding: 8px 14px calc(8px + var(--g3-sa-b));
  border-top: 1px solid var(--g3-line);
  font-size: 12px; color: var(--g3-muted);
}
.g3-scale { height: 7px; border: 1.5px solid var(--g3-text); border-top: 0; min-width: 8px; }
.g3-sctx { min-width: 42px; }
.g3-mpos { font-variant-numeric: tabular-nums; }
.g3-hint { opacity: .75; }

/* ---------- loppuruutu ---------- */
.g3-end { max-width: 460px; background: transparent; border: 0; box-shadow: none; overflow: visible; text-align: center; animation: g3-up .45s ease-out; }
@keyframes g3-up { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.g3-end-em { font-size: 64px; line-height: 1; }
.g3-end-h { font-size: 28px; font-weight: 700; line-height: 1.2; margin: 12px 0 8px; }
.g3-end-t { font-size: 15.5px; line-height: 1.5; color: var(--g3-text); opacity: .92; }
.g3-end-t b { color: var(--g3-accent); }
.g3-end-st {
  display: grid; grid-template-columns: 1fr auto; gap: 7px 18px;
  max-width: 340px; margin: 18px auto 0; padding: 12px 16px;
  text-align: left;
  border: 1px solid var(--g3-line); border-radius: 14px;
  background: rgba(255, 255, 255, .03);
}
.g3-end-st dt { color: var(--g3-muted); font-size: 14px; }
.g3-end-st dd { font-size: 14px; font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
.g3-end-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px; }
.g3-end-sum { box-sizing: border-box; width: 100%; max-width: 340px; margin: 14px auto 0; padding: 10px 14px; text-align: left; border: 1px solid var(--g3-line); border-radius: 14px; background: rgba(255, 255, 255, .03); }
.g3-end-sum-h { color: var(--g3-muted); font-size: 12.5px; font-weight: 650; letter-spacing: .02em; margin-bottom: 6px; }
.g3-end-sum-l { list-style: none; margin: 0; padding: 0; max-height: 34vh; overflow-y: auto; }
.g3-end-sum-l li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; padding: 4px 0; border-top: 1px solid var(--g3-line); font-size: 13.5px; }
.g3-end-sum-l li:first-child { border-top: 0; }
.g3-end-sum-l .nm { font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g3-end-sum-l .dy { color: var(--g3-muted); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.g3-end-sum-l .tx { grid-column: 1 / -1; color: var(--g3-muted); font-size: 12.5px; }
.g3-end-sum-l li.in .nm { color: var(--g3-accent); }
.g3-layer.end .g3-end { overflow-y: auto; overscroll-behavior: contain; }       /* yhteenvedon kanssa matalalla ruudulla vieritettävä */
@media (max-height: 560px) {
  .g3-end-em { font-size: 40px; }
  .g3-end-h { font-size: 22px; margin: 4px 0 4px; }
  .g3-end-st { margin-top: 10px; padding: 8px 14px; gap: 3px 18px; }
  .g3-end-sum { margin-top: 8px; padding: 6px 12px; }
  .g3-end-sum-l { max-height: 30vh; }
  .g3-end-btns { margin-top: 12px; }
}

/* ---------- puhelin (pysty, ≤ 519 px): pikapaikat kahdessa rivissä, palkit kapeana rivinä ---------- */
@media (max-width: 519px) {
  .g3-tl { max-width: min(220px, 60vw); }
  .g3-cmp { top: calc(104px + var(--g3-sa-t)); width: 220px; }
  .g3-tr { gap: 5px; }
  .g3-ibtn { width: 44px; height: 44px; }
  .g3-bl {
    left: calc(8px + var(--g3-sa-l)); right: calc(8px + var(--g3-sa-r));
    width: auto;
    bottom: calc(128px + var(--g3-sa-b));
  }
  .g3-stats {
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px 5px; padding: 6px 7px;
  }
  .g3-st { display: flex; flex-direction: column; align-items: stretch; gap: 3px; }
  .g3-st .ic { font-size: 13px; }
  .g3-st .nm, .g3-st .v { display: none; }
  .g3-weight { grid-column: 1 / -1; font-size: 11.5px; padding-top: 0; }
  .g3-hb { grid-template-columns: repeat(5, 46px); gap: 6px; padding: 6px; bottom: calc(12px + var(--g3-sa-b)); }
  .g3-slot { width: 46px; height: 46px; }
  .g3-toasts { width: 100%; }
  .g3-pbar { width: 96px; }
  .g3-ptxt { font-size: 14px; }
}

/* ---------- vaakanäkymä puhelimella (matala ruutu): kompakti HUD, pikapaikat yhdellä rivillä ---------- */
@media (max-height: 500px) and (orientation: landscape) {
  .g3-tl { top: calc(8px + var(--g3-sa-t)); left: calc(8px + var(--g3-sa-l)); max-width: 220px; }
  .g3-card { padding: 5px 10px 6px; }
  .g3-cmp { top: calc(8px + var(--g3-sa-t)); width: 200px; height: 36px; }
  .g3-tr { top: calc(6px + var(--g3-sa-t)); right: calc(8px + var(--g3-sa-r)); }
  .g3-ibtn { width: 44px; height: 44px; }
  .g3-bl { bottom: calc(10px + var(--g3-sa-b)); left: calc(8px + var(--g3-sa-l)); width: 128px; gap: 4px; }
  .g3-stats { padding: 6px 8px; gap: 4px; }
  .g3-st { grid-template-columns: 16px minmax(0, 1fr) 22px; }
  .g3-st .nm { display: none; }
  .g3-hb { grid-template-columns: repeat(10, 44px); gap: 4px; padding: 5px; bottom: calc(8px + var(--g3-sa-b)); }
  .g3-slot { width: 44px; height: 44px; }
  .g3-slot .ic { font-size: 20px; }
  .g3-toasts { width: 250px; }
  .g3-prompt { top: calc(50% + 24px); }
  .g3-layer { padding: 8px; }
  .g3-panel { max-height: 100%; }
}

/* ---------- puhelimen pohjalta nouseva paneeli (bottom sheet) ---------- */
@media (max-width: 600px) {
  .g3-layer { align-items: flex-end; padding: 0; }
  .g3-layer.end { align-items: center; padding: 16px; }
  .g3-layer.map { padding: 0; align-items: stretch; }
  .g3-panel {
    max-width: none; width: 100%;
    max-height: 88%;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    padding-bottom: var(--g3-sa-b);
    animation: g3-sheet .2s ease-out;
  }
  .g3-layer.end .g3-panel, .g3-layer.map .g3-panel { border-radius: 0; }
  .g3-layer.map .g3-panel { max-height: 100%; height: 100%; border-radius: 0; padding-bottom: 0; }
  .g3-layer.end .g3-panel { max-height: 100%; }
  .g3-inv { height: auto; max-height: 88%; }
  .g3-inv-body { grid-template-columns: minmax(0, 1fr); }
  .g3-inv-side { position: static; }
  .g3-tiles { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
  .g3-mhead .g3-mtitle { display: none; }
  .g3-mhead > .g3-btn.ghost { order: 1; margin-left: auto; }
  .g3-mctl { order: 2; flex: 1 0 100%; margin-left: 0; }
  .g3-mfoot .g3-hint { display: none; }
}

/* ---------- kosketuslaite (.g3-touch): peukalot eivät saa peittää hahmoa ja maisemaa ----------
 * Vasen sarake kortin alla: tilasirut ja mittarit (mittarit vain kun jokin on matala; kortin napautus näyttää kaikki 6 s).
 * Pikapaikat tiivistetään yhteen nappiin alakeskelle (sormien väliin); tiedotteet sen yläpuolelle. Hahmo nostetaan kuvassa ylös
 * linssisiirrolla (game.js, --g3-cy = ristin korkeus). */
.g3-ch { top: var(--g3-cy, 50%); }
.g3-touch .g3-card { pointer-events: auto; cursor: pointer; }
.g3-touch .g3-prompt { top: calc(var(--g3-cy, 50%) + 118px); }
.g3-touch .g3-bl {
  left: calc(10px + var(--g3-sa-l)); top: calc(92px + var(--g3-sa-t)); bottom: auto; right: auto;
  width: auto; max-width: 46vw; align-items: flex-start; gap: 5px;
}
.g3-touch .g3-toasts {
  position: fixed; left: 50%; right: auto; top: auto; bottom: calc(76px + var(--g3-sa-b)); margin: 0; transform: translateX(-50%);
  width: min(270px, 70vw); align-items: stretch;
}
.g3-touch .g3-status { flex-direction: column; flex-wrap: nowrap; align-items: flex-start; gap: 4px; }
.g3-touch .g3-stats {
  display: flex; flex-direction: column; gap: 5px; width: 64px; padding: 6px 7px 5px; opacity: .9;
}
.g3-touch .g3-stats.calm:not(.peek) { display: none; }
.g3-touch .g3-stats:not(.peek) .g3-st:not(.low):not(.crit) { display: none; }
.g3-touch .g3-stats:not(.peek) .g3-weight { display: none; }
.g3-touch .g3-stats.peek { width: 132px; }
.g3-touch .g3-st { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 5px; align-items: center; }
.g3-touch .g3-stats.peek .g3-st { grid-template-columns: 14px minmax(0, 1fr) 22px; }
.g3-touch .g3-st .nm { display: none; }
.g3-touch .g3-st .v { display: none; }
.g3-touch .g3-stats.peek .g3-st .v { display: block; }
.g3-touch .g3-st .ic { font-size: 12px; }
.g3-touch .g3-weight { font-size: 10.5px; padding-top: 0; }
.g3-touch .g3-hb {
  left: 50%; bottom: calc(10px + var(--g3-sa-b)); display: block; padding: 0; gap: 0;
  background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none;
}
.g3-touch .g3-hb .g3-slot { display: none; }
.g3-touch .g3-hb .g3-slot.sel { display: grid; width: 54px; height: 54px; opacity: .92; }
.g3-touch .g3-hb.open {
  display: grid; grid-template-columns: repeat(5, 46px); gap: 6px; padding: 6px;
  background: var(--g3-bg-strong); border: 1px solid var(--g3-line-2); border-radius: 14px;
}
.g3-touch .g3-hb.open .g3-slot { display: grid; width: 46px; height: 46px; }
@media (max-width: 519px) {
  .g3-touch .g3-stats { display: flex; grid-template-columns: none; }
  .g3-touch .g3-tl { max-width: min(210px, 56vw); }
}
@media (max-height: 500px) and (orientation: landscape) {
  .g3-touch .g3-prompt { top: calc(var(--g3-cy, 50%) + 70px); }
  .g3-touch .g3-bl { top: calc(72px + var(--g3-sa-t)); }
  .g3-touch .g3-toasts { bottom: calc(70px + var(--g3-sa-b)); width: 250px; }
  .g3-touch .g3-hb.open { grid-template-columns: repeat(10, 44px); gap: 4px; }
  .g3-touch .g3-hb.open .g3-slot { width: 44px; height: 44px; }
}

/* ---------- ajoneuvon mittari vasemmassa reunassa (G3.Atv: body.g3-vhud, kun ⛽-mittari ja nopeus näkyvät; veneen akku ja napit: body.g3-bhud) ----------
 * Mittari on enintään 150 px leveä (vasemmalla 12 px, pystysuunnassa keskellä kuten veneen akku ja napit). Sen näkyessä tiedotteet ja
 * kuitattava ilmoituskortti siirtyvät mittarin oikealle puolelle (keskitettyinä jäljelle jäävään tilaan), joten ne eivät peitä mittaria
 * puhelimen pysty- eikä vaakanäkymässä. */
.g3-vhud .g3-toasts, .g3-bhud .g3-toasts { left: 160px; max-width: calc(100vw - 182px); }
.g3-vhud .g3-touch .g3-toasts, .g3-bhud .g3-touch .g3-toasts {
  left: calc(172px + var(--g3-sa-l)); right: calc(10px + var(--g3-sa-r)); width: auto; max-width: 270px; margin: 0 auto; transform: none;
  bottom: calc(158px + var(--g3-sa-b));          /* toimintonappien (Toimi, Juoksu, Hyppää, Lisä) yläpuolelle */
}
.g3-vhud .g3-touch .g3-notice, .g3-bhud .g3-touch .g3-notice {
  left: calc(172px + var(--g3-sa-l)); right: calc(10px + var(--g3-sa-r)); width: auto; max-width: 460px; margin: 0 auto;
  transform: translateY(-8px);
}
.g3-vhud .g3-touch .g3-notice.on, .g3-bhud .g3-touch .g3-notice.on { transform: none; }
.g3-vhud .g3-touch .g3-notice.out, .g3-bhud .g3-touch .g3-notice.out { transform: translateY(-6px); }
@media (max-height: 500px) and (orientation: landscape) {
  .g3-vhud .g3-touch .g3-toasts, .g3-bhud .g3-touch .g3-toasts { max-width: 250px; bottom: calc(140px + var(--g3-sa-b)); }
  .g3-vhud .g3-touch .g3-notice, .g3-bhud .g3-touch .g3-notice { max-width: 440px; }
}

/* ---------- minikartta (HUD) ----------
 * Työpöytä: oikea alakulma (kapeammalla pikapaikkojen yläpuolella). Kosketuslaite ja kapea näyttö: oikea yläkulma painikerivin alla
 * (ei peukaloalueilla); kompassi kapenee viereltä. Moninpelin 💬 ja pelaajalista siirtyvät sen alle (css/mp3d.css). */
.g3-mm {
  --mm: 140px;
  position: absolute; right: calc(14px + var(--g3-sa-r)); bottom: calc(14px + var(--g3-sa-b));
  width: var(--mm); height: var(--mm); padding: 0; margin: 0;
  border-radius: 50%; overflow: hidden; cursor: pointer;
  pointer-events: auto;
  background: #0d1a24;
  border: 2px solid rgba(200, 225, 245, .55);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(0, 0, 0, .4);
  opacity: .94;
  -webkit-tap-highlight-color: transparent;
}
.g3-mm:hover { border-color: var(--g3-accent); opacity: 1; }
.g3-mm:focus-visible { outline: 2px solid var(--g3-accent); outline-offset: 2px; }
.g3-mm-cv { display: block; width: 100%; height: 100%; border-radius: 50%; pointer-events: none; }
@media (max-width: 999px) { .g3-mm { --mm: 120px; bottom: calc(92px + var(--g3-sa-b)); } }
@media (max-height: 560px) { .g3-mm { --mm: 104px; } }
.g3-touch .g3-mm { --mm: 84px; top: calc(60px + var(--g3-sa-t)); bottom: auto; right: calc(10px + var(--g3-sa-r)); }
@media (max-width: 519px) {          /* 👁 on painikerivin alla (y 60–104): minikartta sen alle */
  .g3-root .g3-mm { --mm: 84px; top: calc(112px + var(--g3-sa-t)); bottom: auto; right: calc(10px + var(--g3-sa-r)); }
  .g3-mm-on .g3-cmp { width: 186px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .g3-touch .g3-mm { --mm: 80px; top: calc(56px + var(--g3-sa-t)); right: calc(8px + var(--g3-sa-r)); }
}
.g3-mm-tg.on { border-color: var(--g3-accent); color: var(--g3-accent); }

@media (prefers-reduced-motion: reduce) {
  .g3-root *, .g3-root *::before, .g3-root *::after { animation: none !important; transition: none !important; }
}

/* Ensimmäisessä persoonassa käynnissä olevan työn kortti ruudun yläosaan (kädet ja työ näkyvät keskellä) */
.g3-prompt.g3-fptop,
.g3-touch .g3-prompt.g3-fptop { top: calc(64px + var(--g3-sa-t, 0px)); }
@media (max-width: 519px) {
  .g3-touch .g3-prompt.g3-fptop { top: calc(118px + var(--g3-sa-t, 0px)); }
}

/* ---------- kuitattava ilmoituskortti (UI.notice): kuskin puhe, aloitusvinkit – pysyy kunnes kuitataan ----------
 * Yläosassa keskellä (kompassin kohdalla); puhelimessa leveänä kortin alla, peukaloalueet (alaosa) jäävät vapaiksi. */
.g3-notice {
  position: absolute; left: 50%; top: calc(58px + var(--g3-sa-t)); z-index: 4;
  width: min(460px, calc(100vw - 24px));
  padding: 11px 14px 11px 15px;
  border-radius: 14px;
  background: rgba(10, 18, 28, .93);
  border: 1px solid var(--g3-line-2);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .42), inset 3px 0 0 var(--c);
  pointer-events: auto; cursor: pointer;
  opacity: 0; transform: translate(-50%, -8px);
  transition: opacity .2s ease, transform .2s ease;
  --c: var(--g3-accent);
}
.g3-notice.on { opacity: 1; transform: translate(-50%, 0); }
.g3-notice.out { opacity: 0; transform: translate(-50%, -6px); }
.g3-notice.good { --c: var(--g3-good); }
.g3-notice.warn { --c: var(--g3-warn); }
.g3-notice.bad { --c: var(--g3-bad); }
.g3-ntc-h { display: flex; align-items: center; gap: 7px; font-size: 13px; line-height: 18px; color: var(--c); letter-spacing: .02em; }
.g3-ntc-ic { font-size: 16px; }
.g3-ntc-who { font-weight: 700; }
.g3-ntc-n { margin-left: auto; padding: 0 7px; border-radius: 999px; font-size: 11.5px; font-weight: 650; color: var(--g3-muted); background: rgba(255, 255, 255, .07); }
.g3-ntc-n:empty { display: none; }
.g3-ntc-t { margin: 5px 0 9px; font-size: 15px; line-height: 1.42; color: var(--g3-text); overflow-wrap: anywhere; max-height: 42vh; overflow-y: auto; }
.g3-ntc-f { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.g3-ntc-k { font-size: 12px; color: var(--g3-dim); }
.g3-ntc-ok {
  min-height: 44px; min-width: 104px; padding: 0 18px;
  border: 0; border-radius: 11px; cursor: pointer;
  background: var(--g3-accent); color: #1d1206; font-weight: 750; font-size: 15px;
}
.g3-ntc-ok:hover { background: #ffc06a; }
.g3-touch .g3-ntc-k { display: none; }
@media (max-width: 519px) {
  .g3-notice { top: calc(100px + var(--g3-sa-t)); width: calc(100vw - 20px); padding: 10px 12px 10px 13px; }
  .g3-ntc-t { font-size: 14px; line-height: 1.38; max-height: 34vh; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .g3-notice { top: calc(52px + var(--g3-sa-t)); width: min(440px, 58vw); }
  .g3-ntc-t { font-size: 14px; max-height: 38vh; }
}

/* muistiinpanot (taukovalikko) */
.g3-notes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; max-height: 52vh; overflow-y: auto; }
.g3-note { padding: 9px 12px; border-radius: 10px; background: rgba(255, 255, 255, .045); border: 1px solid var(--g3-line); }
.g3-note-h { font-size: 12px; font-weight: 650; color: var(--g3-accent); margin-bottom: 3px; }
.g3-note-t { font-size: 14px; line-height: 1.4; }

/* ---------- aloituskyyti (G3.Intro): HUD piiloon, ohituspainike ja kuvateksti ---------- */
.g3-intro-on .g3-hb, .g3-intro-on .g3-ch, .g3-intro-on .g3-prompt, .g3-intro-on .g3-bl, .g3-intro-on .g3-cmp, .g3-intro-on .g3-tr { display: none !important; }
.g3-intro-on .g3in .g3in-b, .g3-intro-on .g3in .g3in-stick, .g3-intro-on .g3in .g3in-prompt { display: none !important; }
.g3-intro { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.g3-intro::before {      /* elokuvamainen tummennus ylä- ja alareunaan */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 120px;
  background: linear-gradient(to top, rgba(4, 8, 14, .55), rgba(4, 8, 14, 0));
}
.g3-intro-cap {
  position: absolute; left: calc(16px + var(--g3-sa-l)); bottom: calc(18px + var(--g3-sa-b));
  max-width: calc(100vw - 180px);
  display: flex; flex-direction: column; gap: 2px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .7);
}
.g3-intro-cap b { font-size: 16px; font-weight: 700; letter-spacing: .02em; }
.g3-intro-cap small { font-size: 12.5px; color: #d6e2ec; }
.g3-intro-skip {
  position: absolute; right: calc(16px + var(--g3-sa-r)); bottom: calc(16px + var(--g3-sa-b));
  min-height: 48px; min-width: 112px; padding: 0 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 12px; border: 1px solid var(--g3-line-2);
  background: rgba(10, 18, 28, .82); color: var(--g3-text);
  font-size: 15px; font-weight: 700; cursor: pointer; pointer-events: auto;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}
.g3-intro-skip:hover { border-color: var(--g3-accent); }
.g3-intro-skip kbd { font: 600 11px/1 var(--g3-sans); padding: 3px 5px; border-radius: 5px; border: 1px solid var(--g3-line-2); color: var(--g3-muted); }
.g3-touch .g3-intro-skip kbd { display: none; }

/* Uupumus (Sim.fatigueStage): sumea, haalistunut kuva ja nuokahdukset (silmät painuvat hetkeksi kiinni) */
html[data-g3tired="1"] canvas { filter: saturate(0.85); }
html[data-g3tired="2"] canvas { filter: blur(0.8px) saturate(0.7) brightness(0.92); }
html::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 40;
  background: radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0.96) 75%);
  opacity: 0; transition: opacity .45s ease-in;
}
html[data-g3nod="1"]::after { opacity: 1; transition: opacity .35s ease-out; }
/* nukkuminen: kellonaika ja aika aamuun selkeästi – kortti unen tummennuksen (g3-fade) PÄÄLLÄ, keskellä ruutua */
.g3-prompt.g3-big { z-index: 3; top: 40%; padding: 14px 22px 14px; max-width: min(92vw, 440px); gap: 6px; }
.g3-prompt.g3-big .g3-ptxt { font-size: 30px; font-weight: 700; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.g3-prompt.g3-big .g3-psub { font-size: 16px; color: var(--g3-text, #f4f8fc); font-variant-numeric: tabular-nums; }
.g3-prompt.g3-big .g3-pbar { width: 200px; height: 4px; }

/* ---------- riistakameran kuvagalleria (UI.gallery, G3.TrailCam) ---------- */
.g3-gal { max-width: 720px; }
.g3-gal-body { display: flex; flex-direction: column; gap: 8px; }
.g3-gal-frame { position: relative; flex: 0 0 auto; width: 100%; max-width: calc((100vh - 250px) * 16 / 9); margin: 0 auto; aspect-ratio: 16 / 9; background: #050607; border-radius: 8px; overflow: hidden; border: 1px solid var(--g3-line); }
.g3-gal-img { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: auto; }
.g3-gal-frame.ir { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.g3-gal-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--g3-muted); font-size: 13px; }
.g3-gal-cap { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; }
.g3-gal-n { color: var(--g3-muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.g3-gal-nav { display: flex; align-items: center; gap: 8px; }
.g3-gal-dots { flex: 1 1 auto; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-width: 0; }
.g3-gal-dot { width: 10px; height: 10px; padding: 0; border-radius: 50%; border: 1px solid var(--g3-line-2); background: rgba(255, 255, 255, .08); cursor: pointer; }
.g3-gal-dot.new { border-color: var(--g3-accent); }
.g3-gal-dot.on { background: var(--g3-accent); border-color: var(--g3-accent); }
@media (max-width: 520px) { .g3-gal-nav .g3-btn { padding: 8px 10px; } .g3-gal-dot { width: 8px; height: 8px; } }
.g3-touch .g3-prompt.g3-big, .g3-prompt.g3-big.g3-fptop, .g3-touch .g3-prompt.g3-big.g3-fptop { top: 40%; }
