/*
  Logic Grid Deductor - Visual Stylesheet
  Overrides visual theme tokens and styles game-specific components (logic table, clues, answer dropdowns).
  Inherits base layouts (toggles, cards, header tabs, modals) from shared/scaffolding.css
*/

@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 300;
  font-stretch: normal;
  font-display: swap;
  src: url('../fonts/fredoka-300.ttf') format('truetype');
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 400;
  font-stretch: normal;
  font-display: swap;
  src: url('../fonts/fredoka-400.ttf') format('truetype');
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 500;
  font-stretch: normal;
  font-display: swap;
  src: url('../fonts/fredoka-500.ttf') format('truetype');
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 600;
  font-stretch: normal;
  font-display: swap;
  src: url('../fonts/fredoka-600.ttf') format('truetype');
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 700;
  font-stretch: normal;
  font-display: swap;
  src: url('../fonts/fredoka-700.ttf') format('truetype');
}

:root {
  /* Neon Detective Themes */
  --bg-gradient: linear-gradient(135deg, #090e1a 0%, #15103a 50%, #0d1b2a 100%);
  --panel-bg: rgba(22, 28, 45, 0.65);
  --panel-border: rgba(0, 204, 255, 0.15);
  
  --primary: #00ccff;
  --primary-hover: #0099cc;
  --primary-glow: rgba(0, 204, 255, 0.25);
  --accent-cyan: #00f5d4;
  --accent-pink: #ff007f;
  
  --shadow-lg: 0 20px 45px rgba(0, 204, 255, 0.12);
  --radius-lg: 20px;
}

/* Background grid styling */
body::before {
  opacity: 0.25;
  background-image: 
    radial-gradient(var(--primary), rgba(0,204,255,.05) 1.5px, transparent 20px);
}

/* Header Text styling */
h1 {
  color: var(--accent-cyan);
  text-shadow: 0 0 12px rgba(0, 245, 212, 0.4), 2px 2px 0px rgba(0, 0, 0, 0.6);
}

/* Tab active highlight */
nav button.active {
  color: #090e1a;
  box-shadow: 0 0 15px rgba(0, 245, 212, 0.4);
}

/* Screen transition centering */
.screen.active {
  align-items: stretch;
  max-width: 900px;
  width: 100%;
}

/* Helper Class */
.hidden {
  display: none !important;
}

/* ─── TAB 1: EXPLORE / WELCOME CARD ─── */
.welcome-card h2 {
  color: var(--text-light);
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

.welcome-card p {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.5;
  text-align: center;
  max-width: 640px;
}

.mode-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 600px;
  margin: 1.25rem 0;
}

.mode-card {
  background: rgba(30, 41, 59, 0.35);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  text-align: left;
  gap: 1.2rem;
  width: 100%;
  transition: var(--transition-bounce);
  color: var(--text-light);
}

.mode-card:hover {
  transform: scale(1.02);
  background: rgba(0, 204, 255, 0.08);
  border-color: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
}

.mode-emoji {
  font-size: 2.4rem;
  line-height: 1;
}

.mode-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.mode-name {
  font-size: 1.2rem;
  font-weight: 700;
}

.mode-detail {
  font-size: 0.85rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

.mode-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.how-to-text {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.cell-demo {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--panel-border);
  font-size: 0.65rem;
  text-align: center;
  line-height: 20px;
  background: rgba(0,0,0,0.3);
}
.cell-demo.yes { color: var(--accent-cyan); }
.cell-demo.no { color: var(--accent-pink); }

/* ─── TAB 2: PLAY SCREEN (GAMEPLAY CARD) ─── */
#no-game-placeholder {
  max-width: 500px;
  margin: 2rem auto;
  text-align: center;
}
#no-game-placeholder h2 {
  color: var(--text-light);
  margin-bottom: 0.5rem;
}
#no-game-placeholder p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.gameplay-main-card {
  align-items: stretch !important;
  gap: 1.5rem !important;
  padding: 1.5rem 1.25rem !important;
}

@media (min-width: 640px) {
  .gameplay-main-card {
    padding: 2rem !important;
  }
}

.game-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  border-bottom: 1.5px dashed var(--panel-border);
  padding-bottom: 1rem;
}

.game-title-block {
  text-align: left;
}

.game-level-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  text-shadow: 0 0 8px var(--primary-glow);
}

.puzzle-name-label {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-light);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: 30px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.icon-btn:hover {
  background: rgba(0, 204, 255, 0.15);
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Clues List */
.clues-section {
  width: 100%;
}

.clues-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 0.5rem;
}

.clues-list {
  list-style: none;
  width: 100%;
  max-height: 180px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
}

.clue-item {
  font-size: 0.95rem;
  color: var(--text-light);
  line-height: 1.5;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  transition: var(--transition-smooth);
}

.clue-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.clue-checkbox {
  font-size: 1rem;
  user-select: none;
  line-height: 1;
}

.clue-item.crossed-out {
  opacity: 0.45;
  text-decoration: line-through;
}

/* Workspace Helper Grid */
.workspace-section {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.workspace-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  text-shadow: 0 0 10px var(--primary-glow);
  margin-bottom: 0.5rem;
}

.puzzle-area-scroll {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: flex-start;
}

@media (min-width: 768px) {
  .puzzle-area-scroll {
    justify-content: center;
  }
}

/* ─── DYNAMIC LOGIC MATRIX TABLE ─── */
.logic-table {
  border-collapse: collapse;
  margin: 1.25rem 1rem 0.75rem;
}

/* Table cells */
.logic-table th, .logic-table td {
  box-sizing: border-box;
  text-align: center;
  vertical-align: middle;
}

/* Top column headers rotated vertically */
.logic-table th.col-header {
  height: 110px;
  min-width: 32px;
  max-width: 32px;
  vertical-align: bottom;
  padding-bottom: 0.5rem;
}

.grid-header-top-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-light);
  white-space: nowrap;
  letter-spacing: 0.5px;
}

/* Row labels left side */
.logic-table td.row-header {
  text-align: right;
  padding-right: 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-light);
  white-space: nowrap;
  min-width: 100px;
}

/* Divider cell blocks separating categories */
.logic-table th.category-label-cell {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.35rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--panel-border);
}

/* Grid interactive cells */
.logic-cell {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  transition: var(--transition-smooth);
  user-select: none;
}

.logic-cell:hover {
  background: rgba(0, 204, 255, 0.15);
}

/* Border outlines around subgrids */
.logic-cell.border-right-thick {
  border-right: 2px solid rgba(0, 204, 255, 0.35);
}
.logic-cell.border-bottom-thick {
  border-bottom: 2px solid rgba(0, 204, 255, 0.35);
}
.logic-table td.row-header.border-bottom-thick {
  border-bottom: 2px solid rgba(0, 204, 255, 0.35);
}

/* Cell active check/cross styles */
.logic-cell.state-no {
  color: var(--accent-pink);
  text-shadow: 0 0 6px rgba(255, 0, 127, 0.4);
}

.logic-cell.state-yes {
  color: var(--accent-cyan);
  background: rgba(0, 245, 214, 0.08);
  text-shadow: 0 0 8px rgba(0, 245, 214, 0.5);
}

/* ─── FINAL ANSWER SHEET ─── */
.answer-sheet-section {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.answer-sheet-instructions {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.answers-container-scroll {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.answers-container {
  display: flex;
  gap: 1rem;
  justify-content: flex-start;
  padding: 0.5rem 0;
  min-width: 100%;
}

.answer-entity-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  min-width: 150px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  align-items: center;
}

.answer-entity-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-cyan);
  border-bottom: 1.5px dashed var(--panel-border);
  width: 100%;
  text-align: center;
  padding-bottom: 0.4rem;
}

.answer-slot-selector {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 100%;
}

.answer-slot-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.answer-dropdown {
  background: #0f172a;
  border: 1px solid var(--panel-border);
  color: var(--text-light);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  width: 100%;
  transition: var(--transition-smooth);
}

.answer-dropdown:focus {
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(0, 204, 255, 0.15);
}

/* ─── ACTION CONTROL BAR ─── */
.action-bar-container {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 0.5rem;
}

.action-bar {
  display: flex;
  gap: 0.8rem;
  width: 100%;
  max-width: 480px;
}

.action-btn {
  flex: 1;
  border: none;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.7rem 1rem;
  border-radius: 30px;
  cursor: pointer;
  transition: var(--transition-bounce);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.action-btn.hint-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-light);
}
.action-btn.hint-btn:hover {
  background: rgba(0, 204, 255, 0.12);
  border-color: var(--primary);
}

.action-btn.check-btn {
  background: var(--accent-cyan);
  color: #0f172a;
  box-shadow: 0 4px 0 #02cca0;
}
.action-btn.check-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #02cca0, 0 0 10px rgba(0, 245, 212, 0.3);
}
.action-btn.check-btn:active {
  transform: translateY(2px);
  box-shadow: 0 0px 0 #02cca0;
}

.action-btn.reset-btn {
  background: rgba(231, 76, 60, 0.05);
  border: 1px solid rgba(231, 76, 60, 0.2);
  color: var(--danger);
}
.action-btn.reset-btn:hover {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 0 #c0392b;
}
.action-btn.reset-btn:active {
  transform: translateY(2px);
  box-shadow: 0 0px 0 #c0392b;
}

/* Feedback banner alerts */
.feedback-banner {
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow-sm);
  margin: 0.5rem auto 0;
  animation: slideIn 0.3s ease;
}
.feedback-banner.success {
  background: rgba(46, 204, 113, 0.12);
  border: 1.5px solid var(--success);
  color: var(--success);
}
.feedback-banner.error {
  background: rgba(231, 76, 60, 0.12);
  border: 1.5px solid var(--danger);
  color: var(--danger);
}

/* ─── TAB 3: SPY SHOP STICKER GALLERIES ─── */
.stickers-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.25rem;
  width: 100%;
  margin-top: 1rem;
}

.sticker-slot {
  background: rgba(0,0,0,0.25);
  border: 2px dashed var(--panel-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  position: relative;
  transition: var(--transition-bounce);
}

.sticker-slot.unlocked {
  background: var(--panel-bg);
  border: 2px solid var(--primary);
  box-shadow: 0 4px 12px var(--primary-glow);
  transform: rotate(var(--rotation, 0deg));
}

.sticker-slot.unlocked:hover {
  transform: scale(1.05) rotate(0deg);
  border-color: var(--accent-cyan);
}

.sticker-visual {
  font-size: 3.2rem;
  filter: grayscale(100%);
  opacity: 0.25;
  user-select: none;
}

.sticker-slot.unlocked .sticker-visual {
  filter: none;
  opacity: 1;
  animation: float 4s ease-in-out infinite;
}

.sticker-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
}
.sticker-slot.unlocked .sticker-name {
  color: var(--text-light);
}

.lock-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  gap: 0.3rem;
  opacity: 1;
  transition: var(--transition-smooth);
}

.lock-overlay:hover {
  background: rgba(0, 204, 255, 0.12);
}

.lock-icon {
  font-size: 1.6rem;
}

.lock-cost {
  font-size: 0.9rem;
  font-weight: 700;
  color: #f1c40f;
}
