/* PuttLab — styles. CSS only, no images, no webfonts. */

:root {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --ink: #0f172a;
  --ink-soft: #475569;
  --line: #cbd5e1;
  --line-strong: #0f172a;
  --accent: #0284c7;
  --btn: #ffffff;
  --btn-ink: #0f172a;
  --btn-line: #94a3b8;
  --banner-h: 0px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f16;
    --panel: #131a26;
    --ink: #e2e8f0;
    --ink-soft: #94a3b8;
    --line: #334155;
    --line-strong: #e2e8f0;
    --accent: #38bdf8;
    --btn: #1e293b;
    --btn-ink: #e2e8f0;
    --btn-line: #475569;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }

body {
  overscroll-behavior-y: contain;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 12px calc(12px + var(--banner-h));
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ------------------------------------------------------------ topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
}

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.brand-mark svg { width: 30px; height: 30px; display: block; }
.brand-word { font-size: 17px; letter-spacing: 0.2px; }
.brand-word span { color: var(--accent); }
.top-actions { display: flex; align-items: center; gap: 6px; }

.icon-button {
  min-width: 44px; min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--btn-line);
  background: var(--btn); color: var(--btn-ink);
  font-size: 16px;
}
.about-button {
  min-height: 44px; padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--btn-line);
  background: var(--btn); color: var(--btn-ink);
  font-weight: 600; font-size: 14px;
}

/* --------------------------------------------------------------- HUD */

.hud {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.3px;
  flex: 0 0 auto;
}
.hud-item strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.status {
  font-size: 12.5px;
  color: var(--ink-soft);
  min-height: 17px;
  padding: 0 2px;
  flex: 0 0 auto;
}

/* ---------------------------------------------------------- playfield */

.stage {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
}

.playfield {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--panel);
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.playfield-hint { font-size: 11.5px; color: var(--ink-soft); text-align: center; flex: 0 0 auto; }

/* ---------------------------------------------------------- controls */

.controls { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }

.controls-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.ctl-btn {
  min-height: 44px; padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--btn-line);
  background: var(--btn); color: var(--btn-ink);
  font-size: 13.5px; font-weight: 600;
}
.ctl-btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.ctl-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.ctl-btn.ctl-wide { flex: 1 1 auto; }
.ctl-label { font-size: 12.5px; color: var(--ink-soft); }
.ctl-select {
  min-height: 44px; padding: 0 8px;
  border-radius: 10px;
  border: 1px solid var(--btn-line);
  background: var(--btn); color: var(--btn-ink);
  font-size: 13.5px;
}

/* ------------------------------------------------------------ sheets */

.sheet {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50;
}
.sheet-center { align-items: center; padding: 16px; }
.sheet-card {
  background: var(--panel);
  color: var(--ink);
  border-radius: 14px;
  padding: 16px;
  width: 100%;
  max-width: 420px;
  max-height: 88vh;
  overflow-y: auto;
  padding-bottom: calc(16px + var(--banner-h));
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.35);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-head h2 { margin: 0 0 8px; font-size: 18px; }
.about-body { font-size: 13.5px; line-height: 1.5; color: var(--ink); margin: 8px 0; }
.about-meta { font-size: 11.5px; color: var(--ink-soft); margin: 8px 0 0; }
.button {
  display: block; width: 100%;
  min-height: 46px; margin-top: 8px;
  border-radius: 10px;
  border: 1px solid var(--btn-line);
  background: var(--btn); color: var(--btn-ink);
  font-size: 15px; font-weight: 600;
}
.button-primary { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%; bottom: calc(20px + var(--banner-h));
  transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  padding: 9px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  z-index: 80;
  max-width: 90vw;
  text-align: center;
}

/* the green is the whole control: a flick must never scroll or select */
#canvas {
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: grab;
}
#canvas:active { cursor: grabbing; }
