/* GeoDadi pubblico — tema "sala operativa" */
:root {
  --bg: #05080f;
  --panel: rgba(9, 16, 28, 0.78);
  --panel-line: rgba(120, 190, 255, 0.16);
  --text: #d8e6f5;
  --muted: #7d93ab;
  --accent: #5fd4ff;
  --atk: #ff9a52;
  --def: #4fdfe6;
  --win: #ffd36b;
  --hover: #bfe7ff;
  --danger: #ff6b6b;
  --map-bg: #04070d;
  --map-sea: #07101d;
  --map-grid: rgba(95, 212, 255, 0.07);
  --map-void: #0c1420;
  --map-inner: rgba(150, 200, 255, 0.10);
  --map-coast: rgba(95, 212, 255, 0.30);
  --map-border: rgba(190, 230, 255, 0.55);
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Roboto Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 10px;
  --gut: 16px;
  color-scheme: dark;
}
/* la sala operativa resta scura anche col tema chiaro del sistema: è parte dello stile */
:root[data-theme="light"] { color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 14px/1.4 var(--sans); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
.mono { font-family: var(--mono); letter-spacing: 0.02em; }
.hidden { display: none !important; }

#map { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#map:active { cursor: grabbing; }

/* ---------- barra in alto ---------- */
.top { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 18px; padding: 12px var(--gut); pointer-events: none;
  background: linear-gradient(to bottom, rgba(4, 7, 13, 0.92), rgba(4, 7, 13, 0)); }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font: 700 15px/1 var(--mono); letter-spacing: 0.32em; text-transform: uppercase; white-space: nowrap; color: var(--accent); text-shadow: 0 0 12px rgba(95, 212, 255, 0.45); }
.live { display: inline-flex; align-items: center; gap: 6px; font: 600 11px/1 var(--mono); letter-spacing: 0.12em; color: var(--muted); border: 1px solid var(--panel-line); padding: 4px 8px; border-radius: 99px; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.live.on { color: var(--danger); border-color: rgba(255, 107, 107, 0.4); }
.live.on i { background: var(--danger); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.meta { color: var(--muted); font-size: 12px; }
.next { margin-left: auto; color: var(--muted); font-size: 12px; opacity: 0.85; }
.next b { color: var(--text); font-weight: 500; }

/* ---------- pannelli ---------- */
.panel { position: fixed; background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--r); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.ph { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px 7px; font: 600 11px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--panel-line); }
.lnk { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 4px; font-size: 14px; }

.board { top: 58px; right: var(--gut); width: 260px; }
.board ol { list-style: none; margin: 0; padding: 6px 0; }
.board li { display: grid; grid-template-columns: 16px 30px 1fr auto; align-items: center; gap: 8px; padding: 5px 12px; }
.board li .n { color: var(--muted); font: 11px var(--mono); }
.board li .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.board li .v { font: 12px var(--mono); color: var(--muted); }
.board li .bar { grid-column: 3 / 5; height: 2px; background: rgba(255, 255, 255, 0.06); border-radius: 2px; margin-top: -2px; }
.board li .bar i { display: block; height: 100%; border-radius: 2px; }
.flag { width: 30px; height: 20px; border-radius: 2px; object-fit: cover; background: #1a2433; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12); }

.feed { left: var(--gut); bottom: 70px; width: 320px; max-height: 34vh; display: flex; flex-direction: column; }
.feed ul { list-style: none; margin: 0; padding: 6px 0; overflow-y: auto; font-size: 12px; }
.feed li { padding: 4px 12px; color: var(--muted); display: grid; grid-template-columns: 34px 1fr; gap: 6px; }
.feed li b { color: var(--text); font-weight: 500; }
.feed li .r { color: rgba(125, 147, 171, 0.6); }
.feed li.ev { color: var(--win); }
.feed.collapsed ul { display: none; }

/* ---------- scontro ---------- */
.fight { position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%); width: min(720px, calc(100% - 2 * var(--gut))); display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.why { align-self: center; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 99px; padding: 6px 14px; font-size: 12px; color: var(--text); }
.why::before { content: "MOTIVO · "; color: var(--accent); }
.duel { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: stretch; }
.card { background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--r); padding: 10px 12px; display: grid; grid-template-columns: 54px 1fr; gap: 4px 10px; align-items: center; min-height: 72px; border-top: 2px solid; }
.card.atk { border-top-color: var(--atk); }
.card.def { border-top-color: var(--def); }
.card .flag { width: 54px; height: 36px; grid-row: span 2; }
.card .nm { font-weight: 600; font-size: 14px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card .st { font: 11px var(--mono); color: var(--muted); }
.card .role { grid-column: 1 / 3; font: 600 10px/1 var(--mono); letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; }
.card.win { box-shadow: 0 0 0 1px var(--win), 0 0 24px rgba(255, 211, 107, 0.18); }
.card.lose { opacity: 0.55; }
.dice { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--r); padding: 8px 12px; min-width: 150px; }
.drow { display: flex; gap: 6px; }
.die { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; font: 700 14px var(--mono); background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.14); transition: transform 0.2s; }
.drow.a .die { color: var(--atk); }
.drow.d .die { color: var(--def); }
.die.w { background: rgba(255, 211, 107, 0.14); border-color: var(--win); }
.die.roll { transform: rotate(18deg) scale(0.9); opacity: 0.6; }
.score { font-size: 13px; color: var(--muted); }
.score b { color: var(--text); }
.result { align-self: center; background: var(--panel); border: 1px solid var(--win); color: var(--text); border-radius: 99px; padding: 7px 16px; font-size: 13px; }
.result b { color: var(--win); }

/* ---------- notizie ---------- */
.news { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); width: min(560px, calc(100% - 2 * var(--gut))); background: var(--panel); border: 1px solid var(--panel-line); border-left: 3px solid var(--win); border-radius: var(--r); padding: 10px 14px; animation: drop 0.35s ease-out; }
.news .nk { font-size: 10px; letter-spacing: 0.16em; color: var(--win); text-transform: uppercase; }
.news .nt { font-size: 14px; margin-top: 2px; }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -8px); } }

/* ---------- controlli ---------- */
.ctrl { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 99px; padding: 5px 8px; width: min(420px, calc(100% - 2 * var(--gut))); }
.ctrl button { background: none; border: 0; cursor: pointer; padding: 6px 10px; border-radius: 99px; color: var(--text); min-width: 36px; }
.ctrl button:hover, .ctrl button:focus-visible { background: rgba(95, 212, 255, 0.12); outline: none; }
.prog { flex: 1; height: 4px; background: rgba(255, 255, 255, 0.08); border-radius: 4px; overflow: hidden; }
.prog div { height: 100%; width: 0; background: var(--accent); box-shadow: 0 0 8px var(--accent); transition: width 0.4s; }

/* ---------- tooltip ---------- */
.tip { position: fixed; z-index: 5; pointer-events: none; background: rgba(6, 11, 20, 0.94); border: 1px solid var(--panel-line); border-radius: 8px; padding: 8px 10px; display: grid; grid-template-columns: 36px 1fr; gap: 2px 10px; align-items: center; max-width: 280px; }
.tip .flag { width: 36px; height: 24px; grid-row: span 2; }
.tip .nm { font-weight: 600; font-size: 13px; }
.tip .st { font: 11px var(--mono); color: var(--muted); }

/* ---------- schermate ---------- */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; padding: var(--gut); background: radial-gradient(ellipse at center, rgba(4, 7, 13, 0.55), rgba(4, 7, 13, 0.92)); z-index: 10; }
.box { width: min(560px, 100%); background: var(--panel); border: 1px solid var(--panel-line); border-radius: 14px; padding: 26px 26px 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.box .k { font-size: 11px; letter-spacing: 0.18em; color: var(--accent); }
.box h1 { font-size: clamp(22px, 4vw, 30px); line-height: 1.15; margin: 10px 0 10px; font-weight: 650; }
.box h2 { font-size: 22px; margin: 8px 0 14px; }
.box h3 { font: 600 11px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.box p { color: var(--muted); margin: 0 0 18px; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.btns button { cursor: pointer; border: 1px solid var(--panel-line); background: rgba(255, 255, 255, 0.04); border-radius: 8px; padding: 10px 16px; }
.btns button.primary { background: var(--accent); color: #031019; border-color: var(--accent); font-weight: 600; }
.btns button:disabled { opacity: 0.4; cursor: default; }
.btns button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cols ol, .cols ul { margin: 0; padding-left: 18px; font-size: 13px; }
.cols li { margin: 3px 0; }
.cols li .d { color: var(--win); font: 11px var(--mono); }

/* ---------- telefono ---------- */
@media (max-width: 760px) {
  .top { flex-wrap: wrap; gap: 6px 12px; padding: 10px var(--gut); }
  .meta { order: 3; width: 100%; font-size: 11px; }
  .board { top: auto; bottom: 64px; right: var(--gut); left: var(--gut); width: auto; max-height: 30vh; overflow: auto; }
  body.playing .board { display: none; }
  .feed { display: none; }
  .fight { bottom: 64px; }
  .duel { grid-template-columns: 1fr 1fr; }
  .dice { grid-column: 1 / 3; grid-row: 2; flex-direction: row; min-width: 0; }
  .card { grid-template-columns: 40px 1fr; padding: 8px; min-height: 0; }
  .card .flag { width: 40px; height: 27px; }
  .card .nm { font-size: 13px; }
  .cols { grid-template-columns: 1fr; }
  .news { top: 84px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
