:root {
  color: #f5f0da;
  background: #0f1814;
  font-family: Inter, ui-rounded, "Avenir Next", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { width: 100%; min-height: 100%; margin: 0; }

body {
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 12%, rgba(116, 145, 80, .17), transparent 30rem),
    radial-gradient(circle at 86% 86%, rgba(193, 133, 52, .10), transparent 28rem),
    #0f1814;
}

button, a { -webkit-tap-highlight-color: transparent; }

.tester-shell {
  width: min(100%, 1680px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
}

.tester-header,
.tester-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand img { width: 42px; height: 42px; object-fit: contain; }
.brand-copy { display: grid; gap: 1px; }
.brand-copy strong { font-family: Georgia, serif; font-size: 23px; letter-spacing: -.02em; }
.brand-copy small { color: #aebb9f; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }

.tester-controls { display: flex; align-items: center; gap: 10px; }

.build-pill,
.control-button {
  min-height: 42px;
  border: 1px solid rgba(218, 225, 194, .16);
  border-radius: 999px;
  background: rgba(242, 237, 211, .07);
  color: #e6e4ce;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 15px;
  font: 650 12px/1 system-ui, sans-serif;
  letter-spacing: .025em;
}

.build-pill i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a8c76a;
  box-shadow: 0 0 14px rgba(168, 199, 106, .65);
}

.control-button { cursor: pointer; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.control-button:hover:not(:disabled) { background: rgba(242, 237, 211, .14); border-color: rgba(218, 225, 194, .32); }
.control-button:active:not(:disabled) { transform: translateY(1px); }
.control-button:focus-visible { outline: 3px solid rgba(214, 176, 75, .55); outline-offset: 2px; }
.control-button:disabled { cursor: wait; opacity: .46; }
.control-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.game-stage { min-height: 0; display: grid; place-items: center; }

.game-frame {
  position: relative;
  width: min(100%, calc((100dvh - 138px) * 1.6));
  max-height: calc(100dvh - 138px);
  aspect-ratio: 8 / 5;
  overflow: hidden;
  border: 1px solid rgba(225, 230, 199, .16);
  border-radius: 20px;
  background: #16231e;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .36), 0 0 0 1px rgba(0, 0, 0, .28);
}

#unity-canvas { display: block; width: 100%; height: 100%; background: #18261f; }

.loading-panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 9px;
  background: linear-gradient(145deg, #17251e, #101a16);
  color: #efe8cc;
}

.loading-panel[hidden] { display: none; }
.loading-panel img { width: 72px; height: 72px; object-fit: contain; margin-bottom: 4px; }
.loading-panel strong { font-family: Georgia, serif; font-size: clamp(21px, 2vw, 28px); }
.loading-panel span { color: #aeb9a0; font-size: 12px; }
.progress-track { width: min(280px, 52vw); height: 7px; margin-top: 9px; overflow: hidden; border-radius: 99px; background: rgba(236, 229, 196, .12); }
#unity-progress-bar-full { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #758f4f, #d1a947); transition: width .15s ease; }

.warning-stack { position: absolute; z-index: 3; top: 14px; left: 50%; width: min(560px, calc(100% - 28px)); transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; }
.warning { padding: 11px 14px; border-radius: 10px; background: rgba(245, 238, 207, .94); color: #203027; box-shadow: 0 10px 28px rgba(0, 0, 0, .25); font-size: 13px; }
.warning.error { background: #8d3d34; color: #fff8e9; }

.tester-footer { min-height: 28px; color: #7f9081; font-size: 11px; letter-spacing: .02em; }
.orientation-gate { display: none; }

@media (max-height: 700px) and (orientation: landscape) {
  .tester-shell { padding-top: 8px; padding-bottom: 7px; gap: 7px; }
  .brand img { width: 34px; height: 34px; }
  .brand-copy strong { font-size: 20px; }
  .brand-copy small, .tester-footer { display: none; }
  .build-pill, .control-button { min-height: 36px; }
  .game-frame { width: min(100%, calc((100dvh - 64px) * 1.6)); max-height: calc(100dvh - 64px); border-radius: 13px; }
}

@media (max-width: 760px) and (orientation: landscape) {
  .build-pill { display: none; }
  .control-button span { display: none; }
  .control-button { width: 40px; padding: 0; justify-content: center; }
}

@media (orientation: portrait) and (max-width: 1180px) {
  .tester-shell { display: none; }
  .orientation-gate {
    min-height: 100dvh;
    padding: max(28px, env(safe-area-inset-top)) 32px max(28px, env(safe-area-inset-bottom));
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 12px;
    text-align: center;
  }
  .orientation-gate img { width: 92px; height: 92px; object-fit: contain; margin-bottom: 8px; }
  .orientation-gate strong { font: 700 clamp(25px, 7vw, 36px)/1.1 Georgia, serif; }
  .orientation-gate span { max-width: 340px; color: #aeb9a0; font-size: 14px; line-height: 1.5; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
