@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&display=swap');

:root {
  --bg: #0b0d17;
  --panel: #101425;
  --muted: #7c87a5;
  --text: #f5f7ff;
  --accent: #5ce1e6;
  --accent-2: #ff8fb1;
  --stroke: #1f2436;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(92, 225, 230, 0.08), transparent 35%), radial-gradient(circle at 80% 10%, rgba(255, 143, 177, 0.08), transparent 30%), var(--bg);
  color: var(--text);
  min-height: 100vh;
  text-align: center;
  overflow: hidden;
}

h1, h2, h3 {
  margin: 0;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
  color: var(--muted);
}

.hero {
  display: grid;
  place-items: center;
  height: 100vh;
  padding: 32px;
  align-items: center;
  justify-items: center;
}

#hero-text {
  display: grid;
  gap: 16px;
  max-width: 760px;
  align-items: center;
}

.status {
  color: var(--accent);
  font-weight: 600;
  min-height: 20px;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 10px;
}

.lede {
  margin-top: 12px;
  max-width: 640px;
  line-height: 1.6;
}

.lede.small {
  max-width: none;
}

.cta-row {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: center;
}

#continue-custom {
  display: none;
}

body.show-continue #continue-custom {
  display: inline-flex;
}

.btn {
  border: 1px solid var(--stroke);
  background: #171c30;
  color: var(--text);
  padding: 12px 18px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), #7af3c1);
  color: #0a0c16;
  border: none;
  font-weight: 600;
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  padding: 10px 14px;
  font-size: 14px;
}

.hero-card {
  background: linear-gradient(145deg, #11182c, #0c101f);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 20px;
  display: grid;
  gap: 12px;
  box-shadow: var(--shadow);
}

.stat {
  padding: 12px;
  background: #0f1427;
  border: 1px solid var(--stroke);
  border-radius: 12px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat-value {
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
}

.layout {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: transparent;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
}

.head-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.upload-grid {
  display: grid;
  gap: 12px;
  margin: 8px 0 4px;
  grid-template-columns: 1fr;
  width: 100%;
}

.slot {
  border: 1px dashed var(--stroke);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
  background: #0f1324;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.slot-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

input[type="file"] {
  border: 1px solid var(--stroke);
  background: #0f1324;
  color: var(--text);
  padding: 8px;
  border-radius: 10px;
  width: 100%;
}

.panel-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
}

.hint {
  margin-top: 10px;
  font-size: 13px;
}

.game-panel {
  display: grid;
  gap: 14px;
  width: 100%;
  height: 100vh;
  margin: 0 auto;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.hud {
  display: inline-flex;
  gap: 12px;
  flex-wrap: wrap;
  font-weight: 600;
  color: var(--text);
  justify-content: center;
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
}

@media (max-width: 640px) {
  .hud {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    left: 50%;
    transform: translateX(-50%);
  }
}

.hud-item {
  padding: 8px 12px;
  border-radius: 10px;
  background: #0f1324;
  border: 1px solid var(--stroke);
  backdrop-filter: blur(6px);
}

.canvas-wrap {
  position: relative;
  background: #0a0e1c;
  border-radius: 0;
  overflow: hidden;
  border: none;
  min-height: 100vh;
  height: 100vh;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: radial-gradient(circle at 50% 20%, rgba(92, 225, 230, 0.05), transparent 40%), #080b17;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 600;
  color: var(--muted);
  pointer-events: none;
}

.overlay.show {
  opacity: 1;
}

.badge {
  padding: 6px 12px;
  background: #0f1427;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
}

.footer {
  text-align: center;
  padding: 12px 16px 20px;
  color: var(--muted);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

body.playing {
  overflow: hidden;
}

body.playing .hero,
body.playing #custom-panel,
body.playing .footer {
  display: none;
}

body.playing .layout {
  padding: 0;
  height: 100vh;
  pointer-events: auto;
}

body.custom-open .layout {
  pointer-events: auto;
}

body.bollywood-open .layout {
  pointer-events: auto;
}

body.playing .game-panel {
  min-height: 100vh;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

body.playing .panel-head,
body.playing .panel-actions {
  display: none;
}

body.playing .canvas-wrap {
  height: 100vh;
  border-radius: 0;
}

body.playing .hud {
  justify-content: center;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 23, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
  z-index: 10;
  max-width: none;
}

#custom-panel {
  max-width: 840px;
  width: min(92vw, 840px);
  margin: 0 auto;
  padding: 24px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 90vh;
  overflow-y: auto;
}

#custom-panel .panel-head {
  position: sticky;
  top: 0;
  padding: 16px;
  margin: -24px -24px 4px;
  background: linear-gradient(180deg, rgba(16, 20, 37, 0.96), rgba(16, 20, 37, 0.9));
  border-bottom: 1px solid var(--stroke);
  z-index: 2;
}

#bollywood-panel {
  max-width: 940px;
  width: min(96vw, 940px);
  margin: 0 auto;
  padding: 24px;
  max-height: 88vh;
  overflow: hidden;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  max-height: 70vh;
}

.preset-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text);
}

.preset-table th,
.preset-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--stroke);
}

.preset-table th {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.preset-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.preset-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.preset-aside {
  display: grid;
  gap: 12px;
  padding: 12px 12px 8px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(16, 20, 37, 0.95), rgba(16, 20, 37, 0.85));
  box-shadow: var(--shadow);
  max-width: 540px;
}

.preset-aside h2 {
  margin: 0;
}

.preset-aside .head-actions {
  justify-content: flex-start;
}

.table-wrap {
  max-height: 64vh;
}

#custom-panel[hidden],
#game-panel[hidden],
#bollywood-panel[hidden] {
  display: none !important;
}

@media (max-width: 1100px) {
  .hero {
    padding: 24px;
  }

  body.playing .canvas-wrap {
    height: calc(100vh - 200px);
  }
}

@media (max-width: 1100px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 36px 20px 12px;
  }

  #custom-panel {
    width: 100%;
    max-height: 88vh;
  }
}
