/* mcforever.world site styles.
   Colors are taken from the penguin logo; change them all in :root below.

   Monocraft: a free (SIL Open Font License) font styled after Minecraft's in-game text.
   License: fonts/Monocraft-LICENSE.txt */
@font-face {
  font-family: "Monocraft";
  src: url("fonts/monocraft-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #0b0f17;           /* page background (the logo's night sky) */
  --panel: rgba(12, 18, 29, 0.93);
  --panel-2: #152131;
  --line: rgba(255, 255, 255, 0.09);
  --text: #e9eef4;
  --muted: #9db0c4;
  --navy: #2c5478;         /* penguin */
  --ocean: #49b6c3;        /* the globe's water */
  --grass: #8bc34a;        /* the continents */
  --grass-dark: #5f9a2e;
  --beak: #f3af4f;         /* beak and feet */
  --off: #e5675c;
  --bar-h: 60px;
  --radius: 12px;
  --pixel: "Monocraft", ui-monospace, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }
body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--ocean); }
:focus-visible { outline: 2px solid var(--beak); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--pixel); font-weight: 400; margin: 0; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }

/* ---------- Top bar ---------- */
.bar {
  position: relative;
  z-index: 5;
  flex: none;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
  background: linear-gradient(#111a28, #0c121c);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); text-decoration: none; }
.brand img { width: 40px; height: 40px; border-radius: 9px; box-shadow: 0 0 0 1px var(--line); }
.brand-name { font-family: var(--pixel); font-weight: 400; font-size: 19px; white-space: nowrap; }

.status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel-2); color: var(--text);
  font: 600 14px/1 system-ui, sans-serif;
  cursor: pointer;
}
.status:hover { background: #1c2a3d; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.status.is-on .dot { background: var(--grass); box-shadow: 0 0 0 3px rgba(139, 195, 74, 0.25); }
.status.is-off .dot { background: var(--off); }

.actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel-2); color: var(--text);
  font: 600 15px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #1d2a3d; }
.btn.primary {
  background: var(--grass); border-color: var(--grass-dark); color: #12240a;
  box-shadow: inset 0 -3px 0 var(--grass-dark);
}
.btn.primary:hover { background: #9bd15a; }
.btn.small { padding: 7px 11px; font-size: 14px; }
.btn.wide { width: 100%; margin-top: 18px; }
.btn.is-active { border-color: var(--ocean); box-shadow: inset 0 0 0 1px var(--ocean); }
.btn.is-soon { opacity: 0.55; }
.btn.primary.is-active { box-shadow: inset 0 -3px 0 var(--grass-dark), 0 0 0 2px var(--ocean); }

/* ---------- Map area ---------- */
.stage { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #05070b; }

.map-down {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 24px; text-align: center;
  background: radial-gradient(circle at 50% 40%, #13213a, var(--bg) 70%);
}
.map-down img { border-radius: 16px; opacity: 0.9; }
.map-down p { max-width: 440px; color: var(--muted); margin: 0; }

/* ---------- Floating cards ---------- */
.welcome, .drawer {
  background: var(--panel);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}

.welcome {
  position: absolute; z-index: 3;
  left: 14px; bottom: 14px;
  width: min(380px, calc(100% - 28px));
  padding: 18px;
  display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; align-items: center;
}
.welcome-logo { width: 72px; height: 72px; border-radius: 14px; }
.welcome h1 { font-size: 24px; }
.tagline { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.welcome .addr, .welcome-actions { grid-column: 1 / -1; }
.welcome-actions { display: flex; gap: 8px; }
.welcome-actions .btn { flex: 1; }

.x {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--muted);
  font-size: 22px; line-height: 1; cursor: pointer;
}
.x:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }

.addr {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 8px 8px 12px;
  background: #0a111b; border: 1px solid var(--line); border-radius: 9px;
}
.addr code { font-size: 15px; color: var(--grass); overflow-wrap: anywhere; }

/* ---------- Side panel ---------- */
.drawer {
  position: absolute; z-index: 4;
  top: 14px; right: 14px; bottom: 14px;
  width: min(390px, calc(100% - 28px));
  display: flex; flex-direction: column;
}
.drawer-head { position: relative; padding: 16px 48px 12px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 22px; }
.drawer-body { overflow-y: auto; padding: 16px 18px 20px; }

.label { margin: 0 0 6px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; }
.meta { margin: 8px 0 16px; color: var(--muted); font-size: 14px; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 12px; }
.steps li::marker { font-family: var(--pixel); color: var(--beak); }
.steps ul { margin: 6px 0 0; padding-left: 18px; }
.notes { margin: 16px 0 0; padding: 12px 14px 12px 30px; background: var(--panel-2); border-radius: 9px; color: var(--muted); font-size: 14px; }
.notes:empty { display: none; }
.soon { color: var(--muted); margin: 4px 0 0; }

.rules { margin: 0; padding-left: 24px; display: grid; gap: 10px; }
.rules li::marker { font-family: var(--pixel); color: var(--beak); }
.rules strong { display: block; }

.build {
  padding: 14px;
  margin-bottom: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.build h3 { font-size: 18px; }
.build .by { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.build p { margin: 8px 0 0; font-size: 14px; }
.sides { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 6px; margin-top: 12px; }

.empty {
  padding: 22px 16px; text-align: center;
  background: var(--panel-2); border: 1px dashed rgba(255, 255, 255, 0.15); border-radius: 10px;
}
.empty h3 { font-size: 19px; color: var(--beak); }
.empty p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.tip { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.tip p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }

.players { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.player {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel-2); color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
}
.player:hover:not(:disabled) { background: #1d2a3d; }
.player:disabled { cursor: default; opacity: 0.75; }
.player img, .avatar { width: 28px; height: 28px; border-radius: 4px; image-rendering: pixelated; flex: none; }
.avatar { display: grid; place-items: center; background: var(--navy); font: 400 14px/1 var(--pixel); }
.player .name { font-weight: 600; }
.player .where { margin-left: auto; color: var(--muted); font-size: 12px; }

/* ---------- Copy-view button and toast ---------- */
.view-btn {
  position: absolute; z-index: 3;
  right: 14px; bottom: 14px;
  padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--text);
  font: 600 13px/1 system-ui, sans-serif;
  cursor: pointer;
}
.view-btn:hover { background: #1d2a3d; }
.drawer:not([hidden]) ~ .view-btn { display: none; }

.toast {
  position: absolute; z-index: 6;
  left: 50%; bottom: 22px;
  transform: translate(-50%, 20px);
  max-width: calc(100% - 28px);
  padding: 10px 16px;
  border-radius: 999px;
  background: #e9eef4; color: #0b0f17;
  font: 600 14px/1.3 system-ui, sans-serif;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.noscript { position: fixed; bottom: 0; left: 0; right: 0; margin: 0; padding: 10px; background: var(--panel); text-align: center; }

/* ---------- Smaller screens ---------- */
@media (max-width: 760px) {
  .brand-name { display: none; }
}
@media (max-width: 640px) {
  :root { --bar-h: 56px; }
  .bar { gap: 8px; padding: 0 10px; }
  .brand img { width: 36px; height: 36px; }
  .status { padding: 6px 10px; }
  .status-word { display: none; }
  .actions { gap: 6px; }
  .actions .btn { padding: 8px 10px; font-size: 14px; }

  /* the side panel becomes a bottom sheet */
  .drawer { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 72%; }
  .welcome { left: 8px; right: 8px; bottom: 8px; width: auto; }
  .view-btn { right: 8px; bottom: 8px; }
}
@media (max-width: 400px) {
  .actions #discord-top { display: none; } /* still reachable from the Join panel */
}
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}

/* ---------- Intro screen (black title screen that fades into the map) ---------- */
.intro {
  --p: 0;                                  /* 0 = intro showing, 1 = fully faded into the map (set by app.js) */
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #000;
  opacity: calc(1 - var(--p));
  cursor: pointer;
  user-select: none;
  touch-action: none;
}
.intro-inner {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  transform: translateY(calc(var(--p) * -50px)) scale(calc(1 + var(--p) * 0.15));
  filter: blur(calc(var(--p) * 6px));
}
.intro-logo {
  width: clamp(120px, 26vh, 250px); height: auto;
  margin-bottom: clamp(10px, 3vh, 30px);
  image-rendering: auto;
  filter: drop-shadow(0 0 36px rgba(73, 182, 195, 0.28));   /* soft ocean-blue glow */
  animation: fade-in 1.2s ease-out both, float 4s 1.2s ease-in-out infinite;
}
.intro-title {
  font: 400 clamp(28px, 7.4vw, 108px)/1 var(--pixel);
  color: #fff;
  text-shadow: 0.1em 0.1em 0 #3f3f3f;      /* the classic blocky drop shadow */
  white-space: nowrap;
  animation: intro-in 1s 0.25s ease-out both;
}
.intro-title .tld { color: var(--grass); text-shadow: 0.1em 0.1em 0 #2c4a16; }

/* yellow "splash" text, tilted and pulsing (edit or empty the list in site.json) */
.splash {
  position: absolute; right: -0.5em; bottom: -1.4em;
  margin: 0;
  font: 400 clamp(13px, 2.1vw, 28px)/1 var(--pixel);
  color: #ffff55;
  text-shadow: 0.1em 0.1em 0 #3f3f15;
  white-space: nowrap;
  transform: rotate(-14deg);
  animation: splash 0.55s ease-in-out infinite alternate, fade-in 1s 0.6s ease-out both;
}

.intro-arrow {
  position: absolute; left: 50%; bottom: max(36px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 10px 16px;
  border: 0; background: none; color: #ddd;
  font: 400 14px/1 var(--pixel); letter-spacing: 0.1em;
  cursor: pointer;
  opacity: calc(1 - var(--p) * 3);
  animation: fade-in 1s 1.2s ease-out both;
}
.intro-arrow svg { width: 40px; height: 45px; animation: bob 1.4s ease-in-out infinite; }
.intro-arrow:hover { color: #fff; }

/* the map starts slightly zoomed in and settles as the intro fades */
.intro-active #map { transform: scale(calc(1.12 - var(--p) * 0.12)); will-change: transform; }

@keyframes intro-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes splash { from { transform: rotate(-14deg) scale(1); } to { transform: rotate(-14deg) scale(1.08); } }
@keyframes bob { 50% { transform: translateY(10px); } }
@keyframes float { 50% { transform: translateY(-10px); } }

@media (prefers-reduced-motion: reduce) {
  .intro-inner { transform: none; filter: none; }
  .intro-active #map { transform: none; }
  .intro-logo, .intro-title, .splash, .intro-arrow, .intro-arrow svg { animation: none; }
}
