/* Shikaku web: palette "Cooler rose, vivid", Baskerville. Mirrors the iOS app. */
:root {
  --paper: #f6eedc;
  --ink-rgb: 25, 25, 25;
  --ink: rgb(var(--ink-rgb));
  --serif: Baskerville, "Libre Baskerville", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1916;
    --ink-rgb: 236, 229, 214;
    color-scheme: dark;
  }
}
.ink-a { color: rgba(var(--ink-rgb), 0.65); }

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--paper); color: var(--ink);
  font-family: var(--serif);
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
body { position: fixed; inset: 0; }

#app {
  position: absolute; inset: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  display: flex; justify-content: center;
}
.screen {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center;
  animation: fade 0.25s ease-in-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.spacer { flex: 1 1 0; }

#shield { position: fixed; inset: 0; z-index: 100; touch-action: none; }

button {
  font: inherit; color: inherit; background: none; border: 0; margin: 0; padding: 0;
  cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:disabled { cursor: default; }
button:focus { outline: none; }
button:focus-visible { outline: 2px solid rgba(var(--ink-rgb), 0.5); outline-offset: 2px; }

/* ToolButtonStyle */
.tool {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 16px; padding: 10px 0;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(var(--ink-rgb), 0.35);
  color: var(--ink);
}
.tool:active:not(:disabled) { background: rgba(var(--ink-rgb), 0.07); }
.tool.selected { background: var(--ink); color: var(--paper); box-shadow: inset 0 0 0 1px var(--ink); }
.tool:disabled { opacity: 0.35; }
.tool .row { display: flex; align-items: center; gap: 6px; }
.tool svg { display: block; }

/* PrimaryButtonStyle */
.primary {
  width: 100%;
  font-size: 18px; font-weight: 500; padding: 14px 0;
  border-radius: 12px;
  white-space: pre;
  transition: transform 0.12s ease-out;
}
.primary:active:not(:disabled) { transform: scale(0.98); }
.primary:disabled { background: rgba(var(--ink-rgb), 0.08) !important; color: rgba(var(--ink-rgb), 0.5) !important; }

.section-label {
  width: 100%; font-size: 12px; font-weight: 500; letter-spacing: 1.8px; text-transform: uppercase;
  color: rgba(var(--ink-rgb), 0.55);
}

/* Home */
.home { max-width: 520px; }
.home .emblem { width: 128px; height: 96px; display: block; flex: none; }
.home h1 { margin: 18px 0 0; font-size: 52px; font-style: italic; font-weight: 500; line-height: 1.1; }
.home .tagline { margin: 2px 0 0; font-size: 16px; color: rgba(var(--ink-rgb), 0.65); }
.home .group { width: 100%; padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.home .group .buttons { display: flex; gap: 10px; }
.home .group.levels { margin-top: 22px; }
.home .group.levels .buttons { gap: 8px; }
.home .size-btn .inner { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 6px 0; }
.home .glyph { width: 26px; height: 26px; opacity: 0.8; display: block; }
.home .level-btn .n { font-size: 22px; line-height: 1.15; }
.home .level-btn .c { font-size: 11px; opacity: 0.7; font-variant-numeric: tabular-nums; margin-top: 1px; }
.home .summary { margin-top: 26px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.home .summary .count { font-size: 30px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.home .rule { width: 160px; height: 3px; border-radius: 2px; background: rgba(var(--ink-rgb), 0.12); position: relative; overflow: hidden; }
.home .rule > div { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; }
.home .summary .label { font-size: 14px; font-style: italic; color: rgba(var(--ink-rgb), 0.65); }
.home .play { width: 100%; padding: 0 16px 12px; }

/* Game */
.game header {
  width: 100%; height: 44px; flex: none; position: relative;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.game header .back {
  position: absolute; left: 6px; top: 0; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center; color: var(--ink);
}
.game .status {
  height: 76px; flex: none; width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: 2px; gap: 2px;
}
.game .status .solved { font-size: 44px; font-style: italic; font-weight: 500; line-height: 1.1; animation: solvedIn 0.35s ease-out; }
.game .status .sub { font-size: 14px; color: rgba(var(--ink-rgb), 0.65); }
.game .status .sub.italic { font-style: italic; }
.game .status .size { font-size: 22px; font-style: italic; font-weight: bold; color: var(--ink); }
@keyframes solvedIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
.game .controls {
  width: 100%; max-width: 520px; height: 92px; flex: none;
  padding: 28px 16px 0;
  display: flex; gap: 10px; align-items: flex-start;
}
.game .controls .primary { animation: fade 0.35s ease-out; }

.board { position: relative; flex: none; touch-action: none; }
.board canvas { position: absolute; left: 0; top: 0; display: block; pointer-events: none; }
.board-hit { position: absolute; touch-action: none; -webkit-touch-callout: none; cursor: crosshair; }

.loading { margin: auto; font-style: italic; color: rgba(var(--ink-rgb), 0.65); }
