@font-face { font-family: "Nunito"; src: url('./fonts/nunito.ttf') format('truetype'); font-weight: 200 1000; font-display: swap; }
:root { color-scheme: dark; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: #000; color: #f6f6f6; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; display: flex; flex-direction: column; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; color: inherit; background: #292929; border: 1px solid #454545; border-radius: 9px; padding: 10px 14px; font-weight: 600; }
button:hover { background: #393939; }
button:disabled { cursor: default; opacity: .4; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
a { color: inherit; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 14px max(18px, env(safe-area-inset-left)); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 20px; text-decoration: none; white-space: nowrap; }
.brand img { border-radius: 7px; }
.badge { color: #bbb; font-size: 11px; font-weight: 500; border: 1px solid #454545; border-radius: 5px; padding: 4px 6px; margin-left: 4px; }
nav { display: flex; gap: 8px; }
.primary { color: #fff; background: #007aff; border-color: transparent; }
.primary:hover { background: #008cff; }
#board { position: relative; flex: 1; min-height: 420px; margin: 0; }
.tile { position: absolute; overflow: hidden; color: #fff; background: var(--tile-color); }
.count { position: absolute; inset: 0; border: 0; border-radius: 0; background: transparent; color: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 48px 14px 54px; width: 100%; user-select: none; }
.count:hover { background: #ffffff0c; }
.count:active { background: #00000012; }
.count:focus-visible { outline: 3px solid #fff; outline-offset: -7px; }
.value { font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Arial Rounded MT Bold", sans-serif; font-size: clamp(10px, var(--count-size, 110px), 180px); font-weight: 700; letter-spacing: -.025em; line-height: 1.05; font-variant-numeric: tabular-nums; max-width: 100%; text-shadow: 0 1px 3px #0005; }
.name { font-size: clamp(14px, 2vw, 22px); font-weight: 600; overflow-wrap: anywhere; text-align: center; max-width: 100%; text-shadow: 0 1px 3px #0005; }
.tile-tools { position: absolute; bottom: 10px; left: 12px; right: 12px; display: flex; justify-content: space-between; pointer-events: none; }
.tile-tools button { pointer-events: auto; background: #0002; color: #fff; border: 1px solid #ffffff40; border-radius: 24px; font-size: 14px; padding: 7px 11px; min-width: 44px; min-height: 40px; }
.tile-tools button:hover { background: #0004; }
.tile-tools button:focus-visible { outline-color: #fff; }
footer { display: flex; justify-content: space-between; gap: 12px; color: #aaa; font-size: 12px; padding: 14px max(18px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
footer a { white-space: nowrap; text-underline-offset: 3px; }
dialog { background: #1c1c1c; color: #f6f6f6; border: 1px solid #454545; border-radius: 18px; padding: 24px; width: min(420px, calc(100% - 32px)); }
dialog::backdrop { background: #0009; backdrop-filter: blur(5px); }
h1 { font-size: 22px; margin: 0 0 20px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: baseline; }
.dialog-heading button { padding: 2px 10px; font-size: 24px; }
label { display: block; margin: 16px 0 8px; font-size: 14px; color: #ccc; }
input { width: 100%; padding: 12px; background: #111; color: #fff; border: 1px solid #555; border-radius: 8px; }
.dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; }
.danger { color: #ffaaa4; background: transparent; }
#editor-error { color: #ffaaa4; font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.no-script { position: fixed; inset: 40% 10% auto; text-align: center; }
@media (max-width: 600px) {
  .toolbar { flex-wrap: wrap; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 12px 12px; }
  .brand { font-size: 18px; }
  nav { width: 100%; }
  nav button { flex: 1; }
  #board { min-height: 440px; }
  footer { flex-direction: column; font-size: 11px; padding-left: 12px; }
  .tile-tools { left: 8px; right: 8px; bottom: 8px; }
  .tile-tools button { padding: 5px 8px; }
}
@media (prefers-reduced-motion: no-preference) {
  .value.bump { animation: bump 130ms ease-out; }
  @keyframes bump { 50% { transform: scale(1.06); } }
}
