/* Steve's Gadget Rain — page-local styles. Same closed neon frame as Alien Invasion and Gadget Snake. */
.tg-page { padding: 20px 0 48px; }
.tg-page .page-hero { padding: 20px 0 4px; }
.tg-page .page-hero p { max-width: 640px; }
.tg-howto { margin: 10px 0 0; padding-left: 20px; color: var(--muted); max-width: 640px; font-size: 15px; line-height: 1.5; }
.tg-howto li { margin: 2px 0; }

.tg-shell {
  max-width: 480px;
  margin: 16px auto 8px;
  background: #050814;
  border: 1px solid rgba(92, 246, 255, 0.28);
  box-shadow:
    0 0 28px rgba(168, 85, 255, 0.14),
    0 0 0 1px rgba(125, 255, 58, 0.08);
  border-radius: 16px;
  overflow: hidden;
}
.tg-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  padding: 8px 12px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9aabc0;
  background: #080d18;
  border-bottom: 1px solid rgba(92, 246, 255, 0.16);
  font-variant-numeric: tabular-nums;
}
.tg-hud b { color: #5cf6ff; font-weight: 800; letter-spacing: 0.02em; }
.tg-hud-end { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.tg-mute, .tg-small {
  appearance: none;
  border: 1px solid rgba(92, 246, 255, 0.35);
  background: transparent;
  color: #d7deee;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 5px 10px;
  min-height: 28px;
  cursor: pointer;
}
.tg-mute[aria-pressed="false"] { border-color: rgba(125, 255, 58, 0.55); color: #7dffc5; }
.tg-mute:hover, .tg-small:hover { color: #5cf6ff; }
.tg-small[hidden] { display: none; }

/* Closed neon frame around the play area, with a stronger glowing bottom edge. */
.tg-stage {
  position: relative;
  background: #050b16;
  border: 2px solid rgba(125, 255, 58, 0.78);
  box-shadow:
    inset 0 0 0 1px rgba(92, 246, 255, 0.22),
    0 0 16px rgba(125, 255, 58, 0.28),
    0 8px 18px rgba(125, 255, 58, 0.2);
  z-index: 1;
}
.tg-stage::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(92, 246, 255, 0.45), #7dffc5 22%, #b6ff3b 50%, #7dffc5 78%, rgba(92, 246, 255, 0.45));
  box-shadow:
    0 0 8px rgba(125, 255, 58, 0.95),
    0 0 18px rgba(125, 255, 58, 0.6),
    0 4px 14px rgba(92, 246, 255, 0.35);
  pointer-events: none;
  z-index: 2;
}
#tg-game {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
  background: #050b16;
  touch-action: none;
  cursor: pointer;
}

.tg-status {
  margin: 0;
  padding: 8px 12px 0;
  text-align: center;
  color: #9aabc0;
  font-size: 13px;
  min-height: 1.3em;
}
.tg-play {
  display: block;
  margin: 8px auto 0;
  appearance: none;
  border: 0;
  background: linear-gradient(90deg, #5cf6ff, #a855ff);
  color: #050b16;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 10px 22px;
  cursor: pointer;
  min-height: 44px;
}
.tg-play[hidden] { display: none; }
.tg-play:hover { filter: brightness(1.08); }
.tg-shell > .tg-play:last-child { margin-bottom: 12px; }

.tg-controls {
  display: none;
  gap: 10px;
  padding: 12px;
  margin-top: 10px;
  background: #080d18;
  border-top: 1px solid rgba(92, 246, 255, 0.16);
}
.tg-controls.is-grid {
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas: ". up ." "left down right";
  gap: 8px;
}
.tg-up { grid-area: up; } .tg-left { grid-area: left; } .tg-down { grid-area: down; } .tg-right { grid-area: right; }
.tg-btn {
  flex: 1;
  appearance: none;
  border: 1px solid rgba(92, 246, 255, 0.3);
  background: #121a2c;
  color: #edf4ff;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 12px;
  min-height: 52px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.tg-btn:active, .tg-btn.is-down { background: rgba(92, 246, 255, 0.16); color: #5cf6ff; }
.tg-btn-alt { flex: 1.35; border-color: rgba(255, 61, 138, 0.45); color: #ff9ac4; }
@media (max-width: 800px), (pointer: coarse) {
  .tg-controls { display: flex; }
  .tg-controls.is-grid { display: grid; }
}

/* Choice rows (difficulty / level pickers). */
.tg-choices { display: flex; gap: 8px; justify-content: center; padding: 10px 12px 0; flex-wrap: wrap; }
.tg-choice {
  appearance: none; border: 1px solid rgba(92, 246, 255, 0.35); background: #0c1424; color: #d7deee;
  font: inherit; font-weight: 700; font-size: 14px; border-radius: 999px; padding: 8px 14px; min-height: 40px; cursor: pointer;
}
.tg-choice[aria-pressed="true"] { border-color: #7dff3a; color: #08150a; background: #7dff3a; box-shadow: 0 0 12px rgba(125, 255, 58, 0.45); }

/* Big friendly answer buttons (learning games). */
.tg-q { margin: 0; padding: 14px 14px 4px; text-align: center; color: #fff; font-size: 24px; font-weight: 800; line-height: 1.25; letter-spacing: -0.01em; }
.tg-answers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 12px; }
.tg-answer {
  appearance: none; border: 2px solid rgba(92, 246, 255, 0.4); background: #0e1628; color: #fff;
  font: inherit; font-weight: 800; font-size: 18px; line-height: 1.2; border-radius: 16px; padding: 10px 6px 12px;
  min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.tg-answer canvas { width: 72px; height: 72px; display: block; }
.tg-answer .tg-num { font-size: 44px; line-height: 1; color: #7dffc5; }
.tg-answer .tg-key { font-size: 11px; color: #6f7f96; font-weight: 700; letter-spacing: 0.08em; }
.tg-answer:hover, .tg-answer:focus-visible { border-color: #5cf6ff; outline: none; box-shadow: 0 0 14px rgba(92, 246, 255, 0.35); }
.tg-answer.is-right { border-color: #7dff3a; background: rgba(125, 255, 58, 0.16); box-shadow: 0 0 16px rgba(125, 255, 58, 0.45); }
.tg-answer.is-wrong { border-color: #ff9a3d; background: rgba(255, 154, 61, 0.12); }
.tg-answer:disabled { cursor: default; }
.tg-answers.is-list { grid-template-columns: 1fr; }
.tg-answers.is-list .tg-answer { flex-direction: row; justify-content: flex-start; text-align: left; min-height: 84px; padding: 10px 14px; gap: 14px; font-size: 18px; }
.tg-answers.is-list .tg-answer canvas { width: 60px; height: 60px; flex: none; }
.tg-answers.is-list .tg-answer .tg-txt { flex: 1; }
.tg-feedback { margin: 0 12px; padding: 12px 14px; border-radius: 14px; background: #0c1424; border: 1px solid rgba(125, 255, 58, 0.35); color: #e8f6ff; font-size: 17px; line-height: 1.45; text-align: center; }
.tg-feedback strong { color: #7dff3a; }
.tg-feedback[hidden] { display: none; }
.tg-stars { color: #ffd84a; letter-spacing: 2px; }

/* Retro DOS terminal. */
.tg-term {
  position: relative;
  background: #020602;
  color: #39ff6a;
  font-family: "Lucida Console", "Courier New", ui-monospace, Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 1.4;
  text-shadow: 0 0 4px rgba(57, 255, 106, 0.55);
  height: 420px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tg-term::before {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.28) 0, rgba(0, 0, 0, 0.28) 1px, transparent 1px, transparent 3px);
  pointer-events: none;
  z-index: 1;
}
.tg-term-out { flex: 1; overflow-y: auto; padding: 12px 12px 4px; white-space: pre-wrap; word-wrap: break-word; scrollbar-width: thin; scrollbar-color: #1d6b2e #020602; }
.tg-term-out p { margin: 0 0 8px; }
.tg-term-out .tg-echo { color: #b8ffc8; }
.tg-term-out .tg-dim { color: #22a845; }
.tg-term-out .tg-hi { color: #d6ff7a; }
.tg-term-in { display: flex; align-items: center; gap: 6px; padding: 8px 12px 12px; border-top: 1px dashed rgba(57, 255, 106, 0.35); position: relative; z-index: 2; }
.tg-term-in label { color: #39ff6a; }
.tg-term-in input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: #b8ffc8; font: inherit;
  text-transform: uppercase; caret-color: #39ff6a; padding: 6px 0;
}
.tg-term-in label { order: -2; }
form.tg-term-in .tg-cursor { order: -1; }
.tg-term-in input:focus ~ .tg-cursor, .tg-term-in input:not(:placeholder-shown) ~ .tg-cursor { display: none; }
.tg-cursor { display: inline-block; width: 0.6em; height: 1.05em; background: #39ff6a; vertical-align: -2px; animation: tg-blink 1s steps(1) infinite; }
@keyframes tg-blink { 50% { opacity: 0; } }
.tg-term-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 0; }
.tg-term-quick button, .tg-key-btn {
  appearance: none; border: 1px solid rgba(57, 255, 106, 0.55); background: #031006; color: #39ff6a;
  font-family: "Lucida Console", "Courier New", ui-monospace, Menlo, Consolas, monospace; font-size: 14px; font-weight: 700;
  border-radius: 6px; padding: 8px 10px; min-height: 42px; cursor: pointer; touch-action: manipulation; text-transform: uppercase;
}
.tg-term-quick button:active, .tg-key-btn:active { background: rgba(57, 255, 106, 0.2); }
.tg-term-quick .tg-inv-chip { border-style: dashed; color: #d6ff7a; }
.tg-keypad { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; padding: 10px 12px 12px; }
.tg-keypad .tg-wide { grid-column: span 2; }
.tg-key-btn[disabled] { opacity: 0.35; }

.tg-hint {
  margin: 10px auto 8px;
  max-width: 480px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.game-more { margin: 0 auto 28px; max-width: 480px; text-align: center; font-size: 14px; }
.game-more a { font-weight: 700; }

.tg-gear { margin: 8px 0 0; }
.tg-gear .section-head { margin-bottom: 16px; }

body.tg-no-scroll { overflow: hidden; overscroll-behavior: none; }

@media (prefers-reduced-motion: reduce) {
  .tg-cursor { animation: none; }
}
@media (max-width: 560px) {
  .tg-page { padding: 8px 0 32px; }
  .tg-page .page-hero { padding: 12px 0 0; }
  .tg-page .page-hero h1 { font-size: 28px; }
  .tg-q { font-size: 22px; }
  .tg-term { height: 380px; font-size: 14px; }
}

/* Kids pages: small label above the title. */
.tg-kids-tag { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 6px; color: #ffd84a; font-size: 13px; font-weight: 700; }
.tg-kids-tag span { display: inline-block; padding: 3px 10px; border-radius: 999px; background: #ffd84a; color: #1a1200; font-size: 11px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; box-shadow: 0 0 12px rgba(255, 216, 74, 0.5); }
