/* Scoped game styles — dark neumorphism (matches site theme) */
.game-shell {
  --bg: #1a1d23;
  --bg-deep: #14161b;
  --surface: #1e2229;
  --surface-raised: #232830;

  --text: #e6e8ec;
  --text-soft: #c4c8d0;
  --muted: #8b919c;

  --accent: #7eb8a8;
  --accent-dim: #5a8f82;
  --accent-glow: rgba(126, 184, 168, 0.18);

  --fret: #c8c8c8;
  --good: #3dd68c;
  --bad: #e85d5d;
  --warn: #e6b84d;
  --partial: #6db3e8;

  --btn: #232830;
  --btn-hover: #2a303a;
  --panel: #1e2229;

  --neu-dark: rgba(0, 0, 0, 0.45);
  --neu-light: rgba(255, 255, 255, 0.04);
  --neu-out:
    8px 8px 16px var(--neu-dark),
    -6px -6px 14px var(--neu-light);
  --neu-out-sm:
    4px 4px 10px var(--neu-dark),
    -3px -3px 8px var(--neu-light);
  --neu-in:
    inset 5px 5px 12px var(--neu-dark),
    inset -4px -4px 10px var(--neu-light);
  --neu-in-sm:
    inset 3px 3px 8px var(--neu-dark),
    inset -2px -2px 6px var(--neu-light);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --font-display: Georgia, "Times New Roman", serif;
}

.game-shell h1 {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
  font-size: 1.6rem;
  color: var(--text);
}

.game-shell .subtitle {
  text-align: center;
  color: var(--muted);
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.game-shell .screen { display: none; }
.game-shell .screen.active { display: block; }

.game-shell .panel {
  background: var(--panel);
  border: none;
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  margin: 0 auto 1rem;
  max-width: 720px;
  box-shadow: var(--neu-out);
}

.game-shell .panel.wide { max-width: 1100px; }

.game-shell .settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem 1.25rem;
}

@media (max-width: 560px) {
  .game-shell .settings-grid { grid-template-columns: 1fr; }
}

.game-shell .group { display: flex; flex-direction: column; gap: 0.4rem; }
.game-shell .group.full { grid-column: 1 / -1; }

.game-shell .group label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.game-shell .hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.game-shell select,
.game-shell input[type="number"],
.game-shell button {
  font: inherit;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--btn);
  color: var(--text);
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  box-shadow: var(--neu-out-sm);
  transition: box-shadow 0.15s ease, color 0.15s ease, filter 0.15s ease;
}

.game-shell select,
.game-shell input[type="number"] {
  box-shadow: var(--neu-in-sm);
  background: var(--bg-deep);
}

.game-shell select:hover,
.game-shell button:hover:not(:disabled) {
  background: var(--btn-hover);
}

.game-shell button:hover:not(:disabled) {
  box-shadow: var(--neu-in-sm);
}

.game-shell button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.game-shell input[type="number"] {
  cursor: text;
  width: 100%;
  max-width: 140px;
}

.game-shell button.primary {
  background: var(--surface-raised);
  background-image: linear-gradient(
    145deg,
    rgba(126, 184, 168, 0.14),
    transparent 55%
  );
  border: none;
  color: var(--accent);
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  font-size: 1.05rem;
  box-shadow: var(--neu-out-sm);
  filter: none;
}

.game-shell button.primary:hover:not(:disabled) {
  filter: none;
  color: var(--text);
  box-shadow: var(--neu-in-sm);
}

.game-shell button.primary.big {
  display: block;
  width: 100%;
  max-width: 420px;
  margin: 0 auto 1.25rem;
  padding: 1rem 1.5rem;
  font-size: 1.25rem;
  border-radius: 12px;
}

.game-shell button.danger {
  background: #2a1c22;
  border: none;
  color: #d4a0a8;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  opacity: 0.9;
  box-shadow: var(--neu-out-sm);
}

.game-shell button.danger:hover:not(:disabled) {
  opacity: 1;
  color: #f0c4c8;
  box-shadow: var(--neu-in-sm);
}

.game-shell button.ghost {
  background: var(--surface-raised);
  color: var(--text-soft);
  font-size: 0.9rem;
}

.game-shell .start-wrap {
  margin-top: 1.35rem;
  text-align: center;
}

.game-shell .start-wrap .primary {
  min-width: 220px;
  font-size: 1.15rem;
  padding: 0.85rem 2rem;
}

.game-shell #screenPlay {
  max-width: 1100px;
  margin: 0 auto;
}

.game-shell .play-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
  position: relative;
}

.game-shell .play-progress {
  font-size: 1rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.game-shell .play-progress span { color: var(--text); }

.game-shell .play-note {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 800;
  color: var(--accent);
  background: var(--bg-deep);
  border: 2px solid rgba(126, 184, 168, 0.45);
  border-radius: var(--radius);
  padding: 0.15rem 1.4rem;
  min-width: 5rem;
  text-align: center;
  letter-spacing: 0.02em;
  line-height: 1.2;
  box-shadow:
    var(--neu-in),
    0 0 28px var(--accent-glow);
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.game-shell .play-note.miss-flash {
  border-color: var(--bad);
  color: var(--bad);
  box-shadow:
    var(--neu-in),
    0 0 28px rgba(232, 93, 93, 0.22);
}

.game-shell .play-note.hit-flash {
  border-color: var(--good);
  color: var(--good);
  box-shadow:
    var(--neu-in),
    0 0 28px rgba(61, 214, 140, 0.22);
}

.game-shell .play-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}

.game-shell .meta-chip {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--surface-raised);
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.85rem;
  box-shadow: var(--neu-out-sm);
  letter-spacing: 0.02em;
}

.game-shell .meta-chip strong {
  color: var(--accent);
  font-weight: 700;
}

.game-shell .meta-chip .count-ok { color: var(--good); }
.game-shell .meta-chip .count-warn { color: var(--warn); }

.game-shell .timer-track {
  height: 10px;
  background: var(--bg-deep);
  border-radius: var(--radius-pill);
  overflow: hidden;
  width: min(420px, 90%);
  border: none;
  box-shadow: var(--neu-in-sm);
}

.game-shell .timer-track.unlimited {
  opacity: 0.35;
}

.game-shell .timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--good), var(--warn), var(--bad));
  transform-origin: left center;
  transform: scaleX(1);
}

.game-shell .timer-track.unlimited .timer-fill {
  background: var(--accent-dim);
  transform: scaleX(1) !important;
}

.game-shell .play-end-wrap {
  position: absolute;
  right: 0;
  top: 0;
}

@media (max-width: 600px) {
  .game-shell .play-end-wrap {
    position: static;
    align-self: flex-end;
  }
}

.game-shell .play-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin: 0.25rem 0 0.85rem;
}

.game-shell .play-actions .primary {
  min-width: 160px;
}

.game-shell .board-wrap {
  max-width: 1100px;
  margin: 0 auto;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.game-shell .fretboard {
  --label-w: 70px;
  --nut-w: 18px;
  --open-w: 52px;
  --fret-min: 52px;
  display: grid;
  grid-template-columns: var(--label-w) var(--open-w) var(--nut-w) repeat(12, minmax(var(--fret-min), 1fr));
  background: linear-gradient(180deg, #5a3a1a 0%, #3d2914 40%, #2a1a0c 100%);
  border-radius: 12px;
  border: 2px solid #1a1008;
  box-shadow:
    inset 0 2px 8px rgba(255, 255, 255, 0.06),
    10px 12px 28px var(--neu-dark),
    -4px -4px 12px var(--neu-light);
  min-width: 820px;
  position: relative;
}

.game-shell .fretboard.bare {
  --label-w: 0px;
  grid-template-columns: var(--open-w) var(--nut-w) repeat(12, minmax(var(--fret-min), 1fr));
  min-width: 740px;
}

.game-shell .fretboard.bare .corner,
.game-shell .fretboard.bare .fret-num,
.game-shell .fretboard.bare .string-label {
  display: none;
}

.game-shell .corner,
.game-shell .fret-num,
.game-shell .string-label,
.game-shell .nut-cell,
.game-shell .open-cell,
.game-shell .fret-cell {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
}

.game-shell .fret-num {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-deep);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.game-shell .fret-num.in-window {
  color: var(--accent);
  background: #1a2824;
  box-shadow: inset 0 -2px 0 var(--accent);
}

.game-shell .corner {
  background: var(--bg-deep);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.game-shell .string-label {
  justify-content: flex-end;
  padding-right: 0.6rem;
  font-weight: 700;
  font-size: 0.95rem;
  background: var(--surface);
  border-right: 1px solid rgba(0, 0, 0, 0.35);
  color: var(--text);
}

.game-shell .nut-cell {
  background: linear-gradient(90deg, #f0e6d0, #d8c8a8);
  border-left: 1px solid #bba88a;
  border-right: 3px solid #eee8dc;
}

.game-shell .open-cell,
.game-shell .fret-cell { border-right: 3px solid var(--fret); }

.game-shell .open-cell.out-window,
.game-shell .fret-cell.out-window {
  opacity: 0.28;
  filter: grayscale(0.35);
}

.game-shell .open-cell.in-window,
.game-shell .fret-cell.in-window {
  background: rgba(126, 184, 168, 0.06);
}

.game-shell .fret-cell::before,
.game-shell .open-cell::before,
.game-shell .nut-cell::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: var(--sw, 2px);
  background: linear-gradient(180deg, #f0e6a8, #b8962e 45%, #6a5418);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  z-index: 1;
  pointer-events: none;
}

.game-shell .open-cell::before { left: 20%; }

.game-shell .fretboard .s0 { --sw: 1.5px; }
.game-shell .fretboard .s1 { --sw: 1.8px; }
.game-shell .fretboard .s2 { --sw: 2.1px; }
.game-shell .fretboard .s3 { --sw: 2.5px; }
.game-shell .fretboard .s4 { --sw: 3px; }
.game-shell .fretboard .s5 { --sw: 3.5px; }

.game-shell .fret-cell.marker-single::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff8e8, #e8dcc4 45%, #a89878);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.4);
  z-index: 0;
  pointer-events: none;
}

.game-shell .fret-cell.marker-double .inlay-pair {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.game-shell .fret-cell.marker-double .inlay-pair span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff8e8, #e8dcc4 45%, #a89878);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.4);
  display: block;
}

.game-shell .fret-btn {
  position: relative;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: transparent;
  color: transparent;
  font-weight: 700;
  font-size: 0.7rem;
  padding: 0;
  cursor: default;
  box-shadow: none;
  transition: transform 0.12s, background 0.15s, border-color 0.15s, color 0.15s;
}

.game-shell .fret-cell.playable .fret-btn,
.game-shell .open-cell.playable .fret-btn {
  cursor: pointer;
  background: rgba(126, 184, 168, 0.14);
  border-color: rgba(126, 184, 168, 0.5);
  color: transparent;
}

.game-shell .fret-cell.playable .fret-btn:hover,
.game-shell .open-cell.playable .fret-btn:hover {
  background: rgba(126, 184, 168, 0.38);
  border-color: var(--accent);
  transform: scale(1.08);
}

.game-shell .fret-btn.selected {
  background: rgba(126, 184, 168, 0.72) !important;
  border-color: #fff !important;
  color: transparent !important;
  transform: scale(1.06);
  box-shadow: 0 0 0 2px rgba(126, 184, 168, 0.35);
}

.game-shell .fret-btn.correct {
  background: var(--good) !important;
  border-color: #fff !important;
  color: #062a18 !important;
}

.game-shell .fret-btn.wrong {
  background: var(--bad) !important;
  border-color: #fff !important;
  color: #fff !important;
}

.game-shell .fret-btn.missed {
  background: rgba(230, 184, 77, 0.92) !important;
  border-color: #fff !important;
  color: #2a1e05 !important;
}

.game-shell .fret-btn.reveal {
  cursor: default;
}

.game-shell .results h2 {
  text-align: center;
  margin-bottom: 1rem;
  font-size: 1.4rem;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.game-shell .status-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.game-shell .stat {
  background: var(--surface-raised);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  border: none;
  box-shadow: var(--neu-in-sm);
}

.game-shell .stat .k {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.game-shell .stat .v {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

.game-shell .stat .v.accent { color: var(--accent); }
.game-shell .stat .v.bad { color: var(--bad); }
.game-shell .stat .v.good { color: var(--good); }

.game-shell table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.game-shell th,
.game-shell td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.game-shell th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.game-shell .legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  justify-content: center;
  margin: 0.5rem 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.game-shell .legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.game-shell .legend i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.game-shell .legend .lg-good { background: var(--good); }
.game-shell .legend .lg-miss { background: var(--warn); }
.game-shell .legend .lg-bad { background: var(--bad); }

.game-shell .continue-btn {
  display: none;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  padding: 0.65rem 1.25rem;
  margin: 0.35rem 0;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--surface-raised);
  background-image: linear-gradient(
    145deg,
    rgba(126, 184, 168, 0.16),
    transparent 55%
  );
  color: var(--accent);
  box-shadow: var(--neu-out-sm);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow 0.15s, transform 0.12s, color 0.15s;
  filter: none;
}

.game-shell .continue-btn:hover {
  filter: none;
  color: var(--text);
  transform: translateY(1px);
  box-shadow: var(--neu-in-sm);
}

.game-shell .continue-btn:active {
  transform: translateY(1px);
  box-shadow: var(--neu-in);
}

.game-shell .continue-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.game-shell .play-note .continue-btn {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
  line-height: 1.2;
  min-width: auto;
  box-shadow: var(--neu-out-sm);
}

.game-shell .play-note .continue-btn:hover {
  color: var(--text);
}

.game-shell .feedback-line {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.35em;
  margin-top: 0.15rem;
}

.game-shell .feedback-line.good { color: var(--good); }
.game-shell .feedback-line.bad { color: var(--bad); }
