:root {
  --bg-dark: #0b0f19;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-border: rgba(255, 255, 255, 0.1);
  --bg-slot: rgba(31, 41, 55, 0.6);
  --bg-slot-filled: rgba(30, 41, 59, 0.9);
  
  --primary-cyan: #00d2ff;
  --primary-purple: #a855f7;
  --primary-emerald: #10b981;
  --accent-gold: #feca57;
  
  --shape-circle: #00d2ff;
  --shape-square: #ff9f43;
  --shape-triangle: #ee5253;
  --shape-star: #feca57;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --error-color: #ef4444;
  --success-color: #10b981;
  
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  
  --shadow-glow: 0 0 25px rgba(0, 210, 255, 0.15);
}

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

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 10% 10%, rgba(168, 85, 247, 0.15) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(0, 210, 255, 0.15) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
}

.app-container {
  width: 100%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}


.brand-name {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}

.brand-tag {
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 3px 10px;
  border-radius: 20px;
  color: var(--text-muted);
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Card Screen Layouts */
.card-screen {
  display: none;
  flex-direction: column;
  gap: 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card-screen.active {
  display: flex;
}

/* Hero Section */
.hero-section {
  text-align: center;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, var(--primary-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 650px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Instructions */
.instructions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.instruction-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 20px;
}

.instruction-card h3 {
  font-family: var(--font-heading);
  margin-bottom: 10px;
  color: var(--primary-cyan);
}

.instruction-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.95rem;
  color: #cbd5e1;
}

.instruction-card code {
  background: rgba(0, 210, 255, 0.15);
  color: var(--primary-cyan);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

.alarm-notice {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 14px;
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 0.95rem;
}

/* Buttons */
.action-bar {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.primary-btn {
  background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
  color: #fff;
  border: none;
  padding: 16px 36px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-heading);
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 114, 255, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 114, 255, 0.6);
}

.pulse-glow {
  animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
  0% { box-shadow: 0 0 0 0 rgba(0, 210, 255, 0.7); }
  70% { box-shadow: 0 0 0 16px rgba(0, 210, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 210, 255, 0); }
}

/* GAME SCREEN */
.game-status-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.3);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-badge {
  background: linear-gradient(135deg, var(--primary-purple), #7c3aed);
  color: #fff;
  font-weight: 700;
  font-family: var(--font-heading);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.95rem;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-cyan);
}

.error-text {
  color: var(--error-color) !important;
}

.success-text {
  color: var(--success-color) !important;
}

.rule-hint-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(254, 202, 87, 0.1);
  border: 1px solid rgba(254, 202, 87, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--accent-gold);
}

.streak-pill {
  background: var(--accent-gold);
  color: #000;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
}

/* Columns Container */
.columns-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .columns-container {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
}

.task-column {
  background: rgba(15, 23, 42, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.3s ease;
  position: relative;
}

.task-column.active-target {
  border-color: var(--primary-cyan);
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.25);
  background: rgba(15, 23, 42, 0.9);
}

.task-column.column-blocked {
  opacity: 0.45;
  filter: grayscale(0.5);
}

.task-column.shake {
  animation: shake 0.35s cubic-bezier(.36,.07,.19,.97) both;
  border-color: var(--error-color) !important;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.6) !important;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

.column-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.col-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.col-status {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Slots Grid */
.column-slots {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 390px;
}

.slot-item {
  height: 28px;
  background: var(--bg-slot);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.slot-item.filled {
  background: var(--bg-slot-filled);
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 700;
}

.slot-num {
  font-size: 0.7rem;
  opacity: 0.5;
}

.slot-val {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.column-footer-time {
  font-size: 0.8rem;
  text-align: center;
  color: var(--text-muted);
  padding-top: 4px;
  font-family: var(--font-heading);
}

/* Input Panel & Virtual Keypads */
.input-panel-wrapper {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 14px;
}

.panel-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.panel-tab {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.panel-tab.active {
  background: var(--primary-cyan);
  color: #000;
}

.panel-content {
  position: relative;
}

.keypad-view {
  display: none;
}

.keypad-view.active {
  display: block;
}

.virtual-keypad {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.vkey {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.vkey:active, .vkey:hover {
  background: var(--primary-cyan);
  color: #000;
  transform: scale(1.06);
}

.shapes-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 500px;
  margin: 0 auto;
}

.shape-btn {
  width: 100%;
  height: 60px;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
}

.shape-icon {
  font-size: 1.4rem;
}

.shape-circle .shape-icon { color: var(--shape-circle); }
.shape-square .shape-icon { color: var(--shape-square); }
.shape-triangle .shape-icon { color: var(--shape-triangle); }
.shape-star .shape-icon { color: var(--shape-star); }

.shape-pattern-tracker {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 10px;
}

/* Intermission Screen */
.results-summary-card {
  display: flex;
  justify-content: space-around;
  background: rgba(0, 0, 0, 0.3);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.summary-stat .val {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
}

.summary-stat .highlight {
  color: var(--primary-cyan);
}

.next-round-box {
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.3);
  padding: 20px;
  border-radius: var(--radius-md);
  text-align: center;
}

.next-round-box h3 {
  font-family: var(--font-heading);
  color: var(--primary-purple);
  margin-bottom: 8px;
}

.rule-highlight {
  background: rgba(0, 0, 0, 0.3);
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  font-size: 0.95rem;
}

/* RESULTS SCREEN */
.results-comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.result-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-card.accent-border {
  border-color: var(--primary-cyan);
  box-shadow: var(--shadow-glow);
}

.card-header h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
}

.card-header .sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.big-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.big-metric .value {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
}

.tasks-breakdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
}

.task-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
}

.task-row strong {
  color: #fff;
}

.impact-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(0, 210, 255, 0.15));
  border: 1px solid var(--primary-emerald);
  padding: 20px;
  border-radius: var(--radius-md);
}

.impact-icon {
  font-size: 2.2rem;
}

.impact-content h3 {
  font-family: var(--font-heading);
  color: var(--success-color);
  margin-bottom: 4px;
}

/* Global Stats */
.global-stats-section {
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.global-stats-section h2 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
}

.stats-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.global-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.global-metric-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.gm-value {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
}

.gm-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* Conclusions & Links */
.conclusions-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.conclusions-section h2 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
}

.conclusion-box {
  background: rgba(255, 255, 255, 0.04);
  border-left: 4px solid var(--primary-cyan);
  padding: 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.conclusion-lead {
  font-size: 1.05rem;
  line-height: 1.6;
}

.links-resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.resource-card {
  display: flex;
  gap: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

.resource-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary-cyan);
  transform: translateY(-2px);
}

.res-icon {
  font-size: 2rem;
}

.res-info h4 {
  font-family: var(--font-heading);
  font-size: 1rem;
  margin-bottom: 4px;
}

.res-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.4;
}

.link-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-cyan);
}

/* Responsiveness for Mobile */
@media (max-width: 600px) {
  body {
    padding: 8px;
  }

  .card-screen {
    padding: 16px;
  }

  .hero-title {
    font-size: 1.6rem;
  }

  .columns-container {
    gap: 6px;
  }

  .col-title {
    font-size: 0.8rem;
  }

  .slot-item {
    padding: 0 4px;
    font-size: 0.75rem;
  }

  .vkey {
    width: 36px;
    height: 38px;
    font-size: 0.95rem;
  }
}
