/* SECTION: Design Tokens */
:root {
  /* Calculator palette (plain, orange, neutral) */
  --calc-bg: #e5e5e5;
  --calc-body: #f78b1f;
  --calc-display-bg: #1f1f1f;
  --calc-display-text: #fdfdfd;
  --calc-btn-bg: #ffffff;
  --calc-btn-text: #111111;
  --calc-btn-op-bg: #ffd28a;
  --calc-btn-func-bg: #d6d6d6;
  --calc-btn-border: #b7b7b7;

  /* Game hub: forest green on dark background */
  --hub-bg: #061310; /* near-black green */
  --hub-surface: #0c241b;
  --hub-surface-alt: #133325;
  --hub-accent: #2bbf6a; /* bright forest accent */
  --hub-accent-soft: #1f8d4e;
  --hub-text: #e9f7ee;
  --hub-muted: #9bb8a6;

  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.35);

  --transition-fast: 0.18s ease-out;
}

/* Reset-ish base */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
iframe:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(43, 191, 106, 0.65);
}

/* SECTION: Calculator Theme */
body.theme-calculator {
  background: var(--calc-bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.calc-wrapper {
  width: 100%;
  max-width: 340px;
}

/* Subtle top status bar to mimic device calculator */
.calc-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: rgba(0, 0, 0, 0.55);
  margin-bottom: 4px;
}

.calc-status-left,
.calc-status-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.calc-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
}

.calc-body {
  background: var(--calc-body);
  padding: 16px;
  border-radius: 32px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.25);
}

/* Simple brand strip to mimic manufacturer label */
.calc-brand {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.6);
  text-align: center;
  margin-top: 6px;
}

.calc-display {
  background: var(--calc-display-bg);
  color: var(--calc-display-text);
  font-size: 34px;
  text-align: right;
  padding: 16px 12px 10px;
  border-radius: 10px;
  margin-bottom: 10px;
  letter-spacing: 1px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.65);
}

/* Small memory / mode indicator row under display */
.calc-indicators {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 6px;
}

.calc-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.btn {
  background: var(--calc-btn-bg);
  border: 1px solid var(--calc-btn-border);
  border-radius: 999px;
  padding: 10px 0;
  font-size: 17px;
  color: var(--calc-btn-text);
  cursor: pointer;
  transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  min-height: 44px;
}

.btn:hover {
  background: #f0f0f0;
}

.btn:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2);
}

.btn-op {
  background: var(--calc-btn-op-bg);
}

.btn-func {
  background: var(--calc-btn-func-bg);
}

.btn-zero {
  grid-column: span 2;
  text-align: left;
  padding-left: 24px;
}

/* SECTION: Game Hub Theme */
body.theme-game-hub {
  cursor: none; /* hide default cursor so trail feels cleaner */
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #103625 0, #061310 55%, #020806 100%);
  color: var(--hub-text);
}

.hub-shell {
  min-height: 100vh;
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.hub-header {
  text-align: center;
}

.hub-title {
  margin: 0 0 12px;
  font-size: 28px;
  letter-spacing: -0.02em;
}

.hub-subtitle {
  font-size: 15px;
  color: var(--hub-muted);
  min-height: 1.4em;
}

.caret {
  display: inline-block;
  width: 1ch;
  color: var(--hub-accent);
}

.caret-hidden {
  opacity: 0;
}

.hub-main {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr);
  gap: 24px;
  align-items: flex-start;
}

.hub-search {
  margin-bottom: 12px;
  grid-column: 1 / -1;
}

.game-search-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(233, 247, 238, 0.25);
  background: rgba(6, 19, 16, 0.9);
  color: var(--hub-text);
  font-size: 14px;
}

.game-search-input::placeholder {
  color: var(--hub-muted);
}

.game-search-input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(43, 191, 106, 0.55);
}

/* Game cards */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-content: flex-start;
}

.game-card {
  background: linear-gradient(145deg, var(--hub-surface), var(--hub-surface-alt));
  border-radius: var(--radius-md);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(43, 191, 106, 0.18);
}

.game-title {
  margin: 0 0 6px;
  font-size: 18px;
}

.game-desc {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--hub-muted);
}

.game-launch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  background: var(--hub-accent);
  color: #02140a;
  font-size: 14px;
  cursor: pointer;
  min-width: 120px;
  min-height: 44px;
  transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.game-launch:hover {
  background: var(--hub-accent-soft);
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.game-launch:active {
  transform: translateY(0);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* Mouse trail canvas sits behind content */
#trail-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* Game frame section */
.game-frame-section {
  background: var(--hub-surface);
  border-radius: var(--radius-lg);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(7, 60, 34, 0.8);
}

.frame-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.frame-title {
  margin: 0;
  font-size: 17px;
  color: var(--hub-muted);
}

.frame-fullscreen-btn {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 999px;
  border: 1px solid rgba(233, 247, 238, 0.25);
  background: var(--hub-surface-alt);
  color: var(--hub-text);
  cursor: pointer;
  min-height: 32px;
  transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.frame-fullscreen-btn:hover {
  background: var(--hub-accent-soft);
  box-shadow: 0 0 0 1px rgba(43, 191, 106, 0.4);
}

.frame-fullscreen-btn:active {
  transform: translateY(1px) scale(0.98);
}

.frame-fullscreen-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(43, 191, 106, 0.55);
}

#game-frame {
  width: 100%;
  height: 320px;
  border-radius: 12px;
  border: none;
  background: #000;
}

.frame-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--hub-muted);
}

/* Responsive layout */
@media (max-width: 768px) {
  .hub-main {
    grid-template-columns: 1fr;
  }

  #game-frame {
    height: 260px;
  }
}
