/* ─── PATCH NOTES — Styles ──────────────────────────────────────────── */

/* ═══ CUSTOM PROPERTIES ═══ */
:root {
  --bg-deep: #06060e;
  --bg: #0a0a18;
  --bg-card: #0f0f24;
  --bg-card-hover: #14143a;
  --border: #1a1a3e;
  --border-bright: #2a2a5e;

  --text: #c8c8e0;
  --text-dim: #6a6a8e;
  --text-bright: #eeeef8;

  --green: #00ff88;
  --green-dim: #00cc6a;
  --green-glow: rgba(0, 255, 136, 0.15);

  --orange: #ff6b35;
  --orange-dim: #cc5528;
  --orange-glow: rgba(255, 107, 53, 0.15);

  --purple: #a855f7;
  --purple-dim: #8b3ed4;

  --red: #ff3366;
  --red-glow: rgba(255, 51, 102, 0.15);

  --cyan: #22d3ee;
  --yellow: #fbbf24;

  --font-pixel: 'Press Start 2P', monospace;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  --radius: 4px;
  --transition: 150ms ease;
}

/* ═══ RESET ═══ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-mono);
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: var(--font-pixel);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input {
  font-family: var(--font-mono);
  border: none;
  background: none;
  color: inherit;
  outline: none;
}

ul { list-style: none; }
a { color: var(--green); text-decoration: none; }

.hidden { display: none !important; }

/* ═══ CRT SCANLINES ═══ */
#scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.06) 2px,
    rgba(0, 0, 0, 0.06) 4px
  );
}

/* ═══ NOISE ═══ */
#noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.03;
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAABlBMVEUAAAD///+l2Z/dAAAAAnRSTlMAGovxNEIAAAA4SURBVHja7c0BDQAgAMBAmH/oD2GZWMN7OLqfGwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4BcNGAABFCrdJgAAAABJRU5ErkJggg==");
  background-size: 64px;
}

/* ═══ LOADING SCREEN ═══ */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeOutLoader 0.4s ease 0.6s forwards;
}

.loader-content {
  text-align: center;
}

.loader-title {
  font-family: var(--font-pixel);
  font-size: 1.5rem;
  color: var(--green);
  text-shadow: 0 0 20px var(--green-glow), 0 0 40px rgba(0,255,136,0.1);
  margin-bottom: 2rem;
  animation: glitchFlicker 2s ease infinite;
}

.loader-bar-track {
  width: 240px;
  height: 8px;
  background: var(--border);
  margin: 0 auto 1.5rem;
  image-rendering: pixelated;
  box-shadow: inset 0 0 0 2px var(--border-bright);
}

.loader-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--green);
  animation: loadBar 0.6s ease-out forwards;
  box-shadow: 0 0 8px var(--green);
}

.loader-sub {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--text-dim);
  letter-spacing: 2px;
  animation: blink 0.8s step-end infinite;
}

@keyframes loadBar {
  0% { width: 0%; }
  30% { width: 45%; }
  60% { width: 70%; }
  90% { width: 95%; }
  100% { width: 100%; }
}

@keyframes fadeOutLoader {
  to { opacity: 0; pointer-events: none; }
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ═══ GLITCH EFFECT ═══ */
.glitch {
  position: relative;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.glitch::before {
  color: var(--cyan);
  animation: glitch1 3s infinite linear;
  clip-path: inset(0 0 80% 0);
}

.glitch::after {
  color: var(--red);
  animation: glitch2 3s infinite linear;
  clip-path: inset(80% 0 0 0);
}

@keyframes glitch1 {
  0%, 93%, 100% { transform: translate(0); }
  94% { transform: translate(-2px, 1px); }
  95% { transform: translate(2px, -1px); }
  96% { transform: translate(0); }
}

@keyframes glitch2 {
  0%, 96%, 100% { transform: translate(0); }
  97% { transform: translate(2px, 1px); }
  98% { transform: translate(-2px, -1px); }
  99% { transform: translate(0); }
}

@keyframes glitchFlicker {
  0%, 97%, 100% { opacity: 1; }
  98% { opacity: 0.8; transform: translate(-1px, 0); }
  99% { opacity: 0.9; transform: translate(1px, 0); }
}

/* ═══ APP LAYOUT ═══ */
#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ═══ HEADER ═══ */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 12px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 80px;
}

.header-left { justify-content: flex-start; }
.header-right { justify-content: flex-end; }

.header-center {
  text-align: center;
  flex: 1;
}

.title {
  font-family: var(--font-pixel);
  font-size: 1.1rem;
  color: var(--green);
  text-shadow: 0 0 20px var(--green-glow);
  letter-spacing: 2px;
  line-height: 1.4;
}

.subtitle {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: var(--text-dim);
  letter-spacing: 3px;
  margin-top: 6px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 0.7rem;
  transition: all var(--transition);
}

.icon-btn:hover {
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 0 10px var(--green-glow);
}

.icon-btn svg { display: block; }

/* ═══ GAME META ═══ */
.game-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}

.stage-track {
  display: flex;
  gap: 4px;
}

.stage-pip {
  width: 40px;
  height: 8px;
  background: var(--border);
  transition: all 0.4s ease;
  position: relative;
}

.stage-pip.revealed {
  background: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
}

.stage-pip.active {
  background: var(--green);
}

.stage-pip.active::after {
  content: '';
  position: absolute;
  inset: -4px;
  background: var(--green);
  border-radius: 2px;
  opacity: 0;
  animation: pipPulse 1.5s ease infinite;
  z-index: -1;
}

@keyframes pipPulse {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.35; }
}

.guess-pips {
  display: flex;
  gap: 4px;
}

.guess-pip {
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  transition: all 0.3s ease;
}

.guess-pip.used {
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 0 6px var(--red-glow);
}

.guess-pip.correct {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 6px var(--green-glow);
}

/* ═══ NOTES CONTAINER ═══ */
#notes-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.stage-block {
  border: 1px solid var(--border);
  background: var(--bg-card);
  padding: 12px 16px;
  animation: slideIn 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stage-block::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
}

.stage-block.s1::before { background: var(--green); }
.stage-block.s2::before { background: var(--cyan); }
.stage-block.s3::before { background: var(--purple); }
.stage-block.s4::before { background: var(--orange); }
.stage-block.s5::before { background: var(--red); }

.stage-header {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  letter-spacing: 2px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stage-block.s1 .stage-header { color: var(--green); }
.stage-block.s2 .stage-header { color: var(--cyan); }
.stage-block.s3 .stage-header { color: var(--purple); }
.stage-block.s4 .stage-header { color: var(--orange); }
.stage-block.s5 .stage-header { color: var(--red); }

.stage-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.note-line {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text);
  padding: 2px 0 2px 12px;
  border-left: 1px solid var(--border);
  margin-left: 2px;
  opacity: 0;
  animation: noteAppear 0.3s ease forwards;
}

.note-line .cursor {
  display: inline-block;
  width: 6px;
  height: 14px;
  background: var(--green);
  margin-left: 2px;
  animation: blink 0.6s step-end infinite;
  vertical-align: middle;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes noteAppear {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ═══ INPUT AREA ═══ */
.input-area {
  margin-bottom: 24px;
}

.search-wrapper {
  position: relative;
  margin-bottom: 12px;
}

.input-border {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  padding: 0 14px;
  height: 48px;
  transition: all var(--transition);
}

.input-border:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 12px var(--green-glow), inset 0 0 12px rgba(0,255,136,0.03);
}

.input-border.input-error {
  border-color: var(--red);
  box-shadow: 0 0 12px var(--red-glow);
  animation: inputShake 0.4s ease;
}

@keyframes inputShake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-4px); }
  30% { transform: translateX(4px); }
  45% { transform: translateX(-3px); }
  60% { transform: translateX(2px); }
  75% { transform: translateX(-1px); }
}

.input-caret {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--green);
  flex-shrink: 0;
}

#guess-input {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  height: 100%;
  color: var(--text-bright);
}

#guess-input::placeholder {
  color: var(--text-dim);
  font-weight: 400;
  letter-spacing: 1px;
  font-size: 0.75rem;
}

/* ═══ AUTOCOMPLETE ═══ */
#autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 2px solid var(--border-bright);
  max-height: min(220px, 40vh);
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

#autocomplete-dropdown::-webkit-scrollbar {
  width: 6px;
}

#autocomplete-dropdown::-webkit-scrollbar-track {
  background: var(--bg);
}

#autocomplete-dropdown::-webkit-scrollbar-thumb {
  background: var(--border-bright);
}

.ac-item {
  padding: 10px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.ac-item:last-child { border-bottom: none; }

.ac-item:hover,
.ac-item.active {
  background: var(--bg-card-hover);
  color: var(--green);
}

.ac-item .ac-genre {
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-left: auto;
  font-family: var(--font-pixel);
}

.ac-empty {
  padding: 10px 14px;
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: 1px;
}

.ac-highlight {
  color: var(--green);
  font-weight: 700;
}

/* ═══ BUTTONS ═══ */
.action-buttons {
  display: flex;
  gap: 8px;
}

.btn {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  letter-spacing: 1px;
  padding: 14px 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid;
  transition: all var(--transition);
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.05), transparent);
  pointer-events: none;
}

.btn-primary {
  background: var(--green);
  border-color: var(--green);
  color: var(--bg-deep);
  flex: 1;
}

.btn-primary:hover {
  background: var(--green-dim);
  box-shadow: 0 0 20px var(--green-glow);
  transform: translateY(-1px);
}

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

.btn-primary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-bright);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 12px rgba(34,211,238,0.15);
  transform: translateY(-1px);
}

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

.btn-secondary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-icon {
  font-size: 0.9rem;
  line-height: 1;
}

/* ═══ FEEDBACK CONTAINER ═══ */
#feedback-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feedback-row {
  border: 1px solid var(--border);
  background: var(--bg-card);
  padding: 12px 14px;
  animation: feedbackSlide 0.4s ease;
}

@keyframes feedbackSlide {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

.feedback-title {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--red);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.feedback-title .x-mark {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--red);
  clip-path: polygon(20% 0%, 0% 20%, 30% 50%, 0% 80%, 20% 100%, 50% 70%, 80% 100%, 100% 80%, 70% 50%, 100% 20%, 80% 0%, 50% 30%);
}

.feedback-attrs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.fb-attr {
  text-align: center;
  padding: 6px 4px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.fb-attr-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
  display: block;
}

.fb-attr-value {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  font-weight: 700;
  display: block;
}

.fb-attr.match {
  border-color: var(--green);
  background: rgba(0,255,136,0.08);
}
.fb-attr.match .fb-attr-value { color: var(--green); }

.fb-attr.adjacent {
  border-color: var(--yellow);
  background: rgba(251,191,36,0.08);
}
.fb-attr.adjacent .fb-attr-value { color: var(--yellow); }

.fb-attr.miss {
  border-color: var(--border);
}
.fb-attr.miss .fb-attr-value { color: var(--text-dim); }

.fb-attr.direction {
  border-color: var(--orange);
  background: rgba(255,107,53,0.08);
}
.fb-attr.direction .fb-attr-value { color: var(--orange); }

/* ═══ RESULT OVERLAY ═══ */
#result-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6,6,14,0.85);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease;
  padding: 20px;
}

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

.result-card {
  background: var(--bg-card);
  border: 2px solid var(--border-bright);
  padding: 32px 28px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  animation: resultPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

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

.result-card.win {
  border-color: var(--green);
  box-shadow: 0 0 40px var(--green-glow), inset 0 0 40px rgba(0,255,136,0.03);
}

.result-card.lose {
  border-color: var(--red);
  box-shadow: 0 0 40px var(--red-glow);
}

.result-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  line-height: 1;
}

.result-title {
  font-family: var(--font-pixel);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.result-card.win .result-title { color: var(--green); }
.result-card.lose .result-title { color: var(--red); }

.result-game {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 20px;
}

.result-stats {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: var(--text-dim);
  margin-bottom: 24px;
  line-height: 2;
}

.result-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.result-actions .btn { flex: 1; }

.next-puzzle {
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  color: var(--text-dim);
  letter-spacing: 1px;
}

/* ═══ MODALS ═══ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6,6,14,0.8);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 2px solid var(--border-bright);
  padding: 28px 24px;
  max-width: 440px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  animation: resultPop 0.3s ease;
}

.modal-content::-webkit-scrollbar {
  width: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
  background: var(--border-bright);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 1.4rem;
  color: var(--text-dim);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover {
  color: var(--text-bright);
}

.modal-content h2 {
  font-family: var(--font-pixel);
  font-size: 0.75rem;
  color: var(--green);
  margin-bottom: 20px;
  letter-spacing: 2px;
}

.modal-content h3 {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--cyan);
  margin: 20px 0 12px;
  letter-spacing: 2px;
}

.help-body p {
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.7;
}

.help-body ul {
  padding-left: 0;
}

.help-body li {
  font-size: 0.8rem;
  color: var(--text);
  padding: 4px 0 4px 16px;
  position: relative;
}

.help-body li::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--green);
  font-family: var(--font-pixel);
  font-size: 0.5rem;
}

.stage-explain {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 0.75rem;
}

.stage-tag {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid;
  flex-shrink: 0;
}

.stage-tag.s1 { color: var(--green); border-color: var(--green); }
.stage-tag.s2 { color: var(--cyan); border-color: var(--cyan); }
.stage-tag.s3 { color: var(--purple); border-color: var(--purple); }
.stage-tag.s4 { color: var(--orange); border-color: var(--orange); }
.stage-tag.s5 { color: var(--red); border-color: var(--red); }

.feedback-legend {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.fb-match, .fb-adjacent, .fb-miss {
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  padding: 4px 10px;
  border: 1px solid;
}

.fb-match {
  color: var(--green);
  border-color: var(--green);
  background: rgba(0,255,136,0.08);
}

.fb-adjacent {
  color: var(--yellow);
  border-color: var(--yellow);
  background: rgba(251,191,36,0.08);
}

.fb-miss {
  color: var(--text-dim);
  border-color: var(--border);
}

/* ═══ STATS ═══ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-item {
  text-align: center;
  padding: 12px 8px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.stat-value {
  display: block;
  font-family: var(--font-pixel);
  font-size: 1rem;
  color: var(--green);
  margin-bottom: 6px;
}

.stat-label {
  display: block;
  font-family: var(--font-pixel);
  font-size: 0.35rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.distribution {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.dist-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dist-label {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: var(--text-dim);
  width: 16px;
  text-align: right;
  flex-shrink: 0;
}

.dist-bar {
  height: 22px;
  background: var(--border);
  min-width: 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 6px;
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  color: var(--text-dim);
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dist-bar.highlight {
  background: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
}

/* ═══ CONFETTI CANVAS ═══ */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10001;
}

/* ═══ SCREEN SHAKE ═══ */
.shake {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(5px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}

/* ═══ WIN GLOW ═══ */
.win-glow {
  animation: winPulse 1.5s ease;
}

@keyframes winPulse {
  0% { box-shadow: 0 0 0 rgba(0,255,136,0); }
  50% { box-shadow: 0 0 60px var(--green-glow), 0 0 120px rgba(0,255,136,0.05); }
  100% { box-shadow: 0 0 0 rgba(0,255,136,0); }
}

/* ═══ TOAST ═══ */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 2px solid var(--green);
  padding: 12px 24px;
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--green);
  z-index: 10002;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 1.5s forwards;
  box-shadow: 0 0 20px var(--green-glow);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 480px) {
  .title {
    font-size: 0.85rem;
  }

  .subtitle {
    font-size: 0.35rem;
  }

  .feedback-attrs {
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;
  }

  .fb-attr {
    padding: 4px 2px;
  }

  .fb-attr-label {
    font-size: 0.5rem;
  }

  .fb-attr-value {
    font-size: 0.4rem;
  }

  .stage-pip {
    width: 32px;
    height: 6px;
  }

  .btn {
    padding: 12px 14px;
    font-size: 0.45rem;
  }

  .result-card {
    padding: 24px 20px;
  }

  .modal-content {
    padding: 24px 18px;
  }
}

@media (max-width: 360px) {
  .feedback-attrs {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ═══ FOCUS INDICATORS ═══ */
.icon-btn:focus-visible,
.btn:focus-visible,
.modal-close:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  box-shadow: 0 0 10px var(--green-glow);
}

.ac-item:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: -2px;
  background: var(--bg-card-hover);
  color: var(--green);
}

#guess-input:focus-visible {
  outline: none; /* handled by parent .input-border:focus-within */
}

/* ═══ REDUCED MOTION ═══ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══ SELECTION ═══ */
::selection {
  background: var(--green);
  color: var(--bg-deep);
}
