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

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: 'Courier New', Consolas, monospace;
  background: #ff6a00;
  color: #c8c8dc;
}

/* ======================================================
   COOKIE CONSENT BANNER
   ====================================================== */

.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: #0f0f22;
  border-top: 1px solid #252540;
  font-size: 11px;
  color: #a8a8c4;
  flex-wrap: wrap;
}

.cookie-text { flex: 1; line-height: 1.6; }

.cookie-btn {
  font-family: 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #4dff91;
  background: transparent;
  border: 1px solid #4dff91;
  padding: 5px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s;
}
.cookie-btn:hover { background: rgba(77, 255, 145, 0.1); }

.cookie-link {
  font-size: 10px;
  color: #888aaa;
  text-decoration: underline;
  cursor: pointer;
  white-space: nowrap;
}
.cookie-link:hover { color: #aaaacc; }

/* ======================================================
   ROOT TWO-PANE LAYOUT
   ====================================================== */

.evolution-container {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
}

/* ======================================================
   LEFT PANE
   ====================================================== */

.left-pane {
  width: 50%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #0b0b18;
  border-right: 1px solid #1a1a30;
  overflow: hidden;
}

.panel {
  flex-shrink: 0;
  padding: 12px 16px;
  border-bottom: 1px solid #151525;
}

/* ---- 1. Page header ---- */

.page-eyebrow {
  font-size: 8px;
  letter-spacing: 4px;
  color: #4dff91;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(77, 255, 145, 0.4);
  margin-bottom: 6px;
}

.page-title {
  font-size: 18px;
  letter-spacing: 2px;
  color: #e8e8ff;
  text-transform: uppercase;
  text-shadow: 0 0 16px rgba(140, 140, 255, 0.2);
  margin-bottom: 7px;
  line-height: 1.2;
}

.page-desc {
  font-size: 12px;
  color: #9898b8;
  line-height: 1.7;
}

/* ---- Shared heading row ---- */

.panel-heading-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}

.section-heading {
  font-size: 9px;
  letter-spacing: 3px;
  color: #ffd700;
  text-transform: uppercase;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.25);
}

.info-btn {
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(77, 255, 145, 0.45);
  color: #4dff91;
  font-size: 11px;
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
  line-height: 1;
  padding-top: 1px;
}
.info-btn:hover { background: rgba(77, 255, 145, 0.12); border-color: #4dff91; }

.your-id-btn {
  border-radius: 3px;
  background: transparent;
  border: 1px solid rgba(136, 138, 170, 0.35);
  color: #888aaa;
  font-family: 'Courier New', monospace;
  font-size: 9px;
  font-weight: normal;
  letter-spacing: 1px;
  padding: 0 8px;
  height: 18px;
  cursor: pointer;
  margin-left: auto;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.your-id-btn:hover { background: rgba(136, 138, 170, 0.08); border-color: #888aaa; color: #b0b0cc; }

.section-hint {
  font-size: 8px;
  color: #555568;
  letter-spacing: 1px;
  margin-left: auto;
}

.section-intro {
  font-size: 11px;
  color: #7878a0;
  line-height: 1.65;
  margin-bottom: 8px;
}
.section-intro strong { color: #4dff91; }

/* ---- 2. Versions panel ---- */

.versions-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

.versions-panel .panel-heading-row {
  flex-shrink: 0;
  margin-bottom: 0;
  padding-bottom: 8px;
}

.version-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 12px;
}
.version-list::-webkit-scrollbar { width: 4px; }
.version-list::-webkit-scrollbar-track { background: transparent; }
.version-list::-webkit-scrollbar-thumb { background: #1e1e30; border-radius: 2px; }

.version-card {
  background: #0d0d20;
  border: 1px solid #1a1a2e;
  border-left: 4px solid #1a1a2e;
  padding: 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.1s, border-left-color 0.1s;
}
.version-card:hover { background: #101025; border-left-color: #2e2e50; }
.version-card.active,
.version-card.card--selected { border-left-color: #4dff91; background: #0b0b1e; }

.version-card-inner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.card-thumbnail {
  width: 120px;
  min-width: 120px;
  height: 80px;
  object-fit: contain;
  background: #08080f;
  display: block;
  border: 1px solid #151525;
  flex-shrink: 0;
}

.card-detail {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-version {
  font-size: 12px;
  color: #4dff91;
  letter-spacing: 1px;
  text-shadow: 0 0 6px rgba(77, 255, 145, 0.3);
}

.card-badge {
  font-size: 7px;
  letter-spacing: 2px;
  color: #ffd700;
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.3);
  padding: 2px 5px;
}

.card-date {
  font-size: 9px;
  color: #484860;
  margin-left: auto;
}

.card-description {
  font-size: 11px;
  color: #7070a0;
  line-height: 1.6;
}

/* Feedback table inside version card */
.feedback-table-wrap {
  max-height: 150px;
  overflow-y: auto;
  margin-top: 4px;
}
.feedback-table-wrap::-webkit-scrollbar { width: 3px; }
.feedback-table-wrap::-webkit-scrollbar-thumb { background: #1e1e30; }

.feedback-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9px;
}

.feedback-table th {
  text-align: left;
  color: #555568;
  letter-spacing: 1px;
  padding: 2px 4px;
  border-bottom: 1px solid #1a1a2e;
  font-weight: normal;
  text-transform: uppercase;
}

.feedback-table td {
  color: #7878a0;
  padding: 2px 4px;
  border-bottom: 1px solid #111120;
  vertical-align: top;
  line-height: 1.5;
  word-break: break-word;
}

.feedback-table td:last-child {
  color: #4dff91;
  white-space: nowrap;
  opacity: 0.7;
}

/* ======================================================
   RIGHT PANE
   ====================================================== */

.right-pane {
  flex: 1;
  overflow: hidden;
  background: #010108;
  display: flex;
  flex-direction: column;
}

.game-area {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#game-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  margin: 0;
  padding: 0;
}

/* Feedback panel at bottom of right pane */
.feedback-panel-right {
  flex-shrink: 0;
  height: 200px;
  background: #0a0a18;
  border-top: 1px solid #1a1a30;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 10px 14px 8px;
}

.feedback-panel-right .panel-heading-row {
  flex-shrink: 0;
}

.feedback-panel-right .section-intro {
  flex-shrink: 0;
  font-size: 10px;
  margin-bottom: 5px;
}

.suggestion-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
}

.suggestion-form textarea {
  flex: 1;
  min-height: 0;
  background: #0d0d20;
  border: 1px solid #202035;
  color: #c0c0d8;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.55;
  padding: 6px 10px;
  resize: none;
  outline: none;
  display: block;
}
.suggestion-form textarea:focus { border-color: rgba(77, 255, 145, 0.5); }
.suggestion-form textarea::placeholder { color: #383850; }

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.char-count { font-size: 9px; color: #404058; }
.char-count.near-limit { color: #ff9944; }

.suggestion-form button {
  font-family: 'Courier New', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  color: #4dff91;
  background: transparent;
  border: 1px solid #4dff91;
  padding: 5px 12px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.1s;
  min-height: 44px;
}
.suggestion-form button:hover { background: rgba(77, 255, 145, 0.1); }
.suggestion-form button:disabled { opacity: 0.35; cursor: default; }

#suggestion-status {
  font-size: 10px;
  min-height: 14px;
  color: #4dff91;
  flex-shrink: 0;
}
#suggestion-status.error { color: #ff7766; }

/* ======================================================
   SHARED MODAL STYLES
   ====================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 12, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
}
.modal-backdrop[hidden] { display: none; }

.modal-box {
  background: #0d0d20;
  border: 1px solid #252540;
  width: 580px;
  max-width: 92vw;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 60px rgba(0, 0, 30, 0.8);
}

.modal-box--sm {
  width: 420px;
  max-height: 60vh;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid #1a1a2e;
  flex-shrink: 0;
}

.modal-title {
  font-size: 10px;
  letter-spacing: 3px;
  color: #ffd700;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.25);
}

.modal-close {
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid #2a2a3e;
  color: #888aaa;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: sans-serif;
  transition: border-color 0.1s, color 0.1s;
}
.modal-close:hover { border-color: #ff7766; color: #ff7766; }

.modal-intro {
  font-size: 12px;
  color: #7878a0;
  line-height: 1.75;
  padding: 14px 20px 10px;
  flex-shrink: 0;
}

/* Guardrails list */
.guardrail-list {
  list-style: none;
  overflow-y: auto;
  padding: 0 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}
.guardrail-list::-webkit-scrollbar { width: 5px; }
.guardrail-list::-webkit-scrollbar-track { background: transparent; }
.guardrail-list::-webkit-scrollbar-thumb { background: #1e1e30; border-radius: 2px; }

.guardrail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  background: #0a0a18;
  border-left: 3px solid #1a1a2e;
}

.guardrail-label {
  font-size: 12px;
  color: #c8c8e8;
  letter-spacing: 0.3px;
}

.guardrail-detail {
  font-size: 11px;
  color: #6868a0;
  line-height: 1.6;
}

/* Your ID modal body */
.player-modal-body {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-code-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-code-part {
  flex: 1;
  background: #0d0d20;
  border: 1px solid #252540;
  color: #c8c8e8;
  font-family: 'Courier New', monospace;
  font-size: 16px;
  letter-spacing: 4px;
  padding: 9px 12px;
  outline: none;
  text-transform: uppercase;
  text-align: center;
  min-height: 44px;
}
.user-code-part:focus { border-color: rgba(77, 255, 145, 0.5); }
.user-code-part::placeholder { color: #383850; font-size: 14px; }

.user-code-sep {
  font-size: 18px;
  color: #484860;
  flex-shrink: 0;
}

.user-code-status {
  font-size: 11px;
  min-height: 16px;
  color: #4dff91;
}
.user-code-status.error { color: #ff7766; }
.user-code-status.checking { color: #888aaa; }

.player-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.player-modal-footer button {
  font-family: 'Courier New', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  color: #4dff91;
  background: transparent;
  border: 1px solid #4dff91;
  padding: 7px 18px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.1s;
  min-height: 44px;
}
.player-modal-footer button:hover { background: rgba(77, 255, 145, 0.1); }
.player-modal-footer button:disabled { opacity: 0.35; cursor: default; pointer-events: none; }

.btn-secondary {
  color: #888aaa;
  border-color: #888aaa;
}
.btn-secondary:hover { background: rgba(136, 138, 170, 0.1); }

.btn-google-signin {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Courier New', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #4dff91;
  border: 1px solid #4dff91;
  padding: 10px 20px;
  text-decoration: none;
  transition: background 0.1s;
  min-height: 44px;
}
.btn-google-signin:hover { background: rgba(77, 255, 145, 0.1); }

.modal-anon-note {
  font-size: 11px;
  color: #555570;
  text-align: center;
  margin: 0;
}

.gamer-id-single {
  width: 100%;
  letter-spacing: 2px;
  text-transform: none;
  text-align: left;
  box-sizing: border-box;
}

/* ======================================================
   MOBILE LAYOUT (<768px)
   ====================================================== */

@media (max-width: 767px) {
  html, body { overflow: auto; height: auto; }

  .evolution-container {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .left-pane {
    width: 100%;
    height: auto;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid #1a1a30;
  }

  .versions-panel {
    max-height: 60vh;
    overflow: hidden;
  }

  .right-pane {
    width: 100%;
    height: auto;
    min-height: 50vh;
  }

  .game-area {
    height: 600px;
    min-height: 600px;
    flex: none;
  }

  #game-frame {
    width: 100%;
    height: 600px;
  }

  .feedback-panel-right {
    height: auto;
    min-height: 180px;
  }

  .feedback-panel-right .suggestion-form textarea {
    height: 60px;
  }

  .version-card-inner {
    flex-direction: column;
  }

  .card-thumbnail {
    width: 100%;
    min-width: 0;
    height: 60px;
  }

  .your-id-btn,
  .suggestion-form button,
  .player-modal-footer button,
  .cookie-btn {
    min-height: 44px;
  }

  .modal-box {
    max-width: 98vw;
    max-height: 90vh;
  }
}

/* ======================================================
   MOBILE TAB BAR
   ====================================================== */

.mobile-tab-bar {
  display: none;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: #484860;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 44px;
  transition: color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.tab-btn.tab-active {
  color: #4dff91;
  border-bottom-color: #4dff91;
}

@media (max-width: 767px) {
  /* Tab bar */
  .mobile-tab-bar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 44px;
    background: #0b0b18;
    border-bottom: 1px solid #1a1a30;
    z-index: 500;
    flex-shrink: 0;
  }

  /* Push evolution-container below fixed tab bar */
  .evolution-container {
    margin-top: 44px;
  }

  /* Hide thumbnails -- too much space on mobile */
  .card-thumbnail {
    display: none;
  }

  /* ---- PLAY mode (default on mobile) ---- */
  body[data-tab="play"] {
    overflow: hidden;
    height: 100vh;
  }

  body[data-tab="play"] .evolution-container {
    flex-direction: row;
    height: calc(100vh - 44px);
    min-height: 0;
    overflow: hidden;
    margin-top: 44px;
  }

  body[data-tab="play"] .left-pane {
    display: none;
  }

  body[data-tab="play"] .right-pane {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body[data-tab="play"] .game-area {
    flex: 1;
    height: auto;
    min-height: 0;
  }

  body[data-tab="play"] #game-frame {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  body[data-tab="play"] .feedback-panel-right {
    display: none;
  }

  /* ---- INFO mode ---- */
  body[data-tab="info"] {
    overflow: auto;
    height: auto;
  }

  body[data-tab="info"] .evolution-container {
    flex-direction: column;
    height: auto;
    min-height: 0;
    overflow: visible;
    margin-top: 44px;
  }

  body[data-tab="info"] .left-pane {
    width: 100%;
    height: auto;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid #1a1a30;
  }

  body[data-tab="info"] .versions-panel {
    max-height: none;
    overflow: visible;
    flex: none;
  }

  body[data-tab="info"] .version-list {
    overflow: visible;
  }

  body[data-tab="info"] .right-pane {
    width: 100%;
    height: auto;
    min-height: 0;
  }

  body[data-tab="info"] .game-area {
    display: none;
  }

  body[data-tab="info"] .feedback-panel-right {
    height: auto;
    min-height: 260px;
    display: flex;
    flex-direction: column;
  }

  body[data-tab="info"] .suggestion-form textarea {
    height: 80px;
    flex: none;
  }
}
