﻿:root {
      --bg-top: #f4efe2;
      --bg-bottom: #dff3ec;
      --panel: rgba(255, 252, 246, 0.9);
      --panel-strong: #fffdf9;
      --line: rgba(24, 41, 54, 0.12);
      --text: #1c2c37;
      --muted: #5f6f78;
      --primary: #11795d;
      --primary-dark: #0a5844;
      --secondary: #ef8f34;
      --accent: #1f9ed3;
      --ok: #1f9b73;
      --error: #d94a58;
      --shadow: 0 22px 50px rgba(28, 44, 55, 0.14);
      --radius-xl: 28px;
      --radius-lg: 20px;
      --radius-md: 14px;
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      font-family: "Nunito", sans-serif;
      color: var(--text);
      background:
        radial-gradient(circle at top left, rgba(239, 143, 52, 0.2), transparent 26%),
        radial-gradient(circle at bottom right, rgba(31, 158, 211, 0.18), transparent 30%),
        linear-gradient(145deg, var(--bg-top), var(--bg-bottom));
    }

.page-shell {
      flex: 1;
      width: min(1240px, 100%);
      margin: 0 auto;
      padding: 14px 14px 12px;
    }

    .site-header .nav-wrap {
      min-height: 58px;
    }

    .site-header .logo-home {
      min-height: 58px;
    }

    .site-header .logo img {
      height: 52px;
    }

    .site-header .menu a {
      padding: 0.42rem 0.68rem;
      font-size: 0.88rem;
    }

    .shell {
      width: min(1220px, 100%);
      margin: 0 auto;
      display: grid;
      gap: 18px;
    }

    .panel {
      background: var(--panel);
      border: 1px solid rgba(255, 255, 255, 0.75);
      border-radius: var(--radius-xl);
      box-shadow: var(--shadow);
      backdrop-filter: blur(16px);
    }

    .hero {
      position: static;
      min-height: 0;
      height: auto;
      display: grid;
      grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.8fr);
      gap: 18px;
      align-items: start;
      overflow: visible;
    }

    .hero__copy,
    .hero__card {
      background: var(--panel);
      border: 1px solid rgba(255, 255, 255, 0.75);
      border-radius: var(--radius-xl);
      box-shadow: var(--shadow);
      backdrop-filter: blur(16px);
      padding: 22px;
    }

.hero__copy {
      position: relative;
      overflow: hidden;
      background:
        radial-gradient(circle at top right, rgba(31, 158, 211, 0.2), transparent 38%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(240, 251, 246, 0.9));
    }

.hero__copy::after {
      content: "";
      position: absolute;
      right: -44px;
      bottom: -46px;
      width: 110px;
      height: 110px;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(17, 121, 93, 0.2), rgba(17, 121, 93, 0));
      pointer-events: none;
    }

.hero__card {
      background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(249, 255, 252, 0.98));
    }

.hero__card h2 {
      margin-bottom: 8px;
      color: #0f2f3c;
    }

    .eyebrow {
      margin: 0;
      display: inline-flex;
      width: fit-content;
      border: 1px solid rgba(17, 121, 93, 0.2);
      border-radius: 999px;
      background: rgba(17, 121, 93, 0.1);
      color: #0e5c46;
      font-size: 0.8rem;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      font-weight: 800;
      padding: 0.34rem 0.65rem;
    }

    h1, h2, h3 {
      margin: 0;
      font-family: "Chakra Petch", sans-serif;
    }

    .hero h1 {
      font-size: clamp(2rem, 3.2vw, 3.15rem);
      letter-spacing: -0.03em;
      line-height: 0.95;
      max-width: 18ch;
      color: #0f2f3c;
      text-shadow: 0 10px 24px rgba(17, 121, 93, 0.12);
    }

    .hero__text {
      margin: 0.65rem 0 0;
      color: var(--muted);
      line-height: 1.45;
      max-width: 70ch;
      font-size: 0.96rem;
    }

    .instruction-list {
      margin: 0;
      padding-left: 18px;
      color: var(--muted);
      line-height: 1.58;
      font-weight: 700;
    }

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

    .layout {
      display: grid;
      grid-template-columns: minmax(0, 2fr) minmax(300px, 0.95fr);
      gap: 18px;
      align-items: start;
    }

    .panel { padding: 22px; min-width: 0; }

    .status-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
    }

    .status-card {
      border: 1px solid rgba(17, 121, 93, 0.12);
      border-radius: var(--radius-lg);
      background: var(--panel-strong);
      padding: 12px;
    }

    .status-label {
      display: block;
      color: var(--muted);
      font-size: 0.83rem;
      margin-bottom: 6px;
      font-weight: 700;
    }

    .status-value {
      font-size: 1.25rem;
      font-weight: 800;
      color: #123442;
    }

    .status-value.timer-warning {
      color: var(--error);
      animation: pulse 700ms ease-in-out infinite;
    }

    @keyframes pulse {
      0% { opacity: 1; }
      50% { opacity: 0.6; }
      100% { opacity: 1; }
    }

    .box {
      margin-top: 12px;
      border: 1px solid var(--line);
      border-radius: var(--radius-md);
      background: var(--panel-strong);
      color: #38515f;
      padding: 12px 13px;
      line-height: 1.58;
      font-weight: 600;
    }

    .player-box {
      margin-top: 0;
      border-color: rgba(239, 143, 52, 0.42);
      background:
        linear-gradient(135deg, rgba(255, 247, 234, 0.98), rgba(242, 255, 250, 0.98));
      box-shadow: 0 14px 30px rgba(239, 143, 52, 0.12);
    }

    .field-label {
      display: block;
      margin-bottom: 8px;
      color: var(--primary-dark);
      font-weight: 800;
    }

    .text-input {
      width: 100%;
      min-height: 48px;
      border: 1px solid rgba(239, 143, 52, 0.55);
      border-radius: 12px;
      padding: 11px 13px;
      color: var(--text);
      background: #fff;
      font: inherit;
      font-weight: 700;
    }

    .text-input:focus {
      outline: 4px solid rgba(239, 143, 52, 0.22);
      border-color: rgba(239, 143, 52, 0.9);
    }

    .helper-text {
      margin: 9px 0 0;
      color: var(--muted);
      font-size: 0.9rem;
      line-height: 1.4;
    }

    .player-start-btn {
      width: 100%;
      margin-top: 12px;
    }

    .ranking-box__head {
      display: flex;
      justify-content: space-between;
      gap: 10px;
      align-items: center;
      margin-bottom: 10px;
    }

    .mini-button {
      border: 1px solid rgba(17, 121, 93, 0.18);
      border-radius: 10px;
      padding: 7px 10px;
      cursor: pointer;
      color: var(--primary-dark);
      background: rgba(17, 121, 93, 0.08);
      font-size: 0.86rem;
      font-weight: 800;
    }

    .leaderboard-list {
      display: grid;
      gap: 10px;
      list-style: none;
      padding: 0;
      margin: 0;
    }

    .leaderboard-item,
    .leaderboard-empty {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto;
      gap: 10px;
      align-items: center;
      padding: 10px;
      border-radius: 12px;
      background: rgba(17, 121, 93, 0.06);
      border: 1px solid rgba(17, 121, 93, 0.08);
    }

    .leaderboard-empty {
      grid-template-columns: 1fr;
      color: var(--muted);
    }

    .leaderboard-rank {
      display: inline-flex;
      justify-content: center;
      align-items: center;
      width: 26px;
      height: 26px;
      border-radius: 50%;
      background: var(--primary);
      color: #fff;
      font-size: 0.85rem;
      font-weight: 800;
    }

    .leaderboard-player {
      display: block;
      overflow-wrap: anywhere;
      font-weight: 800;
    }

    .leaderboard-meta {
      display: block;
      color: var(--muted);
      font-size: 0.85rem;
    }

    .leaderboard-score {
      font-family: "Chakra Petch", sans-serif;
      font-size: 1.05rem;
      color: var(--primary-dark);
      font-weight: 800;
    }

    .challenge-head {
      display: flex;
      justify-content: space-between;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
      margin-bottom: 12px;
    }

    .challenge-meta {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
    }

    .tag {
      border-radius: 999px;
      padding: 6px 10px;
      border: 1px solid rgba(17, 121, 93, 0.22);
      background: rgba(17, 121, 93, 0.1);
      color: #0e5d48;
      font-size: 0.76rem;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      font-weight: 800;
    }

    .timer-box {
      border-radius: 12px;
      border: 1px solid rgba(17, 121, 93, 0.22);
      background: linear-gradient(135deg, rgba(17, 121, 93, 0.12), rgba(31, 158, 211, 0.12));
      padding: 6px 10px;
      display: grid;
      line-height: 1.1;
      min-width: 108px;
    }

    .timer-box .status-label {
      margin: 0 0 4px;
      font-size: 0.7rem;
      color: #255465;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      font-weight: 800;
    }

    .timer-box .status-value {
      color: #0f2f3c;
      font-size: 1.1rem;
    }

    .tech-strip {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: 12px;
    }

    .tech-pill {
      border-radius: 999px;
      border: 1px solid rgba(31, 158, 211, 0.2);
      background: rgba(31, 158, 211, 0.12);
      color: #0f5f7f;
      font-size: 0.76rem;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      padding: 5px 9px;
      font-weight: 800;
    }

    .game-frame {
      border: 1px solid rgba(90, 235, 207, 0.22);
      border-radius: 22px;
      overflow: hidden;
      background:
        linear-gradient(170deg, rgba(6, 30, 45, 0.98), rgba(10, 48, 60, 0.96));
      box-shadow: inset 0 0 0 1px rgba(108, 235, 206, 0.08), 0 18px 34px rgba(7, 35, 50, 0.36);
      position: relative;
      padding: 14px;
    }

    .game-frame::before {
      content: "";
      position: absolute;
      inset: 0;
      pointer-events: none;
      background:
        linear-gradient(transparent 32px, rgba(141, 217, 255, 0.13) 33px, transparent 34px),
        linear-gradient(90deg, transparent 32px, rgba(141, 217, 255, 0.09) 33px, transparent 34px);
      background-size: 34px 34px;
      opacity: 0.25;
    }

    .game-frame::after {
      content: "";
      position: absolute;
      inset: 0;
      pointer-events: none;
      background:
        radial-gradient(circle at 14% 12%, rgba(52, 234, 189, 0.22), transparent 34%),
        radial-gradient(circle at 88% 84%, rgba(255, 188, 92, 0.2), transparent 30%);
      opacity: 0.7;
    }

    .arena-layer {
      position: relative;
      z-index: 1;
    }

    .row-head {
      display: flex;
      justify-content: space-between;
      gap: 8px;
      margin: 8px 2px 6px;
      color: #c8dde8;
      font-size: 0.75rem;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      font-weight: 800;
    }

    .row {
      display: grid;
      grid-template-columns: repeat(12, minmax(0, 1fr));
      gap: 8px;
      margin-top: 0;
    }

    .cell,
    .slot {
      min-height: 66px;
      border-radius: 12px;
      border: 1px solid rgba(206, 239, 255, 0.34);
      display: grid;
      place-items: center;
      text-align: center;
      font-weight: 800;
      font-size: 0.87rem;
      padding: 5px;
      user-select: none;
      position: relative;
      overflow: hidden;
    }

    .cell {
      background: rgba(236, 249, 255, 0.18);
      color: #d8ecf6;
      box-shadow: inset 0 0 0 1px rgba(226, 245, 255, 0.1);
    }

    .slot {
      background: rgba(255, 255, 255, 0.08);
      cursor: pointer;
      transition: transform 140ms ease, border-color 140ms ease;
      color: #f7fdff;
    }

    .slot:hover {
      transform: translateY(-1px);
      border-color: #90d1e8;
    }

    .slot.active {
      border-color: #ffd280;
      box-shadow: 0 0 0 3px rgba(255, 177, 66, 0.2);
    }

    .slot.error {
      border-color: var(--error);
      background: rgba(217, 74, 88, 0.22);
    }

    .controls {
      display: grid;
      gap: 12px;
      margin-top: 14px;
    }

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

    button {
      border: 0;
      border-radius: 14px;
      padding: 12px 10px;
      font: inherit;
      font-weight: 800;
      cursor: pointer;
      transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
    }

    button:hover {
      transform: translateY(-1px);
      filter: saturate(1.03);
    }

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

    .cmd {
      border: 1px solid rgba(17, 121, 93, 0.14);
      background: linear-gradient(135deg, #d9f2eb, #f7fbf4);
      color: #0f5c47;
    }

    .actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .btn {
      background: linear-gradient(135deg, var(--primary), var(--primary-dark));
      color: #fff;
      box-shadow: 0 14px 26px rgba(17, 121, 93, 0.24);
    }

    .btn.ghost {
      box-shadow: none;
      border: 1px solid var(--line);
      color: var(--text);
      background: #ffffff;
    }

    .msg {
      margin-top: 12px;
      border: 1px solid var(--line);
      border-radius: var(--radius-md);
      background: var(--panel-strong);
      color: #304957;
      font-weight: 700;
      padding: 10px 12px;
      min-height: 44px;
      display: flex;
      align-items: center;
      line-height: 1.45;
    }

    .msg.success {
      border-color: #b7ead6;
      background: #f1fff8;
      color: #1f7b56;
    }

    .msg.error {
      border-color: #ffd0db;
      background: #fff4f8;
      color: #b93153;
    }

    .chip-c { background: linear-gradient(135deg, #4ca1d4, #3181af); color: #f2fcff; border-color: rgba(142, 217, 255, 0.55); }
    .chip-d { background: linear-gradient(135deg, #34b88c, #1a8764); color: #f4fff9; border-color: rgba(124, 240, 199, 0.54); }
    .chip-e { background: linear-gradient(135deg, #f4aa52, #cb7b1e); color: #fff8ef; border-color: rgba(255, 205, 133, 0.5); }
    .chip-a { background: linear-gradient(135deg, #e77a8f, #b84563); color: #fff4f7; border-color: rgba(255, 182, 201, 0.5); }
    .chip-b { background: linear-gradient(135deg, #63bcde, #2e7f9e); color: #ecf9ff; border-color: rgba(172, 234, 255, 0.5); }
    .chip-g { background: linear-gradient(135deg, #9f92e0, #6652ba); color: #f6f2ff; border-color: rgba(191, 180, 255, 0.5); }
    .chip-rest { background: linear-gradient(135deg, #8ca2b5, #607788); color: #edf4f8; border-color: rgba(200, 221, 233, 0.48); }

    .motif-grid {
      margin-top: 12px;
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
    }

    .motif-card {
      border: 1px solid var(--line);
      border-radius: var(--radius-md);
      padding: 10px;
      background: var(--panel-strong);
      display: grid;
      gap: 5px;
    }

    .motif-card strong {
      font-family: "Chakra Petch", sans-serif;
      color: #113542;
      font-size: 0.98rem;
    }

    .motif-card span {
      color: var(--muted);
      font-size: 0.89rem;
      line-height: 1.4;
    }

    @media (max-width: 1060px) {
      .hero { grid-template-columns: 1fr; }
      .layout { grid-template-columns: 1fr; }
    }

    @media (max-width: 880px) {
      .panel { padding: 18px; }
      .row { grid-template-columns: repeat(6, minmax(0, 1fr)); }
      .actions .btn { width: 100%; }
      .palette { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    }

    @media (max-width: 560px) {
      .row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
      .palette { grid-template-columns: repeat(3, minmax(0, 1fr)); }
      .motif-grid { grid-template-columns: 1fr; }
      .hero__copy,
      .hero__card { padding: 14px; }
      .panel { padding: 14px; }
      h1 { font-size: 1.65rem; max-width: 100%; }
    }
