/* Fibble — restyled to use the site's theme variables (var(--bg)/--text/--muted/
   --accent/--border from style.css) instead of its original standalone dark palette,
   so it follows the light/dark toggle like the rest of the site. */

.app {
  --fb-surface: #ECEAE3;
  --fb-surface-hi: #E1DED4;
  --fb-gold: #B9873C;
  --fb-c0: var(--fb-gold);
  --fb-c1: var(--accent);
  --fb-c2: #8C6E8F;
  --fb-c3: #B0714F;
  --fb-c4: #5C7A96;

  max-width: 430px;
  margin: 2rem auto 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--text);
}

[data-theme="dark"] .app {
  --fb-surface: #1D1D20;
  --fb-surface-hi: #26262A;
  --fb-gold: #D9B36B;
  --fb-c2: #A788AA;
  --fb-c3: #C98A66;
  --fb-c4: #7FA0BE;
}

.app * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

.app header {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.app header svg { flex-shrink: 0; }
.app h1 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}
.app h1 .b { color: var(--fb-gold); }
.app .tagline {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 4px;
}

.app .status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
}
.app .found b { color: var(--fb-gold); }

.app .board-wrap { position: relative; }
.app .board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.app .tile {
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--fb-surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'IBM Plex Mono', monospace;
  font-size: clamp(13px, 4.4vw, 19px);
  font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.08s ease, background 0.2s ease, border-color 0.2s ease;
}
.app .tile:active { transform: scale(0.94); }
.app .tile.sel { background: var(--fb-surface-hi); border-color: var(--fb-gold); color: var(--fb-gold); }
.app .tile.lock0 { background: var(--fb-c0); border-color: var(--fb-c0); color: #181818; cursor: default; }
.app .tile.lock1 { background: var(--fb-c1); border-color: var(--fb-c1); color: #181818; cursor: default; }
.app .tile.lock2 { background: var(--fb-c2); border-color: var(--fb-c2); color: #181818; cursor: default; }
.app .tile.lock3 { background: var(--fb-c3); border-color: var(--fb-c3); color: #181818; cursor: default; }
.app .tile.lock4 { background: var(--fb-c4); border-color: var(--fb-c4); color: #181818; cursor: default; }

svg.trace { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
svg.trace polyline { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
svg.trace .cur { stroke: var(--fb-gold); opacity: 0.85; }
svg.trace .l0, svg.trace .l1, svg.trace .l2, svg.trace .l3, svg.trace .l4 {
  stroke: rgba(0, 0, 0, 0.35);
  opacity: 1;
}

.app .readout {
  min-height: 20px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  text-align: center;
  color: var(--muted);
}
.app .readout .ok { color: var(--accent); }
.app .readout .bad { color: #B5544A; }
.app .readout .v { color: var(--text); }

.app .controls { display: flex; gap: 10px; }
.app button.ctl {
  flex: 1;
  padding: 12px 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--fb-surface);
  color: var(--text);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.app button.ctl:active { transform: scale(0.97); }
.app button.ctl:disabled { opacity: 0.35; cursor: default; }

.app .msg { min-height: 16px; text-align: center; font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--muted); }
.app .msg.warn { color: #B5544A; }
.app .msg.win { color: var(--accent); }
.app .msg.goldmsg { color: var(--fb-gold); }

.app .result {
  display: none;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  background: var(--fb-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.app .result.show { display: flex; }
.app .result .big { font-family: 'Fraunces', serif; font-weight: 600; font-size: 1.1rem; }
.app .result .sub { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--muted); }
.app .result .emoji { font-size: 17px; letter-spacing: 3px; }

.app .shake { animation: fibble-shake 0.3s; }
@keyframes fibble-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
@media (prefers-reduced-motion: reduce) {
  .app * { animation: none !important; transition: none !important; }
}

.app footer {
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.1em;
}
