    :root {
      --bg: #080808;
      --ink: #111;
      --paper: #f6f1e9;
      --paper-soft: #e8e0d3;
      --accent: #c0392b;
      --muted: #7d7d7d;
      --line: #2d2d2d;
      --line-heavy: #585858;
      --cell-size: 34px;
      --clue-size: 0.92rem;
      --row-clue-width: 40px;
      --zoom-factor: 1;
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      min-height: 100vh;
      font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Arial, sans-serif;
      background: radial-gradient(circle at top, #121212 0%, var(--bg) 65%);
      color: var(--paper);
    }

    .site-nav {
      position: sticky;
      top: 0;
      z-index: 100;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 20px;
      background: rgba(7, 7, 7, 0.92);
      border-bottom: 1px solid rgba(192, 57, 43, 0.35);
      backdrop-filter: blur(3px);
    }

    .logo-link {
      text-decoration: none;
      color: var(--paper);
      font-size: clamp(1.1rem, 2.2vw, 1.45rem);
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: lowercase;
    }

    .logo-link span { color: var(--accent); }

    .menu-wrap { position: relative; }

    .menu-btn {
      border: 1px solid var(--accent);
      background: rgba(255, 255, 255, 0.04);
      color: var(--paper);
      border-radius: 8px;
      padding: 6px 10px;
      font-size: 1.2rem;
      cursor: pointer;
    }

    .menu-dropdown {
      position: absolute;
      right: 0;
      top: calc(100% + 8px);
      min-width: 170px;
      background: #101010;
      border: 1px solid #2d2d2d;
      border-radius: 10px;
      box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4);
      overflow: hidden;
    }

    .menu-dropdown.hidden { display: none; }

    .menu-dropdown a {
      display: block;
      color: var(--paper-soft);
      text-decoration: none;
      padding: 10px 12px;
      border-bottom: 1px solid #232323;
    }

    .menu-dropdown a:last-child { border-bottom: 0; }
    .menu-dropdown a:hover { background: rgba(192, 57, 43, 0.2); color: var(--paper); }

    .page-shell {
      display: flex;
      justify-content: center;
      padding: 20px;
    }

    .app {
      width: min(100%, 1240px);
      display: flex;
      flex-direction: column;
      gap: 16px;
      position: relative;
    }

    .panel {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid #202020;
      border-radius: 14px;
      padding: 16px;
      backdrop-filter: blur(2px);
    }

    h1, h2 {
      margin: 0 0 10px;
      font-weight: 600;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    h1 { font-size: 1.4rem; }
    h2 { font-size: 1rem; color: var(--paper-soft); }

    .controls {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      align-items: center;
      justify-content: center;
    }

    .controls-top {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      align-items: center;
      margin-bottom: 10px;
    }

    .action-group {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      align-items: center;
      justify-content: center;
      width: 100%;
      margin-bottom: 10px;
    }

    .action-group button {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      min-width: 52px;
      font-size: 1.15rem;
      line-height: 1;
      padding: 10px;
    }

    .action-label {
      display: block;
      font-size: 0.72rem;
      margin-top: 4px;
      letter-spacing: 0.02em;
    }

    .mode-group {
      display: inline-flex;
      gap: 8px;
      flex-wrap: wrap;
      align-items: center;
    }

    button {
      border: 1px solid var(--accent);
      background: transparent;
      color: var(--paper);
      padding: 10px 14px;
      border-radius: 8px;
      cursor: pointer;
      font-size: 0.95rem;
      transition: transform 120ms ease, background 120ms ease;
    }

    button:hover,
    button:focus-visible {
      background: rgba(192, 57, 43, 0.14);
      transform: translateY(-1px);
      outline: none;
    }

    button:disabled {
      opacity: 0.45;
      cursor: not-allowed;
      transform: none;
    }

    button.primary {
      background: var(--accent);
      color: #fff;
    }

    button.toggle-active { background: rgba(192, 57, 43, 0.22); }

    .game-area {
      overflow: auto;
      touch-action: pan-x pan-y;
      border-radius: 10px;
      border: 0;
      background: rgba(0, 0, 0, 0.25);
      padding: clamp(8px, 1.8vw, 14px);
      display: flex;
      justify-content: center;
      align-items: flex-start;
    }

    .nonogram {
      display: inline-grid;
      grid-template-columns: auto auto;
      grid-template-rows: auto auto;
      gap: 0;
      user-select: none;
      touch-action: pan-x pan-y;
      margin: 0 auto;
    }

    .corner {
      border-right: 1px solid #444;
      border-bottom: 1px solid #444;
      width: var(--row-clue-width);
      min-width: var(--row-clue-width);
      min-height: 40px;
    }

    .col-clues {
      display: grid;
      border-bottom: 1px solid #444;
      align-items: end;
    }

    .row-clues {
      display: grid;
      border-right: 1px solid #444;
      align-items: center;
      justify-items: end;
      padding-right: 4px;
      width: var(--row-clue-width);
    }

    .grid {
      display: grid;
      background: #151515;
    }

    .clue {
      color: var(--paper);
      font-size: var(--clue-size);
      font-weight: 700;
      line-height: 1.1;
      opacity: 0.95;
      transition: opacity 150ms ease;
      white-space: pre-line;
      padding: 3px;
    }

    .clue.done {
      color: var(--muted);
      opacity: 0.6;
    }

    .clue.col {
      text-align: center;
      min-width: var(--cell-size);
    }

    .clue.row {
      min-height: var(--cell-size);
      text-align: right;
      white-space: nowrap;
    }

    .board-top-controls,
    .board-bottom-primary,
    .board-bottom-secondary {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      align-items: center;
      justify-content: center;
      margin-bottom: 10px;
    }

    .board-top-controls {
      width: 100%;
      justify-content: space-between;
      gap: 12px;
    }

    .board-top-left,
    .board-top-right {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 220px;
      flex: 1 1 320px;
      flex-wrap: wrap;
    }

    .board-top-left {
      position: relative;
      justify-content: flex-start;
    }

    .board-top-right {
      justify-content: flex-end;
    }

    .timer-status {
      min-width: 80px;
      text-align: center;
      flex: 0 0 auto;
    }

    #zoomBtn {
      flex: 0 0 auto;
    }

    .zoom-panel {
      position: absolute;
      top: calc(100% + 8px);
      left: 0;
      z-index: 20;
      padding: 10px;
      border: 1px solid #2a2a2a;
      border-radius: 14px;
      background: rgba(10, 10, 10, 0.96);
      box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
      min-width: 70px;
    }

    .zoom-controls {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
    }

    .zoom-controls input[type="range"] {
      margin: 0;
      width: 34px;
      height: 170px;
      writing-mode: vertical-lr;
      direction: rtl;
      accent-color: var(--accent);
      touch-action: none;
    }

    .zoom-step {
      width: 42px;
      min-width: 42px;
      padding: 8px;
      font-size: 1.05rem;
      line-height: 1;
    }

    .zoom-fit {
      width: 42px;
      min-width: 42px;
      padding: 7px 0;
      font-size: 0.7rem;
      letter-spacing: 0.03em;
      text-transform: uppercase;
    }

    .zoom-value {
      min-width: 54px;
      text-align: center;
      font-weight: 700;
      letter-spacing: 0.03em;
      font-size: 0.85rem;
    }

    .zoom-panel,
    .board-top-right button {
      flex: 0 0 auto;
    }

    .cell {
      width: var(--cell-size);
      height: var(--cell-size);
      background: var(--paper);
      border: 1px solid var(--line);
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--accent);
      font-weight: 700;
      font-size: calc(var(--cell-size) * 0.5);
      cursor: pointer;
      position: relative;
    }

    .cell.heavy-top { border-top: 2px solid var(--line-heavy); }
    .cell.heavy-left { border-left: 2px solid var(--line-heavy); }

    .cell.hovered:not(.filled):not(.wrong):not(.marked) { background: #efe8dc; }

    .cell.selected {
      outline: 2px solid var(--accent);
      outline-offset: -2px;
      z-index: 2;
    }

    .cell.focus-line:not(.filled):not(.wrong):not(.marked) {
      background: #ece3d6;
    }

    .clue.focus-line {
      color: #fff;
      text-shadow: 0 0 4px rgba(192, 57, 43, 0.5);
    }

    .cell.filled {
      background: var(--ink);
      border-color: #000;
    }

    .cell.filled.ink-drop { animation: ink-drop 120ms ease-out; }

    .cell.wrong {
      background: var(--accent);
      color: #fff;
    }

    .cell.marked {
      background: #d6d6d6;
      color: var(--accent);
    }

    .cell.row-complete,
    .cell.col-complete { animation: row-complete 400ms ease-out; }

    @keyframes ink-drop {
      0% { transform: scale(1); }
      45% { transform: scale(0.82); }
      100% { transform: scale(1); }
    }

    @keyframes row-complete {
      0% { filter: brightness(1); }
      50% { filter: brightness(1.17); }
      100% { filter: brightness(1); }
    }

    .status {
      color: var(--paper-soft);
      font-size: 0.95rem;
      letter-spacing: 0.04em;
    }


    .progress-wrap {
      margin: 2px 0 10px;
    }

    .progress-track {
      margin-top: 6px;
      width: 100%;
      height: 10px;
      border-radius: 999px;
      background: rgba(148, 163, 184, 0.25);
      overflow: hidden;
    }

    .progress-bar {
      width: 0;
      height: 100%;
      background: linear-gradient(90deg, #22c55e 0%, #4ade80 100%);
      transition: width 180ms ease;
    }

    .next-puzzle-wrap {
      display: flex;
      justify-content: center;
      margin-top: 8px;
    }

    .next-puzzle-btn {
      text-decoration: none;
      border: 1px solid var(--accent);
      border-radius: 999px;
      padding: 8px 14px;
      color: var(--paper);
      font-weight: 700;
      letter-spacing: 0.03em;
      background: rgba(255, 255, 255, 0.03);
    }

    .solved-badge {
      min-width: 90px;
      font-weight: 700;
      color: transparent;
    }

    .solved-badge.solved {
      color: #72e29f;
    }

    .lives {
      min-width: 100px;
      letter-spacing: 0.05em;
    }

    .overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.72);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 120;
      padding: 20px;
    }

    .overlay.show { display: flex; }

    .overlay-card {
      border: 1px solid #3a1a17;
      background: #111;
      border-radius: 14px;
      padding: 28px;
      text-align: center;
      width: min(90vw, 360px);
      box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    }

    .new-game-overlay-card {
      text-align: left;
      width: min(92vw, 430px);
    }

    .new-game-group {
      margin-top: 12px;
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
    }

    .new-game-footer {
      margin-top: 16px;
      display: flex;
      justify-content: flex-end;
      gap: 8px;
    }

    .kansei-wrap {
      display: flex;
      justify-content: center;
      align-items: baseline;
      gap: 10px;
      margin: 0 0 14px;
    }

    .kansei {
      font-size: clamp(3rem, 10vw, 4.7rem);
      color: var(--accent);
      letter-spacing: 0.2em;
      margin: 0;
      font-weight: 700;
    }

    .final-time {
      font-size: 1.1rem;
      color: var(--paper-soft);
      letter-spacing: 0.08em;
    }

    .overlay-message {
      margin: 0;
      letter-spacing: 0.02em;
      overflow-wrap: anywhere;
    }

    .hidden { display: none; }

    .celebration-layer {
      position: fixed;
      inset: 0;
      pointer-events: none;
      overflow: hidden;
      z-index: 130;
    }

    .confetti {
      position: absolute;
      top: -20px;
      width: 10px;
      height: 16px;
      border-radius: 2px;
      opacity: 0;
      animation: confetti-fall 1400ms ease-out forwards;
    }

    @keyframes confetti-fall {
      0% { transform: translate3d(0, -5vh, 0) rotate(0deg); opacity: 0; }
      10% { opacity: 1; }
      100% { transform: translate3d(var(--drift, 0px), 105vh, 0) rotate(540deg); opacity: 0; }
    }

    .settings-panel {
      margin-top: 10px;
      border-top: 1px solid #2a2a2a;
      padding-top: 10px;
    }

    .stats-panel {
      margin-top: 12px;
      border-top: 1px solid #2a2a2a;
      padding-top: 12px;
    }


    .stats-title {
      margin: 0 0 10px;
      font-size: 1.05rem;
      font-weight: 700;
      color: var(--paper-soft);
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }
    .stats-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
      gap: 10px;
    }

    .stat-card {
      border: 1px solid #2d2d2d;
      border-radius: 10px;
      padding: 10px;
      background: rgba(255, 255, 255, 0.03);
    }

    .stat-label {
      font-size: 0.8rem;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }

    .stat-value {
      margin-top: 4px;
      font-size: 1.25rem;
      font-weight: 700;
    }

    @media (max-width: 760px) {
      :root {
        --cell-size: 30px;
      }
      .panel { padding: 12px; }
      button { padding: 9px 12px; font-size: 0.9rem; }
      .site-nav { padding: 10px 14px; }
      .page-shell { padding: 14px; }
      .app { gap: 12px; }
      .game-area {
        justify-content: center;
        padding: 8px;
      }
    }


    @media (max-width: 760px) {
      .board-top-controls {
        gap: 10px;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 2px;
      }

      .board-top-left,
      .board-top-right {
        min-width: auto;
        flex: 0 0 auto;
        justify-content: flex-start;
        flex-wrap: nowrap;
      }

      .board-top-left {
        padding-right: 2px;
      }

      .zoom-panel {
        position: fixed;
        top: 50%;
        left: auto;
        right: 12px;
        transform: translateY(-50%);
      }

      .zoom-controls input[type="range"] {
        height: 200px;
      }

      .board-top-right {
        margin-left: auto;
        justify-content: flex-end;
      }
    }

    .theme-toggle {
      border: 1px solid var(--accent);
      background: rgba(255, 255, 255, 0.04);
      color: var(--paper);
      border-radius: 999px;
      padding: 6px 10px;
      cursor: pointer;
      font-size: 0.85rem;
      margin-right: 10px;
    }

    :root[data-theme="light"] {
      --bg: #eceff4;
      --paper: #111827;
      --paper-soft: #334155;
      --muted: #64748b;
      --line: #94a3b8;
      --line-heavy: #64748b;
    }
    :root[data-theme="light"] body {
      background: radial-gradient(circle at top, #ffffff 0%, #eceff4 65%);
      color: var(--paper);
    }
    :root[data-theme="light"] .site-nav { background: rgba(255, 255, 255, 0.97); border-bottom-color: rgba(192, 57, 43, 0.3); }
    :root[data-theme="light"] .logo-link,
    :root[data-theme="light"] .menu-btn,
    :root[data-theme="light"] .theme-toggle { color: var(--paper); background: rgba(255, 255, 255, 0.95); }
    :root[data-theme="light"] .menu-dropdown { background: #fff; border-color: #cbd5e1; }
    :root[data-theme="light"] .menu-dropdown a { color: #1f2937; border-bottom-color: #e2e8f0; }
    :root[data-theme="light"] .menu-dropdown a:hover { color: #111827; }
    :root[data-theme="light"] .panel { background: rgba(255, 255, 255, 0.92); border-color: #cbd5e1; }
    :root[data-theme="light"] .zoom-panel { background: rgba(255, 255, 255, 0.98); border-color: #cbd5e1; }
    :root[data-theme="light"] h1,
    :root[data-theme="light"] h2,
    :root[data-theme="light"] .status,
    :root[data-theme="light"] .final-time { color: var(--paper-soft); }
    :root[data-theme="light"] .game-area { background: rgba(255, 255, 255, 0.95); }
    :root[data-theme="light"] .corner,
    :root[data-theme="light"] .col-clues,
    :root[data-theme="light"] .row-clues { border-color: var(--line-heavy); }
    :root[data-theme="light"] .grid { background: #e2e8f0; }
    :root[data-theme="light"] .clue { color: #0f172a; }
    :root[data-theme="light"] .clue.focus-line { color: #111827; text-shadow: 0 0 4px rgba(192, 57, 43, 0.35); }
    :root[data-theme="light"] .cell { background: #ffffff; border-color: #94a3b8; }
    :root[data-theme="light"] .cell.filled { background: #0f172a; border-color: #020617; }
    :root[data-theme="light"] .cell.marked { background: #e2e8f0; color: #991b1b; }
    :root[data-theme="light"] .cell.wrong { background: #dc2626; color: #fff; }
    :root[data-theme="light"] .cell.focus-line:not(.filled):not(.wrong):not(.marked) { background: #f1f5f9; }
    :root[data-theme="light"] .cell.hovered:not(.filled):not(.wrong):not(.marked) { background: #e2e8f0; }
    :root[data-theme="light"] .overlay-card { background: #ffffff; border-color: #cbd5e1; }
    :root[data-theme="light"] .stats-panel { border-top-color: #cbd5e1; }
    :root[data-theme="light"] .stat-card { background: #fff; border-color: #cbd5e1; }

    #gameScreen {
      display: flex;
      flex-direction: column;
    }

    @media (max-width: 760px) {
      #gameScreen .game-area { order: 1; }
      #gameScreen .action-group { order: 2; }
      #gameScreen .board-bottom-primary { order: 3; }
      #gameScreen .controls { order: 4; }
      #gameScreen #statsPanel { order: 5; }
    }

    #introText {
      margin-bottom: 14px;
    }

    #introText p {
      margin: 0 0 8px;
      color: var(--paper-soft);
      line-height: 1.6;
    }

    .homepage-title {
      margin: 0 0 4px;
      text-align: center;
      color: var(--paper);
      letter-spacing: 0.04em;
    }

    .homepage-hub-link-wrap {
      margin: 0 0 12px;
      text-align: center;
    }

    .homepage-hub-link {
      color: var(--paper-soft);
      text-decoration: none;
      font-weight: 600;
    }

    .homepage-hub-link:hover,
    .homepage-hub-link:focus-visible {
      color: var(--paper);
      text-decoration: underline;
    }

    .site-footer {
      width: min(100%, 1240px);
      margin: 0 auto 20px;
      padding: 16px;
      border: 1px solid var(--accent);
      border-radius: 14px;
      background: transparent;
    }

    .footer-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 16px;
    }

    .footer-title {
      margin: 0 0 8px;
      font-size: 1rem;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      color: var(--paper);
    }

    .footer-list {
      margin: 0;
      padding: 0;
      list-style: none;
    }

    .footer-list li + li {
      margin-top: 6px;
    }

    .footer-list a,
    .site-footer p {
      color: var(--paper-soft);
      text-decoration: none;
      line-height: 1.6;
      margin: 0 0 8px;
    }

    .footer-list a:hover,
    .footer-list a:focus-visible {
      color: var(--paper);
    }

    .footer-copy {
      margin-top: 10px;
      padding-top: 10px;
      border-top: 1px solid var(--accent);
      font-size: 0.9rem;
    }

    @media (max-width: 600px) {
      .footer-grid {
        grid-template-columns: 1fr;
      }
    }
  

    body.specific-solved {
      --accent: #2f9e63;
    }

    body.specific-solved #gameScreen {
      border-color: rgba(72, 194, 126, 0.65);
      box-shadow: 0 0 0 1px rgba(72, 194, 126, 0.18), 0 10px 24px rgba(16, 70, 42, 0.35);
      background: linear-gradient(180deg, rgba(33, 92, 58, 0.22) 0%, rgba(255, 255, 255, 0.03) 55%);
    }

    body.specific-solved .action-group,
    body.specific-solved .board-top-left,
    body.specific-solved .board-top-right,
    body.specific-solved #newGameBtn,
    body.specific-solved #shareBtn,
    body.specific-solved #statsPanel,
    body.specific-solved #lives,
    body.specific-solved #timer {
      display: none !important;
    }

    body.specific-solved .controls {
      justify-content: center;
    }

    body.specific-solved #status {
      color: #9af0bc;
      font-weight: 700;
    }

    #gameScreen.specific-victory-pop {
      animation: specific-victory-pop 460ms ease-out;
    }

    @keyframes specific-victory-pop {
      0% { transform: scale(1); }
      30% { transform: scale(1.01); }
      100% { transform: scale(1); }
    }

/* Category page */
.category-intro {
  max-width: 65ch;
  margin: 0 auto 2rem;
  text-align: center;
  line-height: 1.7;
}

.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  max-width: 900px;
  margin: 0 auto 2rem;
  padding: 0 1rem;
}

.puzzle-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 0.5rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, background 0.2s;
  gap: 0.25rem;
}

.puzzle-card:hover {
  border-color: var(--accent-color, #c0392b);
  background: var(--card-hover-bg, #f9f9f9);
}

.puzzle-card-label {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: capitalize;
}

.puzzle-card-meta {
  font-size: 0.75rem;
  opacity: 0.6;
}
