:root {
  --bg: #17130f;
  --bar: #241d17;
  --edge: #6b5a45;
  --ink: #f1f0df;
  --sub: #cdbf9f;
  --go: #52b788;
  --bad: #e76f51;
  --bar-height: 44px;
  --banner-height: 56px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
#bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--bar-height);
  padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
  background: var(--bar);
  border-bottom: 1px solid var(--edge);
  font-size: 12px;
}
#brand { font-weight: 700; color: var(--sub); white-space: nowrap; }
#account {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--sub);
  text-align: right;
}
#account .ok { color: var(--go); }
#login-slot { flex: 0 0 auto; display: flex; align-items: center; min-height: 32px; }
#login-slot .pending { color: var(--sub); font-size: 11px; border: 1px dashed var(--edge); border-radius: 12px; padding: 4px 10px; }
#privacy {
  flex: 0 0 auto;
  color: var(--sub);
  font-size: 10px;
  opacity: 0.75;
  white-space: nowrap;
}
#bar button {
  flex: 0 0 auto;
  white-space: nowrap;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 5px 12px;
  cursor: pointer;
}
/* The game and, on wide screens, the ad rail on its right (ads.js; hidden unless shown). */
#play {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}
#stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #000;
}
#canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
}
#loading, #error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: var(--bg);
  text-align: center;
}
#loading-title, #error-title { margin: 0; font-size: 22px; font-weight: 700; }
#progress {
  width: min(320px, 80%);
  height: 10px;
  border: 1px solid var(--edge);
  border-radius: 6px;
  overflow: hidden;
  background: #2e2621;
}
#progress-fill { width: 0; height: 100%; background: var(--go); transition: width 0.2s; }
#progress.indeterminate #progress-fill { width: 30%; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
#loading-text { margin: 0; font-size: 14px; color: var(--sub); font-variant-numeric: tabular-nums; }
.note { margin: 8px 0 0; font-size: 11px; line-height: 1.6; color: var(--sub); opacity: 0.8; }
#error-text { margin: 0; font-size: 13px; color: var(--bad); white-space: pre-wrap; max-width: 34em; }
#error button {
  font: inherit;
  color: var(--ink);
  background: #2e2621;
  border: 2px solid var(--go);
  border-radius: 12px;
  padding: 10px 20px;
}
/* Ads (ads.js): never over the game; the rail and the banner take their room from the stage. */
#ad-rail {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg);
}
#ad-banner {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(var(--banner-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  overflow: hidden;
  background: var(--bar);
  border-top: 1px solid var(--edge);
}
[hidden] { display: none !important; }
.noscript { padding: 24px; }
