/* ============================================
   KörKatt Brand CSS Variables
   ============================================ */
:root {
  /* Core Colors */
  --kk-green: #1F6B3B;
  --kk-green-dark: #0E3B22;
  --kk-red: #D83A3A;
  --kk-cream: #F6F3EA;
  --kk-white: #FFFFFF;
  --kk-gold: #D6A63A;
  --kk-gold-dark: #9C6B1E;

  /* UI Colors */
  --text: #152016;
  --muted: rgba(21, 32, 22, .7);
  --bg: #FBFAF6;
  --panel: rgba(255,255,255,.78);
  --panel-border: rgba(14,59,34,.18);

  /* Game Status Colors */
  --hit: #2ECC71;
  --warn: #F2C94C;
  --miss: #EB5757;

  /* Shape & Depth */
  --r-card: 16px;
  --r-btn: 14px;
  --shadow-soft: 0 6px 18px rgba(0,0,0,.12);
  --shadow-punchy: 0 10px 28px rgba(0,0,0,.18);

  /* Gradients */
  --grad-green: linear-gradient(180deg, #34A853 0%, #1F6B3B 55%, #0E3B22 100%);
  --grad-gold: linear-gradient(180deg, #F6D77A 0%, #D6A63A 55%, #9C6B1E 100%);
  --grad-flag: linear-gradient(90deg, #D83A3A 0%, #FFFFFF 50%, #1F6B3B 100%);
}

/* Dark Theme */
[data-theme="night"] {
  --bg: #06140D;
  --panel: rgba(14, 59, 34, .35);
  --panel-border: rgba(246, 243, 234, .14);
  --text: #EAF3EC;
  --muted: rgba(234, 243, 236, .7);
}

[data-theme="night"] body {
  background:
    radial-gradient(900px 500px at 20% 25%, rgba(216,58,58,.10), transparent 60%),
    radial-gradient(900px 500px at 80% 20%, rgba(52,168,83,.10), transparent 60%),
    radial-gradient(800px 500px at 50% 85%, rgba(214,166,58,.10), transparent 65%),
    linear-gradient(180deg, var(--bg), #030B07);
}

[data-theme="night"] .target {
  box-shadow: 0 12px 28px rgba(0,0,0,.55);
  outline: 2px solid rgba(246,243,234,.14);
}

/* Header Selectors - Dark Theme */
[data-theme="night"] .gamemode-buttons,
[data-theme="night"] .difficulty-buttons {
  background: rgba(14, 59, 34, 0.3);
  border-color: rgba(246, 243, 234, 0.2);
}

[data-theme="night"] .gamemode-btn:hover:not(:disabled),
[data-theme="night"] .difficulty-btn:hover:not(:disabled) {
  background: rgba(246, 243, 234, 0.1);
}

[data-theme="night"] .gamemode-btn.active,
[data-theme="night"] .difficulty-btn.active {
  background: rgba(246, 243, 234, 0.15);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Health Display - Dark Theme */
[data-theme="night"] .health-display {
  background: rgba(14, 59, 34, 0.4);
  border: 1px solid rgba(246, 243, 234, 0.2);
}

/* Settings Modal - Dark Theme */
[data-theme="night"] .settings-modal-content {
  background: var(--panel);
  border-color: var(--panel-border);
}

[data-theme="night"] .settings-modal-close {
  background: rgba(246, 243, 234, 0.1);
}

[data-theme="night"] .settings-modal-close:hover {
  background: rgba(246, 243, 234, 0.2);
}

[data-theme="night"] .settings-slider {
  background: rgba(246, 243, 234, 0.2);
}

[data-theme="night"] .settings-toggle-slider {
  background: rgba(246, 243, 234, 0.2);
}

[data-theme="night"] .settings-toggle:checked + .settings-toggle-slider {
  background: var(--kk-green);
}

/* Statistics Modal - Dark Theme */
[data-theme="night"] .stats-modal-content {
  background: var(--panel);
  border-color: var(--panel-border);
}

[data-theme="night"] .stats-modal-close {
  background: rgba(246, 243, 234, 0.1);
}

[data-theme="night"] .stats-modal-close:hover {
  background: rgba(246, 243, 234, 0.2);
}

[data-theme="night"] .stats-card {
  background: rgba(14, 59, 34, 0.3);
  border-color: rgba(246, 243, 234, 0.15);
}

[data-theme="night"] .stats-gamemode-card {
  background: rgba(14, 59, 34, 0.3);
  border-color: rgba(246, 243, 234, 0.15);
}

[data-theme="night"] .stats-difficulty-tabs {
  background: rgba(14, 59, 34, 0.3);
  border-color: rgba(246, 243, 234, 0.15);
}

[data-theme="night"] .stats-difficulty-tab:hover {
  background: rgba(246, 243, 234, 0.1);
}

[data-theme="night"] .stats-difficulty-tab.active {
  background: rgba(246, 243, 234, 0.15);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="night"] .stats-chart-container {
  background: rgba(14, 59, 34, 0.3);
  border-color: rgba(246, 243, 234, 0.15);
}

[data-theme="night"] .stats-run-item {
  background: rgba(14, 59, 34, 0.2);
  border-color: rgba(246, 243, 234, 0.15);
}

[data-theme="night"] .stats-run-item:hover {
  background: rgba(14, 59, 34, 0.35);
}

[data-theme="night"] .stats-day-item {
  background: rgba(14, 59, 34, 0.2);
  border-color: rgba(246, 243, 234, 0.15);
}

[data-theme="night"] .stats-gamemode-stat-item {
  background: rgba(14, 59, 34, 0.3);
  border-color: rgba(246, 243, 234, 0.15);
}

/* ============================================
   Reset & Base Styles
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    radial-gradient(900px 500px at 15% 20%, rgba(216,58,58,.12), transparent 60%),
    radial-gradient(900px 500px at 85% 25%, rgba(31,107,59,.14), transparent 60%),
    linear-gradient(180deg, var(--bg), #F3F0E7);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
  user-select: none;
}

/* ============================================
   Layout Structure
   ============================================ */
.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 16px;
  gap: 16px;
  position: relative;
}

/* ============================================
   HUD / Top Bar
   ============================================ */
.hud {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  height: 64px;
  width: auto;
  object-fit: contain;
}

.hud-stats {
  display: flex;
  gap: 24px;
  align-items: center;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}

.stat-value.warning {
  color: var(--warn);
}

.stat-value.danger {
  color: var(--miss);
}

.health-container {
  display: flex;
  gap: 4px;
  align-items: center;
}

.health-icon {
  font-size: 24px;
  line-height: 1;
  transition: transform 0.2s ease, opacity 0.3s ease;
}

.health-icon.lost {
  opacity: 0.3;
  transform: scale(0.9);
}

.health-icon.active {
  animation: healthPulse 0.3s ease-out;
}

.health-icon.just-lost {
  animation: heartLost 0.5s ease-out;
}

.health-display.health-shake {
  animation: healthShake 0.6s ease-out;
}

@keyframes healthPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes heartLost {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.3) rotate(10deg);
    opacity: 0.8;
  }
  100% {
    transform: scale(0.9) rotate(0deg);
    opacity: 0.3;
  }
}

@keyframes healthShake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-4px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(4px);
  }
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ============================================
   Controls
   ============================================ */
.gamemode-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.gamemode-buttons {
  display: flex;
  gap: 4px;
  background: rgba(246,243,234,.5);
  padding: 4px;
  border-radius: var(--r-btn);
  border: 1px solid var(--panel-border);
}

.gamemode-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  border-radius: calc(var(--r-btn) - 2px);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.gamemode-btn:hover:not(:disabled) {
  background: rgba(255,255,255,.5);
}

.gamemode-btn.active {
  background: var(--kk-white);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.gamemode-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.difficulty-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.difficulty-buttons {
  display: flex;
  gap: 4px;
  background: rgba(246,243,234,.5);
  padding: 4px;
  border-radius: var(--r-btn);
  border: 1px solid var(--panel-border);
}

.difficulty-btn {
  padding: 6px 10px;
  border: none;
  background: transparent;
  border-radius: calc(var(--r-btn) - 2px);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.difficulty-btn:hover:not(:disabled) {
  background: rgba(255,255,255,.5);
}

.difficulty-btn.active {
  background: var(--kk-white);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.difficulty-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Dropdown selectors (hidden by default, shown on mobile) */
.gamemode-dropdown,
.difficulty-dropdown {
  display: none;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--panel-border);
  border-radius: var(--r-btn);
  background: var(--kk-white);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23152016' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 36px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  transition: all 0.2s ease;
}

.gamemode-dropdown:hover,
.difficulty-dropdown:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
}

.gamemode-dropdown:focus,
.difficulty-dropdown:focus {
  outline: none;
  border-color: var(--kk-green);
  box-shadow: 0 0 0 2px rgba(21, 32, 22, 0.1);
}

.btn-primary {
  border-radius: var(--r-btn);
  padding: 12px 24px;
  color: var(--kk-cream);
  background: var(--grad-green);
  border: none;
  box-shadow: 
    inset 0 0 0 1px rgba(214,166,58,.55),
    var(--shadow-soft);
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  letter-spacing: -0.01em;
  box-sizing: border-box;
  outline: none;
  overflow: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
  will-change: transform;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 
    inset 0 0 0 1px rgba(214,166,58,.55),
    var(--shadow-punchy);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-btn);
  padding: 12px 20px;
  background: rgba(246, 243, 234, 0.9);
  color: var(--text);
  border: 1px solid rgba(31, 107, 59, 0.35);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease, background 0.2s ease;
  letter-spacing: -0.01em;
  box-sizing: border-box;
  outline: none;
}

.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.95);
}

.btn-secondary:active {
  transform: translateY(0);
}

[data-theme="night"] .btn-secondary {
  background: rgba(246, 243, 234, 0.08);
  color: var(--text);
  border-color: rgba(246, 243, 234, 0.18);
}

[data-theme="night"] .btn-secondary:hover {
  background: rgba(246, 243, 234, 0.15);
}

/* ============================================
   Play Area
   ============================================ */
.play-area {
  flex: 1;
  position: relative;
  background: rgba(255,255,255,.3);
  border-radius: var(--r-card);
  border: 1px solid var(--panel-border);
  overflow: hidden;
  min-height: 0;
  z-index: 1;
}

.health-display {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 6px;
  align-items: center;
  z-index: 100;
  background: rgba(255, 255, 255, 0.6);
  padding: 8px 12px;
  border-radius: var(--r-card);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(4px);
}

.game-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 1000;
  pointer-events: none;
}

.game-message h2 {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  text-shadow: 0 4px 12px rgba(0,0,0,.2);
}

.game-message-logo {
  height: 180px;
  width: auto;
  max-width: 90%;
  object-fit: contain;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.2));
}

/* When logo and h2 appear together (game over), adjust spacing */
.game-message .game-message-logo + h2 {
  margin-top: 8px;
  margin-bottom: 16px;
}

.game-message p {
  font-size: 20px;
  color: var(--muted);
  font-weight: 600;
}

.game-hint {
  position: absolute;
  bottom: 12px;
  right: 16px;
  font-size: 11px;
  color: rgba(21, 32, 22, 0.6);
  font-weight: 400;
  pointer-events: none;
  user-select: none;
  z-index: 1000;
  opacity: 0.6;
  transition: opacity 0.3s ease, transform 0.3s ease;
  display: block !important;
  visibility: visible !important;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
}

.game-hint:hover {
  opacity: 0.8;
}

/* Animation for mixed mode hint */
.game-hint.animate-attention {
  animation: hintPulse 1.5s ease-in-out 3, hintSlideIn 0.5s ease-out;
}

@keyframes hintPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.6;
    background: rgba(255, 255, 255, 0.1);
  }
  50% {
    transform: scale(1.08);
    opacity: 0.9;
    background: rgba(214, 166, 58, 0.2);
  }
}

@keyframes hintSlideIn {
  from {
    transform: translateX(20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 0.6;
  }
}

/* Hide hint during gameplay */
[data-game-running="true"] .game-hint {
  opacity: 0 !important;
  pointer-events: none;
  visibility: hidden !important;
}

/* ============================================
   Target Circles
   ============================================ */
.target {
  position: absolute;
  border-radius: 999px;
  box-shadow: 0 10px 20px rgba(0,0,0,.18);
  transform: translateZ(0);
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
  --anim-speed: 1;
  animation: popIn calc(0.3s * var(--anim-speed)) ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(0,0,0,.1);
}

/* Number inside circle */
.target-number {
  font-weight: 800;
  color: var(--kk-white);
  text-shadow: 0 2px 8px rgba(0,0,0,.4);
  pointer-events: none;
  user-select: none;
  line-height: 1;
}

/* Multi-Click Mode: Progress States */
.target.multi-click.hit-progress {
  outline: 3px solid rgba(214,166,58,.8);
  outline-offset: -3px;
  border-color: rgba(214,166,58,.6);
}

/* Progress indicator for multi-click circles */
.target.multi-click.hit-progress::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 999px;
  border: 4px solid var(--kk-gold);
  border-top-color: transparent;
  border-right-color: transparent;
  animation: spin 0.6s linear infinite;
  pointer-events: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.target.hit {
  animation: hitPop calc(0.18s * var(--anim-speed)) ease-out, hitVanish calc(0.24s * var(--anim-speed)) cubic-bezier(0.22, 1, 0.36, 1) calc(0.14s * var(--anim-speed)) forwards;
}

.target.miss {
  animation: missVanish calc(0.22s * var(--anim-speed)) ease-in forwards;
}

.target-burst {
  position: absolute;
  width: var(--burst-size, 72px);
  height: var(--burst-size, 72px);
  left: 0;
  top: 0;
  pointer-events: none;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  z-index: 30;
}

.target-burst::before,
.target-burst::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
}

.target-burst--hit::before {
  border: 4px solid color-mix(in srgb, var(--burst-color, var(--kk-green)) 72%, white);
  opacity: 0.85;
  animation: burstRing 0.45s ease-out forwards;
}

.target-burst--hit::after {
  background: radial-gradient(circle, color-mix(in srgb, var(--burst-color, var(--kk-green)) 50%, white) 0%, transparent 72%);
  animation: burstGlow 0.45s ease-out forwards;
}

.target-burst--miss::before {
  border: 4px solid rgba(235, 87, 87, 0.85);
  opacity: 0.8;
  animation: burstRing 0.4s ease-out forwards;
}

.target-burst--miss::after {
  background: radial-gradient(circle, rgba(235, 87, 87, 0.35) 0%, transparent 70%);
  animation: burstGlow 0.4s ease-out forwards;
}

.score-popup {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  font-size: 22px;
  font-weight: 900;
  color: var(--kk-white);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 35;
  animation: scoreRise 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ============================================
   Animations
   ============================================ */
@keyframes popIn {
  from {
    transform: scale(.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes hitPop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: scale(0.8);
  }
}

@keyframes hitVanish {
  to {
    opacity: 0;
    transform: scale(1.38);
    filter: blur(1.8px);
  }
}

@keyframes missVanish {
  to {
    opacity: 0;
    transform: scale(0.72);
    filter: grayscale(0.4) blur(1px);
  }
}

@keyframes burstRing {
  0% {
    transform: scale(0.4);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

@keyframes burstGlow {
  0% {
    transform: scale(0.5);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

@keyframes scoreRise {
  0% {
    opacity: 0;
    transform: translate(-50%, -35%) scale(0.8);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -65%) scale(1.04);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -145%) scale(1);
  }
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
  .hud {
    flex-direction: column;
    align-items: stretch;
  }

  .hud-left,
  .hud-right {
    justify-content: center;
  }

  .hud-stats {
    justify-content: center;
    flex-wrap: wrap;
  }

  .logo {
    height: 48px;
  }

  .stat-value {
    font-size: 18px;
  }

  .game-message h2 {
    font-size: 36px;
  }

  .game-message p {
    font-size: 18px;
  }

  /* Hide button groups and show dropdowns on mobile */
  .gamemode-buttons,
  .difficulty-buttons {
    display: none;
  }

  .gamemode-dropdown,
  .difficulty-dropdown {
    display: block;
  }

  /* Hide "Kevert" button on mobile */
  #mode-mixed {
    display: none !important;
  }
}

/* Hide dropdowns on desktop */
@media (min-width: 769px) {
  .gamemode-dropdown,
  .difficulty-dropdown {
    display: none !important;
  }
}

/* ============================================
   Floating Stats Button
   ============================================ */
.stats-floating-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--grad-green);
  border: none;
  box-shadow: 
    inset 0 0 0 2px rgba(214, 166, 58, 0.4),
    var(--shadow-punchy);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--kk-cream);
  z-index: 1000;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  padding: 0;
  overflow: hidden;
  will-change: transform;
  box-sizing: border-box;
  outline: none;
}

.stats-floating-btn::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.35), transparent 65%);
  pointer-events: none;
  z-index: 1;
}

.stats-floating-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.stats-floating-btn:active {
  transform: scale(1.05);
}

.stats-floating-btn svg {
  position: relative;
  z-index: 2;
  width: 24px;
  height: 24px;
  color: currentColor;
}

/* ============================================
   Settings Floating Button
   ============================================ */
.settings-floating-container {
  position: fixed;
  bottom: 24px;
  right: 96px;
  z-index: 1000;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 12px;
}

.settings-floating-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--grad-green);
  border: none;
  box-shadow: 
    inset 0 0 0 2px rgba(214, 166, 58, 0.4),
    var(--shadow-punchy);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--kk-cream);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  padding: 0;
  overflow: hidden;
  will-change: transform;
  box-sizing: border-box;
  outline: none;
  position: relative;
  flex-shrink: 0;
}

.settings-floating-btn::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.35), transparent 65%);
  pointer-events: none;
  z-index: 1;
}

.settings-floating-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.settings-floating-btn:active {
  transform: scale(1.05);
}

.settings-floating-btn svg {
  position: relative;
  z-index: 2;
  width: 24px;
  height: 24px;
  color: currentColor;
  transition: transform 0.3s ease;
}

.settings-floating-btn:hover svg {
  transform: rotate(90deg);
}

/* Quick Action Buttons */
.settings-quick-action-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--grad-green);
  border: none;
  box-shadow: 
    inset 0 0 0 2px rgba(214, 166, 58, 0.4),
    var(--shadow-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--kk-cream);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 0;
  overflow: hidden;
  will-change: transform, opacity;
  box-sizing: border-box;
  outline: none;
  opacity: 0;
  transform: translateY(20px) scale(0.8);
  pointer-events: none;
  position: relative;
  flex-shrink: 0;
}

.settings-floating-container:hover .settings-quick-action-btn {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.settings-floating-container:hover .settings-quick-action-btn:nth-of-type(1) {
  transition-delay: 0.05s;
}

.settings-floating-container:hover .settings-quick-action-btn:nth-of-type(2) {
  transition-delay: 0.1s;
}

.settings-quick-action-btn::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.35), transparent 65%);
  pointer-events: none;
  z-index: 1;
}

.settings-quick-action-btn:hover {
  transform: scale(1.15) translateY(0);
  box-shadow: 
    inset 0 0 0 2px rgba(214, 166, 58, 0.4),
    0 8px 24px rgba(0, 0, 0, 0.25);
}

.settings-quick-action-btn:active {
  transform: scale(1.05) translateY(0);
}

.settings-quick-action-btn svg {
  position: relative;
  z-index: 2;
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  display: block;
}

.settings-quick-action-btn svg[style*="display: none"] {
  display: none !important;
}

/* ============================================
   Stats Modal
   ============================================ */
.stats-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.stats-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.stats-modal-content {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-punchy);
  backdrop-filter: blur(12px);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.stats-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid var(--panel-border);
}

.stats-modal-header h2 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0;
  font-family: system-ui, "Segoe UI", "Arial Rounded MT Bold", Arial, sans-serif;
}

.stats-modal-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(14, 59, 34, 0.1);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  padding: 0;
}

.stats-modal-close:hover {
  background: rgba(14, 59, 34, 0.2);
  transform: rotate(90deg);
}

.stats-modal-close:active {
  transform: rotate(90deg) scale(0.95);
}

.stats-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* ============================================
   Settings Modal
   ============================================ */
.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.settings-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.settings-modal-content {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-punchy);
  backdrop-filter: blur(12px);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.settings-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid var(--panel-border);
}

.settings-modal-header h2 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0;
  font-family: system-ui, "Segoe UI", "Arial Rounded MT Bold", Arial, sans-serif;
}

.settings-modal-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(14, 59, 34, 0.1);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  padding: 0;
}

.settings-modal-close:hover {
  background: rgba(14, 59, 34, 0.2);
  transform: rotate(90deg);
}

.settings-modal-close:active {
  transform: rotate(90deg) scale(0.95);
}

.settings-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Settings Sections */
.settings-section {
  margin-bottom: 32px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--kk-green);
  margin-bottom: 20px;
  font-family: system-ui, "Segoe UI", "Arial Rounded MT Bold", Arial, sans-serif;
}

.settings-control-group {
  margin-bottom: 24px;
}

.settings-control-group:last-child {
  margin-bottom: 0;
}

.settings-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

/* Volume Control */
.settings-volume-control {
  display: flex;
  align-items: center;
  gap: 16px;
}

.settings-slider {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: rgba(14, 59, 34, 0.1);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--grad-green);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(214, 166, 58, 0.4);
}

.settings-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--grad-green);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(214, 166, 58, 0.4);
  border: none;
}

.settings-volume-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--kk-green);
  min-width: 50px;
  text-align: right;
}

/* Toggle Switch */
.settings-toggle-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.settings-toggle {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.settings-toggle-slider {
  position: relative;
  width: 52px;
  height: 28px;
  background: rgba(14, 59, 34, 0.2);
  border-radius: 28px;
  transition: background 0.3s ease;
  flex-shrink: 0;
}

.settings-toggle-slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--kk-white);
  top: 3px;
  left: 3px;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.settings-toggle:checked + .settings-toggle-slider {
  background: var(--kk-green);
}

.settings-toggle:checked + .settings-toggle-slider::before {
  transform: translateX(24px);
}

.settings-toggle-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

/* Stats Sections */
.stats-section {
  margin-bottom: 32px;
}

.stats-section:last-child {
  margin-bottom: 0;
}

.stats-section h3 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  letter-spacing: -0.01em;
  font-family: system-ui, "Segoe UI", "Arial Rounded MT Bold", Arial, sans-serif;
}

.stats-section p {
  font-size: 16px;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.6;
}

.stats-section strong {
  color: var(--kk-green);
  font-weight: 700;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.stats-card {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-card);
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.stats-card-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stats-card-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--kk-green);
  line-height: 1;
}

/* Mode Comparison */
.stats-mode-comparison {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.stats-mode-item {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-card);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.stats-mode-item h4 {
  font-size: 20px;
  font-weight: 700;
  color: var(--kk-green);
  margin-bottom: 12px;
  font-family: system-ui, "Segoe UI", "Arial Rounded MT Bold", Arial, sans-serif;
}

.stats-mode-item p {
  margin-bottom: 6px;
  font-size: 15px;
}

/* Gamemode Container */
.stats-gamemode-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 16px;
}

.stats-gamemode-card {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-card);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  width: 100%;
}

.stats-gamemode-card h4 {
  font-size: 20px;
  font-weight: 700;
  color: var(--kk-green);
  margin-bottom: 16px;
  font-family: system-ui, "Segoe UI", "Arial Rounded MT Bold", Arial, sans-serif;
}

.stats-difficulty-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: rgba(246, 243, 234, 0.5);
  padding: 4px;
  border-radius: var(--r-btn);
  border: 1px solid var(--panel-border);
}

.stats-difficulty-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  border-radius: calc(var(--r-btn) - 2px);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
}

.stats-tab-label {
  flex: 1;
  text-align: center;
}

.stats-tab-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--kk-green);
  background: rgba(31, 107, 59, 0.1);
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  line-height: 1.4;
}

.stats-difficulty-tab:hover {
  background: rgba(255, 255, 255, 0.5);
}

.stats-difficulty-tab.active {
  background: var(--kk-white);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.stats-gamemode-content {
  min-height: 120px;
}

.stats-gamemode-stats {
  display: block;
}

.stats-gamemode-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 8px;
}

.stats-gamemode-stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-btn);
  text-align: center;
}

.stats-gamemode-stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.stats-gamemode-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--kk-green);
  line-height: 1;
}

/* Chart Container */
.stats-chart-container {
  margin-top: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-card);
  height: 300px;
  position: relative;
}

#stats-performance-chart {
  width: 100% !important;
  height: 100% !important;
}

/* Recent Runs */
.stats-recent-runs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  max-height: 300px;
  overflow-y: auto;
}

.stats-run-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-btn);
  transition: background 0.2s ease;
}

.stats-run-item:hover {
  background: rgba(255, 255, 255, 0.8);
}

.stats-run-date {
  font-size: 14px;
  color: var(--muted);
  flex: 1;
}

.stats-run-score {
  font-size: 16px;
  font-weight: 700;
  color: var(--kk-green);
  margin: 0 16px;
}

.stats-run-accuracy {
  font-size: 14px;
  color: var(--muted);
  padding: 4px 12px;
  background: rgba(31, 107, 59, 0.1);
  border-radius: 12px;
  font-weight: 600;
}

.stats-run-meta {
  font-size: 12px;
  color: var(--muted);
  margin-left: 8px;
}

/* Daily Stats */
.stats-daily {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.stats-day-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-btn);
}

.stats-day-date {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
  flex: 1;
}

.stats-day-runs {
  font-size: 14px;
  color: var(--muted);
  margin: 0 16px;
}

.stats-day-best {
  font-size: 14px;
  font-weight: 700;
  color: var(--kk-gold);
}

/* Badge for Personal Bests */
.stats-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--grad-gold);
  color: var(--kk-cream);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 8px;
  box-shadow: 0 2px 8px rgba(214, 166, 58, 0.3);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .stats-floating-btn {
    width: 56px;
    height: 56px;
    bottom: 16px;
    right: 16px;
  }

  .stats-floating-btn svg {
    width: 20px;
    height: 20px;
  }

  .settings-floating-container {
    bottom: 16px;
    right: 80px;
    gap: 10px;
  }

  .settings-floating-btn {
    width: 56px;
    height: 56px;
  }

  .settings-floating-btn svg {
    width: 20px;
    height: 20px;
  }

  .settings-quick-action-btn {
    width: 48px;
    height: 48px;
  }

  .settings-quick-action-btn svg {
    width: 18px;
    height: 18px;
  }

  .settings-modal-content {
    max-width: 95%;
  }

  .settings-modal-header {
    padding: 16px;
  }

  .settings-modal-header h2 {
    font-size: 24px;
  }

  .settings-modal-body {
    padding: 16px;
  }

  .stats-modal {
    padding: 8px;
  }

  .stats-modal-content {
    max-height: 95vh;
  }

  .stats-modal-header {
    padding: 16px;
  }

  .stats-modal-header h2 {
    font-size: 24px;
  }

  .stats-modal-body {
    padding: 16px;
  }

  .stats-mode-comparison {
    grid-template-columns: 1fr;
  }

  .stats-gamemode-card {
    padding: 16px;
  }

  .stats-difficulty-tabs {
    flex-wrap: wrap;
  }

  .stats-difficulty-tab {
    min-width: calc(50% - 2px);
    padding: 6px 8px;
    font-size: 11px;
    gap: 4px;
  }

  .stats-tab-count {
    font-size: 9px;
    padding: 1px 5px;
    min-width: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stats-gamemode-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stats-gamemode-stat-item {
    padding: 10px;
  }

  .stats-gamemode-stat-value {
    font-size: 18px;
  }

  .stats-chart-container {
    height: 250px;
    padding: 12px;
  }

  .stats-run-item {
    flex-wrap: wrap;
    gap: 8px;
  }

  .stats-run-score {
    margin: 0;
  }
}

/* ============================================
   Blog Page
   ============================================ */
body:has(.blog-page) {
  overflow: auto;
}

.blog-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
}

.blog-header {
  background: var(--panel);
  border-bottom: 1px solid var(--panel-border);
  box-shadow: var(--shadow-soft);
  position: sticky;
  top: 0;
  z-index: 100;
}

.blog-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.blog-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.blog-brand:hover {
  color: var(--text);
}

.blog-logo-link,
.blog-brand {
  line-height: 1;
}

.blog-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.blog-wordmark {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-family: system-ui, "Segoe UI", "Arial Rounded MT Bold", Arial, sans-serif;
}

.blog-tagline {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--panel-border);
}

@media (max-width: 640px) {
  .blog-wordmark {
    font-size: 18px;
  }

  .blog-tagline {
    font-size: 12px;
    padding-left: 8px;
    margin-left: 0;
  }
}

.blog-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.blog-hero {
  padding: 48px 16px 32px;
  text-align: center;
}

.blog-hero-inner {
  max-width: 720px;
  margin: 0 auto;
}

.blog-title {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 12px;
  font-family: system-ui, "Segoe UI", "Arial Rounded MT Bold", Arial, sans-serif;
}

.blog-subtitle {
  font-size: 18px;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.5;
}

.blog-main {
  flex: 1;
  padding: 0 16px 48px;
}

.blog-container {
  max-width: 1200px;
  margin: 0 auto;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.blog-grid-loading,
.blog-grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 16px;
  font-size: 16px;
  color: var(--muted);
  font-weight: 500;
}

/* Blog article card */
.blog-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-punchy);
  border-color: rgba(31, 107, 59, 0.3);
}

.blog-card:focus-within {
  outline: 2px solid var(--kk-green);
  outline-offset: 2px;
}

.blog-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.blog-card-thumb {
  aspect-ratio: 16 / 10;
  width: 100%;
  object-fit: cover;
  background: var(--kk-green-dark);
}

.blog-card-body {
  padding: 20px;
}

.blog-card-meta {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--kk-green);
  margin-bottom: 8px;
}

.blog-card-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 10px;
  color: var(--text);
  font-family: system-ui, "Segoe UI", "Arial Rounded MT Bold", Arial, sans-serif;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.blog-card-meta-row time {
  font-weight: 500;
}

.blog-card-reading-time::before {
  content: "·";
  margin-right: 12px;
  font-weight: 700;
}

.blog-card-excerpt {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-cta {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--kk-green);
  transition: color 0.2s ease;
}

.blog-card:hover .blog-card-cta {
  color: var(--kk-green-dark);
}

[data-theme="night"] .blog-card {
  background: rgba(14, 59, 34, 0.35);
  border-color: var(--panel-border);
}

[data-theme="night"] .blog-card:hover {
  border-color: rgba(246, 243, 234, 0.25);
}

[data-theme="night"] .blog-card-meta {
  color: var(--kk-gold);
}

[data-theme="night"] .blog-card-cta {
  color: var(--kk-gold);
}

[data-theme="night"] .blog-card:hover .blog-card-cta {
  color: var(--kk-cream);
}

/* Article page (single post) */
.article-main {
  flex: 1;
  padding: 32px 16px 48px;
}

.article-content {
  max-width: 720px;
  margin: 0 auto;
}

.article-header {
  margin-bottom: 32px;
}

.article-meta {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--kk-green);
  margin-bottom: 8px;
}

.article-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 12px;
  font-family: system-ui, "Segoe UI", "Arial Rounded MT Bold", Arial, sans-serif;
}

.article-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
}

.article-meta-row time {
  font-weight: 500;
}

.article-reading-time::before {
  content: "·";
  margin-right: 12px;
  font-weight: 700;
}

.article-body {
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
}

.article-body p {
  margin-bottom: 1em;
}

.article-body p:last-child {
  margin-bottom: 0;
}

.article-body h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-family: system-ui, "Segoe UI", "Arial Rounded MT Bold", Arial, sans-serif;
}

.article-body h2:first-child {
  margin-top: 0;
}

.article-body strong {
  color: var(--kk-green);
  font-weight: 700;
}

[data-theme="night"] .article-body strong {
  color: var(--kk-gold);
}

.article-body h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  margin-top: 1.25em;
  margin-bottom: 0.5em;
  font-family: system-ui, "Segoe UI", "Arial Rounded MT Bold", Arial, sans-serif;
}

.article-body h1:first-child {
  margin-top: 0;
}

.article-body h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-top: 1.25em;
  margin-bottom: 0.4em;
  font-family: system-ui, "Segoe UI", "Arial Rounded MT Bold", Arial, sans-serif;
}

.article-body h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-top: 1em;
  margin-bottom: 0.35em;
  font-family: system-ui, "Segoe UI", "Arial Rounded MT Bold", Arial, sans-serif;
}

.article-body ul,
.article-body ol {
  margin: 0.75em 0 1em;
  padding-left: 1.5em;
}

.article-body li {
  margin-bottom: 0.35em;
}

.article-body li:last-child {
  margin-bottom: 0;
}

.article-body code {
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
  font-size: 0.9em;
  background: rgba(14, 59, 34, 0.1);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--text);
}

[data-theme="night"] .article-body code {
  background: rgba(246, 243, 234, 0.12);
}

.article-body pre {
  margin: 1em 0;
  padding: 16px;
  background: rgba(14, 59, 34, 0.08);
  border-radius: var(--r-btn);
  overflow-x: auto;
  border: 1px solid var(--panel-border);
}

[data-theme="night"] .article-body pre {
  background: rgba(246, 243, 234, 0.08);
}

.article-body pre code {
  background: none;
  padding: 0;
  font-size: 14px;
}

.article-body a {
  color: var(--kk-green);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-body a:hover {
  color: var(--kk-green-dark);
}

[data-theme="night"] .article-body a {
  color: var(--kk-gold);
}

[data-theme="night"] .article-body a:hover {
  color: var(--kk-cream);
}

.article-body blockquote {
  margin: 1em 0;
  padding: 0.5em 0 0.5em 1em;
  border-left: 4px solid var(--kk-green);
  color: var(--muted);
}

[data-theme="night"] .article-body blockquote {
  border-left-color: var(--kk-gold);
}

.article-body hr {
  margin: 1.5em 0;
  border: none;
  border-top: 1px solid var(--panel-border);
}

.article-loading,
.article-error {
  color: var(--muted);
}

.article-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--panel-border);
}

@media (max-width: 640px) {
  .article-title {
    font-size: 28px;
  }

  .article-body {
    font-size: 16px;
  }

  .article-body h2 {
    font-size: 20px;
  }
}

.blog-footer {
  margin-top: auto;
  padding: 24px 16px;
  border-top: 1px solid var(--panel-border);
  background: var(--panel);
}

.blog-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.blog-footer-text {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
  margin: 0;
}

@media (max-width: 1024px) {
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .blog-hero {
    padding: 32px 16px 24px;
  }

  .blog-title {
    font-size: 32px;
  }

  .blog-subtitle {
    font-size: 16px;
  }

  .blog-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .blog-logo {
    height: 40px;
  }
}