:root {
  --bg: #111519;
  --panel: #171d26;
  --card: #1c2430;
  --line: #314053;
  --text: #f2e8d9;
  --muted: #b4a996;
  --gold: #e2b86d;
  --gold-dim: #a08040;
  --signal: #8ab4f8;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.30);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 30%, rgba(226, 184, 109, 0.07), transparent 50%),
    radial-gradient(circle at 10% 80%, rgba(138, 180, 248, 0.04), transparent 40%),
    linear-gradient(180deg, #0d1117 0%, #111519 100%);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ── App shell ────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  min-height: 100dvh;
  gap: 12px;
  padding: 12px 8px;
}

/* ── Portrait: split layout ───────────────── */
.squares-split {
  display: flex;
  gap: 10px;
  width: min(96vw, 700px);
}

.squares-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

/* ── Landscape: row layout ────────────────── */
.squares-row {
  display: none;
  gap: 10px;
  width: min(96vw, 800px);
}

.squares-top,
.squares-bottom {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

/* ── Orientation switching ────────────────── */
@media (orientation: landscape) {
  .squares-split { display: none; }
  .squares-row { display: flex; flex-direction: column; }
  #clock-portrait { display: none; }
  #clock-landscape { display: block; }
}

@media (orientation: portrait) {
  .squares-split { display: flex; }
  .squares-row { display: none; }
  #clock-portrait { display: block; }
  #clock-landscape { display: none; }
}

/* ── Clock: Portrait ──────────────────────── */
.clock-area {
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
  padding: 8px;
}

.clock-line {
  font-family: "Courier New", monospace;
  font-weight: bold;
  letter-spacing: 0.04em;
  line-height: 1;
}

.clock-hours {
  font-size: clamp(4rem, 18vw, 8rem);
  color: var(--text);
}

.clock-minutes {
  font-size: clamp(3.2rem, 14vw, 6.5rem);
  color: var(--gold);
}

.clock-seconds {
  font-size: clamp(2.4rem, 11vw, 5rem);
  color: var(--gold-dim);
}

.clock-tick-flash {
  animation: tickFlash 600ms ease-out;
}

@keyframes tickFlash {
  0% { opacity: 1; text-shadow: 0 0 24px rgba(226, 184, 109, 0.5); }
  100% { opacity: 1; text-shadow: none; }
}

.clock-date {
  font-size: clamp(0.8rem, 2.8vw, 1.05rem);
  color: var(--muted);
  margin-top: 10px;
  font-family: "Courier New", monospace;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

/* ── Clock: Landscape ─────────────────────── */
.clock-time-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.05em;
  line-height: 1;
}

#clock-landscape .clock-hours {
  font-size: clamp(2.6rem, 8vh, 4.5rem);
}

#clock-landscape .clock-minutes {
  font-size: clamp(2.2rem, 7vh, 4rem);
}

#clock-landscape .clock-seconds {
  font-size: clamp(1.6rem, 5.5vh, 3rem);
}

.clock-sep {
  font-family: "Courier New", monospace;
  font-weight: bold;
  color: var(--muted);
  font-size: clamp(2rem, 6vh, 3.5rem);
}

#clock-landscape .clock-date {
  margin-top: 6px;
  font-size: clamp(0.75rem, 2.5vh, 1rem);
}

/* ── Squares ──────────────────────────────── */
.square {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(23, 29, 38, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: border-color 200ms ease, transform 150ms ease, background 200ms ease;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  overflow: hidden;
}

.square:hover {
  border-color: var(--gold-dim);
  background: rgba(28, 36, 48, 0.95);
}

.square:active {
  transform: scale(0.96);
}

.square.hold-active {
  border-color: var(--gold);
  background: rgba(226, 184, 109, 0.08);
}

.square.hold-complete {
  border-color: var(--signal);
  background: rgba(138, 180, 248, 0.08);
}

.square-icon {
  font-size: 1.4rem;
  line-height: 1;
  pointer-events: none;
}

.square-label {
  font-family: "Courier New", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
}

/* Progress ring */
.hold-ring {
  position: absolute;
  inset: 3px;
  border-radius: 11px;
  pointer-events: none;
}

.hold-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.hold-ring .track {
  stroke: var(--line);
  stroke-width: 3;
  fill: none;
}

.hold-ring .progress {
  stroke: var(--gold);
  stroke-width: 3;
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 0 100;
  transition: stroke-dasharray 50ms linear;
}

/* ── Photo modal ───────────────────────────── */
.photo-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  align-items: center;
  justify-content: center;
}

.photo-modal.visible {
  display: flex;
}

.photo-modal-inner {
  position: relative;
  max-width: 90vw;
  max-height: 80vh;
}

.photo-modal-inner img {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.photo-close {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ── PTT playback bar ─────────────────────── */
.ptt-bar {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  padding: 12px 24px;
  border-radius: 999px;
  border: 1px solid var(--signal);
  background: var(--panel);
  color: var(--text);
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
  gap: 12px;
  align-items: center;
}

.ptt-bar.visible {
  display: flex;
}

/* ── Surprise: color burst overlay ────────── */
.burst-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
  opacity: 0;
  transition: opacity 400ms ease;
}

.burst-overlay.active {
  opacity: 1;
}

/* ── Surprise: quote flash ────────────────── */
.quote-flash {
  display: none;
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  padding: 14px 28px;
  border-radius: 14px;
  border: 1px solid var(--gold-dim);
  background: var(--panel);
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 1rem;
  font-style: italic;
  box-shadow: var(--shadow);
  text-align: center;
  max-width: 80vw;
}

.quote-flash.visible {
  display: block;
  animation: quoteIn 400ms ease-out;
}

@keyframes quoteIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Two-thumb refresh indicator ──────────── */
.refresh-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  display: none;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  background: rgba(17, 21, 25, 0.9);
  color: var(--gold);
  font-family: "Courier New", monospace;
  font-size: 1.4rem;
  font-weight: bold;
  align-items: center;
  justify-content: center;
}

.refresh-indicator.visible {
  display: flex;
}
