:root {
  --bg: #09111f;
  --bg-soft: #101b30;
  --panel: rgba(9, 17, 31, 0.74);
  --panel-strong: rgba(13, 24, 43, 0.92);
  --line: rgba(151, 176, 216, 0.18);
  --text: #ecf4ff;
  --text-dim: #94a8c6;
  --accent: #66e3c4;
  --accent-warm: #f7b267;
  --accent-alert: #ff7b72;
  --easy: #1ec28b;
  --medium: #f2a93b;
  --hard: #f06272;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Space Grotesk", system-ui, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(102, 227, 196, 0.2), transparent 28%),
    radial-gradient(circle at 85% 12%, rgba(247, 178, 103, 0.18), transparent 24%),
    linear-gradient(180deg, #07101d 0%, #0c1629 46%, #0b1220 100%);
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 52px;
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 24px;
}

.hero-panel,
.workspace-card,
.info-banner {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-panel {
  padding: 28px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(18, 33, 59, 0.94), rgba(8, 17, 31, 0.98)),
    linear-gradient(135deg, rgba(102, 227, 196, 0.1), transparent);
  position: sticky;
  top: 24px;
  align-self: start;
  overflow: hidden;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -60px -70px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(102, 227, 196, 0.18), transparent 68%);
  pointer-events: none;
}

.eyebrow,
.section-kicker,
.selector-label,
.meta-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.73rem;
  color: var(--text-dim);
}

.hero-panel h1 {
  margin: 10px 0 14px;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 0.95;
  max-width: 9ch;
}

.hero-copy {
  max-width: 32ch;
  color: #d6e5fb;
  font-size: 1.02rem;
  line-height: 1.7;
}

.hero-meta {
  display: grid;
  gap: 12px;
  margin: 28px 0;
}

.meta-chip {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.meta-chip strong {
  display: block;
  margin-top: 5px;
  font-size: 1rem;
}

.difficulty-selector {
  display: grid;
  gap: 10px;
}

.button-group,
.workspace-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
}

.difficulty-btn,
.btn-primary,
.btn-secondary,
.btn-print {
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
}

.difficulty-btn {
  color: #0c1628;
}

.btn-easy {
  background: rgba(30, 194, 139, 0.2);
  color: #b8ffe4;
  box-shadow: inset 0 0 0 1px rgba(30, 194, 139, 0.3);
}

.btn-medium {
  background: rgba(242, 169, 59, 0.22);
  color: #ffe6c0;
  box-shadow: inset 0 0 0 1px rgba(242, 169, 59, 0.28);
}

.btn-hard {
  background: rgba(240, 98, 114, 0.22);
  color: #ffd5da;
  box-shadow: inset 0 0 0 1px rgba(240, 98, 114, 0.3);
}

.difficulty-btn.active {
  color: #08111f;
}

.btn-easy.active {
  background: var(--easy);
}

.btn-medium.active {
  background: var(--medium);
}

.btn-hard.active {
  background: var(--hard);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #8bf0e6);
  color: #082033;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.btn-print {
  background: linear-gradient(135deg, var(--accent-warm), #ffd6a1);
  color: #2d1501;
}

.workspace-panel {
  display: grid;
  gap: 18px;
}

.info-banner {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(17, 31, 55, 0.72);
}

.info-banner p {
  margin: 0;
  color: #d7e6fb;
}

.info-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 8px rgba(102, 227, 196, 0.12);
  flex: 0 0 auto;
}

.workspace-card {
  background: var(--panel);
  border-radius: 28px;
  padding: 24px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 20px;
}

.section-heading.compact {
  margin-bottom: 14px;
}

.section-heading h2,
.section-heading h3,
.key-header h4 {
  margin: 4px 0 0;
  font-size: 1.35rem;
}

.cryptogram-text {
  margin: 0;
  padding: 22px;
  border-radius: 24px;
  min-height: 168px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.03)),
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.02),
      rgba(255, 255, 255, 0.02) 31px,
      rgba(255, 255, 255, 0.045) 31px,
      rgba(255, 255, 255, 0.045) 32px
    );
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #f6fbff;
  font-family: "IBM Plex Mono", monospace;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  letter-spacing: 0.16em;
  line-height: 1.9;
  word-break: break-word;
}

.workspace-actions {
  margin-top: 18px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: start;
}

.hints-grid,
.key-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}

.hint-item,
.key-item {
  border-radius: 18px;
  padding: 14px 10px;
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1rem;
}

.hint-item {
  background: rgba(102, 227, 196, 0.09);
  border: 1px solid rgba(102, 227, 196, 0.18);
  color: #d3fff7;
}

.key-item {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.solution-card {
  background:
    linear-gradient(180deg, rgba(17, 33, 58, 0.94), rgba(10, 18, 32, 0.98)),
    linear-gradient(135deg, rgba(247, 178, 103, 0.08), transparent);
}

.solution-text {
  margin: 0 0 8px;
  font-size: 1.2rem;
  line-height: 1.6;
}

.solution-author {
  margin: 0 0 20px;
  color: var(--accent-warm);
  font-style: italic;
}

.key-header {
  margin-bottom: 12px;
}

.hidden {
  display: none;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    position: static;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 100%);
    padding: 18px 0 28px;
    gap: 16px;
  }

  .hero-panel,
  .workspace-card,
  .info-banner {
    border-radius: 22px;
    padding: 18px;
  }

  .section-heading,
  .button-group,
  .workspace-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .cryptogram-text {
    padding: 16px;
    letter-spacing: 0.12em;
    min-height: 132px;
  }

  .hints-grid,
  .key-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media print {
  body {
    background: #ffffff;
    color: #000000;
  }

  .app-shell {
    width: 100%;
    padding: 0;
    display: block;
  }

  .hero-panel,
  .info-banner,
  .workspace-card {
    box-shadow: none;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #000000;
    backdrop-filter: none;
  }

  .hero-panel {
    margin-bottom: 20px;
  }

  .btn-primary,
  .btn-secondary,
  .btn-print,
  .difficulty-selector,
  .workspace-actions {
    display: none;
  }

  .cryptogram-text,
  .hint-item,
  .key-item {
    color: #000000;
    background: #ffffff;
    border: 1px solid #d4d4d8;
  }
}
