/* Lagolandia Console – original blocky pixel theme. Textures are generated in app.js. */
:root {
  --sky-top: #6fb3ff;
  --sky-bottom: #bfe3ff;
  --panel: #c6c6c6;
  --panel-dark: #8b8b8b;
  --hi: #ffffff;
  --lo: #555555;
  --ink: #2b2b2b;
  --ink-dim: #4f4f4f;
  --green: #5fbf3a;
  --green-dark: #3a7d21;
  --gold: #fcd34d;
  --red: #c0392b;
  --btn: #7a7a7a;
  --btn-hi: #a8a8a8;
  --btn-lo: #3f3f3f;
  --btn-hover: #7e8fc4;
  --text-on-btn: #ffffff;
  --px: 4px;
  --font-title: "Press Start 2P", ui-monospace, monospace;
  --font-body: "VT323", ui-monospace, monospace;
  --tex-dirt: none;
  --tex-grass-top: none;
  --tex-grass-side: none;
  --tex-stone: none;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sky-top: #0b1030;
    --sky-bottom: #273a6b;
    --panel: #a9a9a9;
  }
  .sun { background: #f4f1de !important; box-shadow: 0 0 0 var(--px) #d9d4b8 !important; }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 22px;
  line-height: 1.15;
  color: var(--ink);
  background: linear-gradient(var(--sky-top), var(--sky-bottom)) fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  image-rendering: pixelated;
}
[hidden] { display: none !important; }

/* ---------- sky ---------- */
.sky { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.sun {
  position: absolute; top: 40px; right: 8%; width: 64px; height: 64px;
  background: #ffe066; box-shadow: 0 0 0 var(--px) #ffd23f;
}
.cloud {
  position: absolute; height: 24px; background: #fff; opacity: .9;
  box-shadow: 24px -16px 0 0 #fff, 48px 0 0 0 #fff;
  animation: drift linear infinite;
}
.c1 { top: 70px; width: 96px; animation-duration: 90s; }
.c2 { top: 150px; width: 64px; animation-duration: 130s; animation-delay: -60s; }
.c3 { top: 230px; width: 120px; animation-duration: 160s; animation-delay: -110s; }
@keyframes drift { from { left: -200px; } to { left: 110%; } }
@media (prefers-color-scheme: dark) { .cloud { opacity: .15; } }

/* ---------- header ---------- */
.top {
  position: relative; z-index: 1;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; padding: 20px 16px 8px; max-width: 980px; width: 100%; margin: 0 auto;
}
.logo { margin: 0; display: flex; flex-direction: column; }
.logo-main {
  font-family: var(--font-title); font-size: clamp(20px, 5vw, 34px); color: #f2f2f2;
  letter-spacing: 2px;
  text-shadow: 3px 3px 0 #3f3f3f, 6px 6px 0 rgba(0,0,0,.25);
}
.logo-sub { font-size: 22px; color: var(--gold); text-shadow: 2px 2px 0 #3f2f00; margin-top: 6px; }
.who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.who-name {
  font-family: var(--font-title); font-size: 12px; color: #fff; text-shadow: 2px 2px 0 #000;
  background: rgba(0,0,0,.35); padding: 8px 10px;
}

/* ---------- layout ---------- */
main {
  position: relative; z-index: 1; flex: 1;
  width: 100%; max-width: 980px; margin: 0 auto; padding: 8px 16px 40px;
}
#dashView {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  align-items: stretch; /* boxes in a row share the same height */
}
#dashView .status { grid-column: 1 / -1; }

/* ---------- panels: bevelled GUI boxes ---------- */
.panel {
  background: var(--panel);
  border: var(--px) solid #000;
  box-shadow: inset var(--px) var(--px) 0 var(--hi), inset calc(var(--px) * -1) calc(var(--px) * -1) 0 var(--lo);
  padding: 18px 20px;
}
.panel h2 {
  font-family: var(--font-title); font-size: 13px; line-height: 1.5; margin: 0 0 12px;
  color: #3f3f3f;
}
.small { font-size: 20px; margin: 6px 0; }
.dim { color: var(--ink-dim); }

/* ---------- login ---------- */
.login { max-width: 420px; margin: 24px auto; text-align: center; }
.login form { display: grid; gap: 6px; text-align: left; }
.login label { font-size: 22px; margin-top: 8px; }
.field {
  font: inherit; font-size: 24px; width: 100%; padding: 8px 10px;
  color: #fff; background: #000; border: var(--px) solid #a0a0a0;
  outline: none; border-radius: 0;
}
.field:focus { border-color: #fff; }
.login .btn-big { margin-top: 14px; }

/* ---------- buttons: stone ---------- */
.btn {
  font-family: var(--font-body); font-size: 26px; color: var(--text-on-btn);
  text-shadow: 2px 2px 0 #3f3f3f;
  background-color: var(--btn);
  background-image: var(--tex-stone); background-size: 64px 64px; background-blend-mode: multiply;
  border: var(--px) solid #000;
  box-shadow: inset var(--px) var(--px) 0 var(--btn-hi), inset calc(var(--px) * -1) calc(var(--px) * -1) 0 var(--btn-lo);
  padding: 8px 18px; cursor: pointer; border-radius: 0;
}
.btn:hover:not(:disabled), .btn:focus-visible {
  background-color: var(--btn-hover); outline: none; color: #ffffa0;
}
.btn:active:not(:disabled) { box-shadow: inset var(--px) var(--px) 0 var(--btn-lo); }
.btn:disabled { color: #a0a0a0; cursor: default; filter: grayscale(1) brightness(.8); }
.btn-big { width: 100%; font-size: 30px; padding: 12px 18px; }
.btn-small { font-size: 20px; padding: 4px 10px; }
.btn-start { background-color: #4c8f2c; max-width: 420px; }
.btn-start:hover:not(:disabled) { background-color: #62b33a; }

.msg { min-height: 1.2em; margin: 8px 0 0; color: var(--red); font-size: 22px; }
.msg.ok { color: var(--green-dark); }

/* ---------- grass block cube ---------- */
.cube-wrap { width: 120px; height: 120px; margin: 0 auto 14px; perspective: 600px; flex: none; }
.cube {
  --s: 72px;
  position: relative; width: var(--s); height: var(--s); margin: 24px auto;
  transform-style: preserve-3d; transform: rotateX(-30deg) rotateY(45deg);
}
.cube .f {
  position: absolute; inset: 0; background-size: 100% 100%; image-rendering: pixelated;
  backface-visibility: hidden;
}
.cube .top { background-image: var(--tex-grass-top); transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.cube .front { background-image: var(--tex-grass-side); transform: translateZ(calc(var(--s) / 2)); filter: brightness(.85); }
.cube .side { background-image: var(--tex-grass-side); transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); filter: brightness(.65); }
.cube.spin { animation: spin 2.4s linear infinite; }
.cube.bob { animation: bob 3s ease-in-out infinite; }
.cube.sleep { filter: grayscale(.85) brightness(.75); }
@keyframes spin { from { transform: rotateX(-30deg) rotateY(45deg); } to { transform: rotateX(-30deg) rotateY(405deg); } }
@keyframes bob {
  0%,100% { transform: rotateX(-30deg) rotateY(45deg) translateY(0); }
  50% { transform: rotateX(-30deg) rotateY(45deg) translateY(-8px); }
}
@media (prefers-reduced-motion: reduce) { .cube.spin, .cube.bob, .cloud { animation: none; } }

/* ---------- status ---------- */
.status { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; }
.status .cube-wrap { margin: 0; }
.status { align-items: flex-start; }
.status-body { flex: 1 1 260px; }
.phase { font-family: var(--font-title); font-size: clamp(16px, 4vw, 24px); line-height: 1.4; }
.phase.online { color: var(--green-dark); }
.phase.offline { color: #5a5a5a; }
.phase.busy { color: #9a6b00; }
.phase-text { margin: 6px 0 10px; }
.steps { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.steps li {
  font-size: 20px; padding: 4px 10px; background: var(--panel-dark); color: #e8e8e8;
  border: 2px solid #000;
}
.steps li.done { background: var(--green-dark); color: #fff; }
.steps li.now { background: #b88a1b; color: #fff; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .6; } }

/* ---------- start-up screen ---------- */
.cube-col { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.cube-wrap { position: relative; }
.cube-wrap.mineable { cursor: pointer; }
.cube-wrap.mineable:active .cube { transform: rotateX(-30deg) rotateY(45deg) scale(.94); }
.cube-wrap.hit .cube { animation: hit .12s steps(2) 1 !important; }
@keyframes hit { 50% { transform: rotateX(-30deg) rotateY(45deg) translate(3px, -2px); } }
.crack { position: absolute; inset: 22px 24px; pointer-events: none; opacity: 0; transition: opacity .1s steps(2);
  background:
    linear-gradient(35deg, transparent 47%, #000 47% 53%, transparent 53%) 30% 20% / 40% 40% no-repeat,
    linear-gradient(-50deg, transparent 46%, #000 46% 54%, transparent 54%) 70% 60% / 45% 45% no-repeat,
    linear-gradient(80deg, transparent 46%, #000 46% 54%, transparent 54%) 20% 80% / 35% 35% no-repeat,
    linear-gradient(10deg, transparent 46%, #000 46% 54%, transparent 54%) 75% 15% / 30% 30% no-repeat; }
.crack.c1 { opacity: .25; } .crack.c2 { opacity: .45; } .crack.c3 { opacity: .65; } .crack.c4 { opacity: .85; }
.cube-wrap.pop .cube { animation: pop .35s steps(4) 1 !important; }
@keyframes pop { 0% { opacity: 1; } 50% { opacity: 0; transform: rotateX(-30deg) rotateY(45deg) scale(.4); } 100% { opacity: 1; } }
.floater { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); font-family: var(--font-title); font-size: 12px;
  color: #fff; text-shadow: 2px 2px 0 #000; white-space: nowrap; animation: floatUp 1.2s ease-out forwards; pointer-events: none; }
.floater.diamond { color: #6ff3ff; font-size: 14px; }
@keyframes floatUp { to { transform: translate(-50%, -50px); opacity: 0; } }
.minigame { display: grid; gap: 2px; text-align: center; font-size: 18px; color: var(--ink-dim); max-width: 180px; }
.minigame b { color: var(--ink); font-weight: normal; }

.boot { margin: 4px 0 12px; }
.countdown { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.eta { font-family: var(--font-title); font-size: clamp(26px, 6vw, 40px); color: #2b2b2b; letter-spacing: 2px; }
.eta.late { color: #9a6b00; font-size: clamp(16px, 4vw, 22px); }
.boot-bar { height: 22px; margin: 8px 0 10px; }
.boot-bar .bar-fill { transition: width 1s linear; }
.stages { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.stages li { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center;
  padding: 3px 8px; border: 2px solid #000; background: var(--panel-dark); color: #e8e8e8; font-size: 22px; }
.stages li.done { background: var(--green-dark); color: #fff; }
.stages li.now { background: #b88a1b; color: #fff; }
.stages li.skip { display: none; }
.st-icon { font-family: var(--font-title); font-size: 12px; text-align: center; }
.stages li.now .st-icon { animation: blink 1s steps(2) infinite; }
.st-time { font-variant-numeric: tabular-nums; }
.tip { margin: 10px 0 0; padding: 6px 10px; background: rgba(0,0,0,.08); border-left: 4px solid var(--green-dark); min-height: 2.4em; font-size: 20px; }

/* ---------- join ---------- */
.address-row { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.address {
  flex: 1 1 200px; font-family: var(--font-body); font-size: 22px; color: #fff; background: #000;
  padding: 6px 10px; border: var(--px) solid #a0a0a0; overflow-wrap: anywhere;
}

/* ---------- players ---------- */
.count { color: var(--green-dark); }
.player-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.player-list li {
  display: flex; align-items: center; gap: 10px; background: #8b8b8b; color: #fff;
  text-shadow: 2px 2px 0 #3f3f3f; padding: 4px 8px; border: 2px solid #373737; font-size: 24px;
}
.player-list img, .player-list .head {
  width: 32px; height: 32px; image-rendering: pixelated; flex: none; background: #6b4a2b;
}
.player-list .head { display: grid; place-items: center; font-family: var(--font-title); font-size: 14px; }
.player-list .empty { background: none; color: var(--ink-dim); text-shadow: none; border: none; padding: 0; }

/* ---------- stats ---------- */
.stat + .stat { margin-top: 14px; }
.stat-head { display: flex; justify-content: space-between; font-size: 24px; }
.bar {
  height: 18px; background: #2a2a2a; border: 2px solid #000; margin-top: 4px; position: relative;
}
.bar::after { /* segment ticks */
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), #000 calc(10% - 2px) 10%);
}
.bar-fill { height: 100%; width: 0; transition: width .6s steps(10); }
.xp .bar-fill { background: linear-gradient(#b6f36b, #5fbf3a 60%, #3a7d21); }
.food .bar-fill { background: linear-gradient(#ffcf7a, #e08a1e 60%, #9c5a10); }
.bar-fill.hot { background: linear-gradient(#ff8a7a, #d23b2b 60%, #8d1f14) !important; }
.spark { width: 100%; height: 28px; margin-top: 4px; display: block; }
.spark polyline { fill: none; stroke: #3f3f3f; stroke-width: 1.5; vector-effect: non-scaling-stroke; }

/* ---------- activity log ---------- */
.event-list {
  list-style: none; padding: 0; margin: 0; font-size: 20px;
  max-height: 340px; overflow-y: auto; border-top: 2px solid var(--lo);
}
.event-list li {
  display: grid; grid-template-columns: 4.6em 1.4em 1fr; gap: 0 6px; align-items: baseline;
  padding: 3px 2px; border-bottom: 1px solid #a8a8a8;
}
.event-list li:nth-child(odd) { background: rgba(255,255,255,.18); }
.event-list time { color: var(--ink-dim); white-space: nowrap; font-size: 18px; }
.event-list .ico { text-align: center; }
.event-list .what { overflow-wrap: anywhere; }
.event-list b { font-weight: normal; color: #1d4f9a; }
.event-list .ev-start b, .event-list .ev-restart b { color: var(--green-dark); }
.event-list .ev-stop b { color: var(--red); }
.event-list code { font-family: var(--font-body); background: #2a2a2a; color: #ffd23f; padding: 0 4px; }
.event-list .day {
  display: block; grid-template-columns: none; background: none !important;
  color: var(--ink-dim); font-size: 18px; padding-top: 8px; border-bottom: 2px solid var(--lo);
}

/* ---------- highscore ---------- */
.podium { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.podium li {
  display: grid; grid-template-columns: 34px 32px 1fr auto; gap: 8px; align-items: center;
  background: #8b8b8b; border: 2px solid #373737; padding: 4px 8px; color: #fff;
  text-shadow: 2px 2px 0 #3f3f3f; font-size: 22px;
}
.podium .rank {
  font-family: var(--font-title); font-size: 14px; text-align: center; color: #fff;
  border: 2px solid #000; padding: 4px 0; background: #5a5a5a;
}
.podium li:nth-child(1) .rank { background: #d4a514; }
.podium li:nth-child(2) .rank { background: #a8b0b8; }
.podium li:nth-child(3) .rank { background: #b06b2c; }
.podium li:nth-child(1) { background: #6d6234; }
.podium img, .podium .head { width: 32px; height: 32px; image-rendering: pixelated; background: #6b4a2b; display: grid; place-items: center; font-family: var(--font-title); font-size: 14px; }
.podium .time { font-size: 20px; }
.podium li.empty { display: block; background: none; border: none; color: var(--ink-dim); text-shadow: none; padding: 0; }

/* ---------- sponsor ---------- */
.sponsor { margin: 10px 0 4px; font-size: 22px; color: #127a3a; }

/* ---------- ops controls ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-danger { background-color: #9b2c22; }
.btn-danger:hover:not(:disabled) { background-color: #c0392b; color: #fff; }
.log-head { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; }
.log-head h2 { margin-bottom: 6px; }
.logview { height: 320px; font-size: 18px; line-height: 1.15; }

/* ---------- role badge ---------- */
.role-badge {
  font-family: var(--font-title); font-size: 10px; color: #fff; background: #7b2fbe;
  border: 2px solid #000; padding: 4px 6px; text-shadow: 1px 1px 0 #000; vertical-align: middle;
}
#pwCancel { margin-top: 8px; justify-self: start; }

/* ---------- big numbers ---------- */
.big-stats { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 10px; }
.big-stats > div { display: flex; flex-direction: column; }
.big { font-family: var(--font-title); font-size: 20px; line-height: 1.5; color: #2b2b2b; }
.big.emerald { color: #127a3a; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 20px; }
.table th { text-align: left; font-weight: normal; color: var(--ink-dim); border-bottom: 2px solid var(--lo); padding: 2px 6px 2px 0; }
.table td { padding: 3px 6px 3px 0; border-bottom: 1px solid #a8a8a8; vertical-align: middle; overflow-wrap: anywhere; }
.table td.num, .table th.num { white-space: nowrap; }
#playtimeTable td:first-child { overflow-wrap: normal; word-break: keep-all; }
.table td.num, .table th.num { text-align: right; }
.table .btn-small { font-size: 18px; padding: 2px 8px; }
.pill { font-size: 18px; padding: 0 6px; border: 2px solid #000; color: #fff; white-space: nowrap; }
.pill.ok { background: var(--green-dark); }
.pill.wait { background: #9a6b00; }

/* ---------- mods ---------- */
.mod-list {
  list-style: none; padding: 0; margin: 0; display: grid; gap: 6px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}
.mod-list li { background: #b4b4b4; border: 2px solid #8b8b8b; padding: 3px 8px; font-size: 20px; }
.mod-list .ver { color: var(--ink-dim); margin-left: 6px; }
.mod-list .desc { display: block; font-size: 18px; color: var(--ink-dim); }
.mod-list .client { font-size: 16px; color: #fff; background: #5a5a5a; padding: 0 4px; margin-left: 6px; }

/* ---------- world map ---------- */
.map-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.map-head h2 { margin-right: auto; }
.btn-small[href] { text-decoration: none; display: inline-block; }
#mapFrame {
  display: block; width: 100%; height: min(70vh, 560px); border: var(--px) solid #000;
  background: #000; margin-top: 8px;
}

/* ---------- ops ---------- */
#dashView .wide { grid-column: 1 / -1; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.terminal {
  background: #000; color: #e0e0e0; font-family: var(--font-body); font-size: 20px;
  border: var(--px) solid #a0a0a0; padding: 8px 10px; margin: 0 0 8px;
  height: 220px; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere;
}
.terminal .cmd { color: #ffd23f; }
.terminal .err { color: #ff7b6b; }
.rcon-form { display: flex; gap: 6px; align-items: stretch; }
#rconCard.not-ready .terminal, #rconCard.not-ready .rcon-form { opacity: .55; }
.rcon-form .prompt { font-family: var(--font-title); font-size: 16px; align-self: center; }
.rcon-form .field { flex: 1; min-width: 0; font-size: 22px; padding: 4px 8px; }

/* ---------- ground ---------- */
.ground {
  position: relative; z-index: 1; height: 96px; margin-top: auto;
  background-image: var(--tex-grass-side), var(--tex-dirt);
  background-size: 48px 48px, 48px 48px;
  background-repeat: repeat-x, repeat;
  background-position: 0 0, 0 48px;
  border-top: 2px solid #2f5f1a;
}

@media (max-width: 480px) {
  body { font-size: 20px; }
  .panel { padding: 14px; }
  .cube-wrap { width: 96px; height: 96px; }
  .cube { --s: 56px; margin: 20px auto; }
}
