:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #070710;
  color: #f7f7ff;
  --bg: #070710;
  --surface: rgba(18, 18, 36, 0.96);
  --surface-soft: rgba(22, 22, 46, 0.98);
  --border: rgba(255, 255, 255, 0.08);
  --accent: #9f7aea;
  --accent-strong: #d6b7ff;
  --muted: #8c92b5;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(159, 122, 234, 0.18), transparent 20%),
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.04), transparent 10%),
    var(--bg);
  color: var(--f7f7ff);
}

body,
button,
a,
input,
textarea {
  font: inherit;
  color: inherit;
}

button,
a {
  cursor: pointer;
}

button {
  border: none;
}

img {
  max-width: 100%;
  display: block;
}

.game-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.game-header {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding: 1.75rem;
  border-radius: 2rem;
  background: rgba(11, 11, 24, 0.92);
  border: 1px solid var(--border);
}

.game-label {
  display: inline-flex;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.8rem;
  color: #9ca1c7;
  margin-bottom: 0.65rem;
}

.game-header h1 {
  margin: 0;
  font-size: clamp(2rem, 3.5vw, 3.5rem);
  line-height: 1.05;
}

.status-chip {
  border-radius: 999px;
  padding: 0.85rem 1.2rem;
  background: rgba(159, 122, 234, 0.13);
  color: #d6b7ff;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.intro-card,
.scene-panel,
.scene-output,
.puzzle-card,
.next-step-card {
  border-radius: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 35px 90px rgba(0, 0, 0, 0.25);
}

.intro-card {
  padding: 2rem;
  margin-bottom: 2rem;
}

.intro-tag {
  display: inline-flex;
  margin-bottom: 1rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.82rem;
}

.intro-card p {
  max-width: 64ch;
  line-height: 1.9;
  color: #ccd0e4;
}

.scene-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1.1fr 0.9fr;
}

.scene-panel,
.scene-output {
  padding: 1.75rem;
}

.scene-panel h2,
.scene-output h2,
.puzzle-card h2,
.next-step-card h2 {
  margin: 0 0 0.85rem;
  font-size: 1.5rem;
}

.scene-panel p,
.scene-output p,
.puzzle-card p,
.next-step-card p {
  margin: 0;
  line-height: 1.85;
  color: #c6cadf;
}

.scene-items {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.item-card {
  width: 100%;
  text-align: left;
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1.25rem;
  color: #e6e9ff;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.item-card:hover,
.item-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(159, 122, 234, 0.35);
  background: rgba(159, 122, 234, 0.08);
}

.item-card span {
  display: block;
  font-weight: 700;
  margin-bottom: 0.55rem;
}

.item-card p {
  margin: 0;
  color: #b5b9d3;
}

.output-header {
  margin-bottom: 1.5rem;
}

.output-content {
  min-height: 18rem;
  border-radius: 1.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder-text {
  margin: 0;
  color: #8c92b5;
}

.puzzle-card {
  padding: 2rem;
}

#puzzleForm {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

#puzzleForm label {
  font-size: 0.95rem;
  color: #c8cadf;
}

#puzzleForm input {
  width: 100%;
  border-radius: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #f7f7ff;
  padding: 0.95rem 1rem;
  outline: none;
}

#puzzleForm input:focus {
  border-color: rgba(159, 122, 234, 0.45);
  box-shadow: 0 0 0 4px rgba(159, 122, 234, 0.08);
}

.button-primary,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.95rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
}

.button-primary {
  background: linear-gradient(135deg, var(--accent), #8c64d8);
  color: #fff;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #f7f7ff;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.puzzle-hint {
  margin-top: 0.75rem;
  color: #8b8fc1;
}

.puzzle-result {
  margin-top: 1rem;
  min-height: 2rem;
  color: #d7dbe8;
}

.progress-panel {
  margin-bottom: 1.5rem;
  padding: 1.35rem 1.5rem;
  border-radius: 1.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.progress-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.85rem;
  color: #c8cadf;
  font-size: 0.95rem;
}

.progress-label {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.progress-bar {
  width: 100%;
  height: 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(135deg, var(--accent), #8f72e3);
  transition: width 0.3s ease;
}

.hint-panel {
  margin-top: 1.2rem;
  padding: 1.35rem;
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hint-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.hint-header h3 {
  margin: 0;
  font-size: 1rem;
}

.hint-header p {
  margin: 0;
  color: #b5b9d1;
  font-size: 0.92rem;
}

.hint-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hint-text {
  margin-top: 1rem;
  color: #c8cadf;
  line-height: 1.8;
}

.summary-list {
  margin: 1rem 0 0;
  padding-left: 1.35rem;
  color: #d1d5ef;
}

.summary-list li {
  margin-bottom: 0.75rem;
  line-height: 1.8;
}

.case-selection {
  display: grid;
  gap: 1.5rem;
}

.case-card-select {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.75rem;
  border-radius: 2rem;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 35px 90px rgba(0, 0, 0, 0.2);
}

.case-card-select h2 {
  margin: 0 0 0.85rem;
  font-size: 1.5rem;
}

.case-card-select p {
  margin: 0;
  line-height: 1.8;
  color: #c6cadf;
}

.case-available {
  border-color: rgba(159, 122, 234, 0.35);
}

.case-soon {
  opacity: 0.85;
}

.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.unlock-card,
.summary-card {
  margin-top: 1.5rem;
  padding: 1.75rem;
  border-radius: 1.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.price-block {
  display: inline-flex;
  gap: 0.75rem;
  align-items: baseline;
  margin: 1rem 0 0;
}

.price-block span {
  color: #9ca1c7;
}

.price-block strong {
  font-size: 1.85rem;
  color: #fff;
}

.cliffhanger {
  margin-top: 1rem;
  color: #c8cadf;
  font-style: italic;
}

.next-step {
  display: none;
  padding: 2rem;
  text-align: center;
}

.complete-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
  justify-content: center;
}

.next-step-card h2 {
  font-size: 1.7rem;
}

.next-step-card p {
  margin: 1rem auto 0;
  max-width: 54ch;
}

@media (max-width: 980px) {
  .scene-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .game-shell {
    width: min(100%, calc(100% - 1rem));
    padding: 1.25rem 0 2rem;
  }

  .game-header,
  .intro-card,
  .scene-panel,
  .scene-output,
  .puzzle-card,
  .next-step-card {
    padding: 1.5rem;
  }

  .game-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
