/* Sanavalmius — Bespoke Nordic Typographic Aesthetic
   Crafted with deliberate typography, high contrast, tactile trays, and zero generic AI slop.
*/

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@1,6..72,400;1,6..72,500;1,6..72,600&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Space+Mono:wght@400;700&family=Syne:wght@700;800&display=swap');

:root {
  --font-display: 'Syne', -apple-system, sans-serif;
  --font-serif: 'Newsreader', Georgia, serif;
  --font-mono: 'Space Mono', monospace;
  --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;

  /* Vaalea teema: Nordic Parchment & Sumi Ink */
  --bg-page: #f6f5f0;
  --bg-surface: #ffffff;
  --bg-subtle: #eae8e1;
  --bg-inset: #e2dfd7;

  --border-strong: #181a1d;
  --border-subtle: #d3d0c5;
  --border-dashed: #b8b4a7;

  --text-primary: #181a1d;
  --text-muted: #5e636b;
  --text-dim: #8b9099;

  --accent-ink: #181a1d;
  --accent-vermilion: #cf3824;
  --accent-vermilion-subtle: #faebe8;
  --accent-forest: #1e5e3a;
  --accent-forest-subtle: #eaf5ee;
  --accent-amber: #c27803;

  --shadow-tactile: 3px 3px 0px #181a1d;
  --shadow-tactile-sm: 2px 2px 0px #181a1d;
  --shadow-subtle: 0 4px 12px rgba(24, 26, 29, 0.04);
}

html.dark {
  /* Tumma teema: Basalt Charcoal, Crisp Bone & Burnt Ochre */
  --bg-page: #0f1013;
  --bg-surface: #18191e;
  --bg-subtle: #22242a;
  --bg-inset: #131418;

  --border-strong: #e8e6df;
  --border-subtle: #2d3038;
  --border-dashed: #3a3e47;

  --text-primary: #f4f3ee;
  --text-muted: #9fa4af;
  --text-dim: #676c77;

  --accent-ink: #f4f3ee;
  --accent-vermilion: #ff5238;
  --accent-vermilion-subtle: rgba(255, 82, 56, 0.12);
  --accent-forest: #3ddc84;
  --accent-forest-subtle: rgba(61, 220, 132, 0.12);
  --accent-amber: #f5a623;

  --shadow-tactile: 3px 3px 0px #e8e6df;
  --shadow-tactile-sm: 2px 2px 0px #e8e6df;
  --shadow-subtle: 0 4px 16px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-primary);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Typografialuokat */
.font-display {
  font-family: var(--font-display);
}
.font-serif {
  font-family: var(--font-serif);
}
.font-mono {
  font-family: var(--font-mono);
}

/* Hienovarainen lehtikuvio / sanapaperin tuntu */
.paper-texture {
  background-image: radial-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 0);
  background-size: 24px 24px;
}
html.dark .paper-texture {
  background-image: radial-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 0);
}

/* Taktilinen laatikko (ei geneerinen AI blur card!) */
.tactile-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: var(--shadow-subtle);
}

.tactile-card-strong {
  background: var(--bg-surface);
  border: 2px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-tactile);
}

/* Taktiset painikkeet */
.btn-tactile {
  background: var(--border-strong);
  color: var(--bg-page);
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  font-family: var(--font-sans);
  font-weight: 700;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  cursor: pointer;
}

.btn-tactile:hover {
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-tactile-sm);
}

.btn-tactile:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

/* Secondary outline button */
.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1.5px solid var(--border-subtle);
  border-radius: 6px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-outline:hover {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}

/* Word Slot Tray (Pelin sanalokerot) */
.word-slot {
  height: 46px;
  border-radius: 6px;
  border: 1.5px dashed var(--border-dashed);
  background: var(--bg-inset);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.word-slot.filled {
  border: 1.5px solid var(--accent-forest);
  background: var(--accent-forest-subtle);
  color: var(--accent-forest);
  box-shadow: var(--shadow-tactile-sm);
  animation: slotSnap 0.35s cubic-bezier(0.2, 1, 0.3, 1);
}

@keyframes slotSnap {
  0% { transform: scale(0.92); opacity: 0; }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

/* Kielletyt sanat: Erittäin selkeä ja helposti luettava kielto-badge */
.blacklist-badge {
  background: var(--accent-vermilion-subtle);
  color: var(--text-primary);
  border: 1.5px solid var(--accent-vermilion);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 4px 10px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.blacklist-badge-icon {
  color: var(--accent-vermilion);
  font-weight: 800;
  font-size: 0.8rem;
  line-height: 1;
}

.blacklist-badge-text {
  color: var(--text-primary);
}

/* Painemittari / Ajastinpalkki */
.tension-bar-track {
  width: 100%;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.tension-bar-fill {
  height: 100%;
  background: var(--border-strong);
  transition: width 0.1s linear, background-color 0.3s ease;
}

.tension-bar-fill.warning {
  background: var(--accent-amber);
}

.tension-bar-fill.danger {
  background: var(--accent-vermilion);
}

/* Syötekenttä */
.tactile-input {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 1.15rem;
  transition: all 0.15s ease;
}

.tactile-input:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-tactile);
}

/* Ravistus virheille */
@keyframes tactileShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

.animate-shake {
  animation: tactileShake 0.28s ease-in-out both;
}

/* Päättyneen kierroksen leima */
.stamp-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  padding: 4px 12px;
  border: 2px solid currentColor;
  border-radius: 4px;
  transform: rotate(-2deg);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-dashed);
  border-radius: 4px;
}
