/* Perjuangan Semut play page. Everything here is drawn from the game's own
   art: the mossy wooden board of its login dialog frames the stage, the key
   art is the backdrop, the logo plaque is cut from the key art, and the
   buttons copy the gold "Masuk game" button. */

@font-face {
  font-family: "Lilita One";
  src: url("/frame/lilita-one.woff2") format("woff2");
  font-display: swap;
}

:root {
  --wrap: 1160px;
  --bark: #2b1407;
  --wood: #5a2c0f;
  --wood-deep: #3a1b08;
  --gold-light: #fff27a;
  --gold: #ffd21f;
  --gold-deep: #f0a400;
  --ink: #3d1c04;
  --leaf: #8fd23a;
  --cream: #fff3d6;
  --cream-soft: #e9cf9f;
  /* border-image slices of board.png (493x564), and their drawn size */
  --rim-top: 50px;
  --rim-side: 46px;
  --rim-bottom: 34px;
  --bar-h: 64px;
  color-scheme: dark;
  accent-color: var(--gold);
}

* { box-sizing: border-box; }
::selection { background: var(--gold); color: var(--ink); }

html { background: var(--bark); }

body {
  /* NgideIn Social's panel beside the board (social.css turns it on) */
  --board-w: 0px;
  --gap: 0px;
  /* the stage is 1365x768, as large as the window allows */
  --game-w: min(
    calc(min(100vw, var(--wrap)) - 2 * var(--rim-side) - 32px - var(--board-w) - var(--gap)),
    calc((100svh - var(--bar-h) - var(--rim-top) - var(--rim-bottom) - 96px) * 1365 / 768)
  );
  margin: 0;
  min-height: 100svh;
  font: 500 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--cream);
  scrollbar-color: var(--wood) var(--bark);
}

/* ---- Backdrop: the key art, pushed back ---- */

.backdrop {
  position: fixed;
  inset: -24px;
  z-index: -1;
  background: url("/frame/keyart.jpg") center 30% / cover no-repeat;
  filter: blur(10px) brightness(0.42) saturate(1.15);
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 20%, transparent 40%, rgba(20, 8, 2, 0.85) 100%);
}

/* ---- Layout ---- */

.wrap {
  width: min(100%, var(--wrap));
  margin: 0 auto;
  padding: 28px 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.board {
  flex: none;
  width: calc(var(--game-w) + 2 * var(--rim-side));
  border-style: solid;
  border-width: var(--rim-top) var(--rim-side) var(--rim-bottom);
  border-image: url("/frame/board.png") 70 69 48 64 / var(--rim-top) var(--rim-side) var(--rim-bottom) round;
  background:
    radial-gradient(90% 70% at 50% 40%, #5c2d10 0%, var(--wood-deep) 75%) padding-box;
  filter: drop-shadow(0 22px 36px rgba(0, 0, 0, 0.55));
}

/* ---- Bar ---- */

.bar {
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 2px 8px;
}

.logo {
  flex: none;
  display: block;
  height: 104px;
  margin: -62px 6px 0 -12px;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.45));
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.logo img { height: 100%; width: auto; display: block; }
.logo:hover { transform: rotate(-2deg) scale(1.03); }
.logo:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 4px; border-radius: 12px; }

.account {
  margin-left: auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--cream);
}

.account__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
}

.account__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  object-fit: cover;
  background: var(--wood);
}

.actions { display: flex; gap: 8px; }

/* the game's gold "Masuk game" button */
.btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px 0 11px;
  border: 2px solid var(--ink);
  border-radius: 11px;
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 45%, var(--gold-deep) 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.7), inset 0 -3px 0 rgba(160, 80, 0, 0.45), 0 4px 8px rgba(0, 0, 0, 0.4);
  color: var(--ink);
  font: 400 15px/1 "Lilita One", system-ui, sans-serif;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), filter 0.15s;
}

.btn svg { width: 20px; height: 20px; flex: none; }
.btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); filter: brightness(0.96); }
.btn:focus-visible { outline: 3px solid var(--cream); outline-offset: 2px; }
.btn[aria-pressed="true"] {
  background: linear-gradient(180deg, #e6dccb 0%, #b9a88d 100%);
}
.btn[hidden] { display: none; }

/* ---- Stage ---- */

.stage {
  position: relative;
  width: var(--game-w);
  aspect-ratio: 1365 / 768;
  overflow: hidden;
  border-radius: 12px;
  background: #120803 url("/frame/keyart.jpg") center / cover no-repeat;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.55), 0 0 0 2px #7a3e14, 0 0 0 4px var(--bark);
}

.stage ruffle-player { position: absolute; inset: 0; width: 100%; height: 100%; }

.stage__status {
  position: absolute;
  left: 50%;
  bottom: 9%;
  translate: -50% 0;
  margin: 0;
  padding: 8px 20px;
  border-radius: 999px;
  background: rgba(43, 20, 7, 0.82);
  font: 400 18px/1.2 "Lilita One", system-ui, sans-serif;
  color: var(--gold-light);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.stage:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto; border-radius: 0; background: #000; }

.stage-exit {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
}
.stage:fullscreen .stage-exit { display: inline-flex; }

/* ---- Log (debug) ---- */

.log {
  width: 100%;
  max-height: 220px;
  margin: 10px 0 0;
  padding: 10px 12px;
  overflow: auto;
  border-radius: 10px;
  background: rgba(10, 4, 1, 0.75);
  color: #b7e48a;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
}
.log[hidden] { display: none; }

/* ---- Credit ---- */

.credit {
  max-width: 70ch;
  margin: 18px auto 0;
  text-align: center;
  font-size: 13px;
  color: var(--cream-soft);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.credit a { color: var(--gold); text-underline-offset: 3px; }
