/* ============================================================
   darts: tonitown's shared theme (tonitown 89b6b15, shared/theme.css), trimmed
   to what the dartboard uses — design tokens + pixel components
   Included by every page BEFORE the page's own stylesheet.
   ============================================================ */

@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/press-start-2p.woff2') format('woff2');
}

:root {
  --bg: #0d0d14;
  --surface: #1b1b28;
  --surface-2: #262638;
  --border: #3a3a52;
  --ink: #eaeaf2;
  --ink-dim: #9a9ab0;
  --accent: #ffd23f;
  --accent-2: #3fb8ff;
  --good: #4ade80;
  --danger: #ff5d5d;
  --shadow: #000;
  --accent-border: #b8921f;
  --accent-ink: #1a1405;
  --scrim: rgba(6, 6, 12, 0.92);
  --z-modal: 150;
  --z-viewer: 160;
  --z-lock: 200;
  /* Height of a stuck .app-header.sticky below the safe-area inset:
     40px home-link img (border-box, borders included) + 6px
     padding-bottom. Anything pinned beneath the header offsets by this. */
  --header-stuck-h: 46px;
  --font-display: 'Press Start 2P', ui-monospace, monospace;
  --font-body: ui-monospace, Menlo, Consolas, 'Cascadia Mono', monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.4;
}

/* ---------- pixel chrome ---------- */

.pixel-panel {
  background: var(--surface);
  border: 3px solid var(--border);
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 16px;
}

.pixel-btn {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--ink);
  background: var(--surface-2);
  border: 3px solid var(--border);
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 14px 18px;
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  text-decoration: none;
  text-align: center;
}
.pixel-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow);
}
.pixel-btn.primary {
  background: var(--accent);
  border-color: var(--accent-border);
  color: var(--accent-ink);
}
.pixel-btn.danger {
  background: var(--danger);
  border-color: #8a2b2b;
  color: #1c0505;
}
.pixel-btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: 4px 4px 0 var(--shadow);
}

/* ---------- app screen column ---------- */
/* The standard app page wrapper: centered column under the header. */
.app-screen {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------- locked / empty status panel ---------- */
.status-panel {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

/* ---------- modal overlay ---------- */
/* Full-screen scrim that centers a card. Viewers that fill the screen
   override z-index (--z-viewer) and background locally. */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* ---------- app header (home icon + title bar on each app) ---------- */

.app-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: env(safe-area-inset-top);
  margin-bottom: 6px;
}

/* The app's own tile art, leading the title. */
.app-header .app-icon {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.app-header .app-title {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--accent);
  text-shadow: 3px 3px 0 var(--shadow);
  margin: 0;
  margin-right: auto; /* icon + title left; actions + home icon gather right */
}

.home-link {
  display: block;
  line-height: 0;
  flex-shrink: 0;
}
.home-link img {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  border: 2px solid var(--border);
  box-shadow: 3px 3px 0 var(--shadow);
}
.home-link:active img {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--shadow);
}

/* Opt-in: apps whose pages scroll keep the header pinned. The existing
   padding-top keeps the title clear of the notch while stuck; the
   opaque background hides content scrolling beneath. padding-bottom
   replaces margin-bottom so there's no see-through slit under the bar. */
.app-header.sticky {
  position: sticky;
  top: 0;
  z-index: 30; /* above messages' control-row (20), below --z-modal */
  background: var(--bg);
  padding-bottom: 6px;
  margin-bottom: 0;
}

