/* Pixel Logic Daily — styles. CSS only, no images, no webfonts. */

:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #0f172a;
  --ink-soft: #475569;
  --line: #cbd5e1;
  --line-strong: #0f172a;
  --accent: #4f46e5;
  --accent-soft: #c7d2fe;
  --fill: #1e293b;
  --conflict: #dc2626;
  --btn: #ffffff;
  --btn-ink: #0f172a;
  --btn-line: #94a3b8;
  --banner-h: 0px;
  --cell: 26px;
  --n: 10;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f16;
    --panel: #131a26;
    --ink: #e2e8f0;
    --ink-soft: #94a3b8;
    --line: #334155;
    --line-strong: #e2e8f0;
    --accent: #818cf8;
    --accent-soft: #312e81;
    --fill: #e2e8f0;
    --conflict: #f87171;
    --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: 8px 12px calc(10px + var(--banner-h));
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 100vh;
}

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

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

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.brand-mark svg { width: 28px; height: 28px; display: block; }

.brand-word span { color: var(--accent); }

.about-button {
  border: 1px solid var(--btn-line);
  background: var(--btn);
  color: var(--btn-ink);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

/* ------------------------------------------------------------ hud */

.hud {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 9px;
  align-items: center;
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 5px 9px;
}

.hud-item strong { color: var(--ink); font-weight: 700; }

.status {
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
  min-height: 1.2em;
}

/* ------------------------------------------------------------ board */

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.frame {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto 1fr;
  gap: 3px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  width: 100%;
  justify-content: center;
}

.corner { }

.colclues {
  display: grid;
  grid-template-columns: repeat(var(--n), var(--cell));
  gap: 2px;
  justify-content: center;
}

.colclue {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 1px;
  min-height: 34px;
  font-size: 10px;
  line-height: 1.1;
  color: var(--ink-soft);
  overflow: hidden;
}

.rowclues {
  display: grid;
  grid-template-rows: repeat(var(--n), var(--cell));
  gap: 2px;
  justify-items: end;
}

.rowclue {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  font-size: 10px;
  line-height: 1.1;
  color: var(--ink-soft);
  height: var(--cell);
  white-space: nowrap;
}

/* When even the smallest cell leaves a row clue wider than its gutter, wrap it
   instead of clipping it (a truncated "1 1 1 1" is a wrong clue). */
.rowclues.tight .rowclue {
  flex-wrap: wrap;
  justify-content: flex-end;
  white-space: normal;
  gap: 0 2px;
  font-size: 9px;
  line-height: 1;
  overflow: hidden;
}

.num { font-variant-numeric: tabular-nums; }

.board {
  display: grid;
  grid-template-columns: repeat(var(--n), var(--cell));
  grid-template-rows: repeat(var(--n), var(--cell));
  gap: 2px;
  justify-content: center;
}

.cell {
  width: var(--cell);
  height: var(--cell);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  position: relative;
  font: inherit;
}

.cell.filled {
  background: var(--fill);
  border-color: var(--line-strong);
}

.cell.marked::after {
  content: "✕";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cell) * 0.62);
  color: var(--ink-soft);
  line-height: 1;
}

.board-hint {
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  max-width: 44ch;
}

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

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

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.ctl-btn {
  border: 1px solid var(--btn-line);
  background: var(--btn);
  color: var(--btn-ink);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  min-height: 40px;
}

.ctl-btn.tool.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.ctl-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.ctl-wide { flex: 1 1 auto; }

.ctl-label {
  font-size: 13px;
  color: var(--ink-soft);
}

.ctl-select {
  font: inherit;
  font-size: 14px;
  padding: 8px 8px;
  border-radius: 10px;
  border: 1px solid var(--btn-line);
  background: var(--btn);
  color: var(--btn-ink);
  min-height: 40px;
}

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

.sheet {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  z-index: 40;
}

.sheet-center { align-items: center; }

.sheet-card {
  background: var(--panel);
  color: var(--ink);
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 16px;
  max-width: 420px;
  width: 100%;
  max-height: 86vh;
  overflow: auto;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.sheet-head h2 { font-size: 18px; margin: 0; }

.icon-button {
  border: 1px solid var(--btn-line);
  background: var(--btn);
  color: var(--btn-ink);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  font: inherit;
  cursor: pointer;
}

.about-body { font-size: 14px; line-height: 1.45; margin: 0 0 10px; }

.about-meta { font-size: 12px; color: var(--ink-soft); margin: 0 0 8px; }

.button {
  display: block;
  width: 100%;
  margin-top: 8px;
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  border: 1px solid var(--btn-line);
  background: var(--btn);
  color: var(--btn-ink);
}

.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--banner-h));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 50;
}

@media (min-width: 720px) {
  .app { max-width: 620px; }
}
