:root {
  --bg: #efe2c4;
  --text: #1f1710;
  --muted: #5d4c3e;
  --panel: rgba(255, 249, 237, 0.94);
  --line: rgba(72, 49, 28, 0.14);
  --shadow: 0 24px 60px rgba(56, 35, 16, 0.18);
  --green: #b8e28b;
  --blue: #71b9e6;
  --pink: #f27479;
  --yellow: #f6d36f;
  --violet: #cf69c7;
  --purple: #7f70e7;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(167, 119, 57, 0.18), transparent 24%),
    radial-gradient(circle at bottom right, rgba(99, 61, 29, 0.18), transparent 28%),
    linear-gradient(135deg, rgba(255, 248, 232, 0.92), rgba(232, 214, 180, 0.9)),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, rgba(120, 90, 54, 0.04) 0, rgba(120, 90, 54, 0.04) 2px, transparent 2px, transparent 12px),
    repeating-linear-gradient(0deg, rgba(120, 90, 54, 0.03) 0, rgba(120, 90, 54, 0.03) 2px, transparent 2px, transparent 14px);
  opacity: 0.45;
}

.page {
  width: min(1400px, calc(100% - 48px));
  margin: 0 auto;
  min-height: 100vh;
  padding: 18px 0 20px;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.hidden {
  display: none !important;
}

.screen.hidden,
.reward-box.hidden,
.hint-box.hidden,
.door-overlay.hidden {
  display: none;
}

.access-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.access-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 224, 163, 0.24), transparent 24%),
    radial-gradient(circle at 20% 80%, rgba(106, 63, 30, 0.2), transparent 28%),
    radial-gradient(circle at 82% 22%, rgba(83, 52, 25, 0.16), transparent 24%),
    linear-gradient(180deg, rgba(27, 18, 11, 0.78), rgba(59, 38, 23, 0.58));
  z-index: 0;
}

.access-card {
  width: min(520px, 100%);
  padding: 38px 34px;
  border-radius: 32px;
  background:
    linear-gradient(180deg, rgba(255, 248, 234, 0.98), rgba(232, 214, 181, 0.95));
  border: 1px solid rgba(104, 71, 38, 0.22);
  box-shadow:
    0 28px 70px rgba(16, 9, 4, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  text-align: center;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.access-card::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(97, 63, 30, 0.22);
  border-radius: 24px;
  pointer-events: none;
}

.access-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.32), transparent 30%),
    repeating-linear-gradient(0deg, rgba(125, 92, 58, 0.035) 0, rgba(125, 92, 58, 0.035) 2px, transparent 2px, transparent 14px);
  pointer-events: none;
}

.access-card .field,
.access-card .message {
  text-align: left;
  position: relative;
  z-index: 1;
}

.access-card h1 {
  font-size: clamp(2rem, 3.8vw, 3rem);
  line-height: 0.98;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.25);
}

.access-lead {
  margin: 0 0 14px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #4d351f;
  position: relative;
  z-index: 1;
}

.access-text {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2.4rem, 5.6vw, 4.8rem);
  text-align: center;
  margin-bottom: 22px;
}

h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  text-align: center;
  margin-bottom: 18px;
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  width: min(920px, 100%);
  margin: 0 auto 18px;
}

.group-tile {
  position: relative;
  min-height: 150px;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  font-weight: 900;
  text-transform: uppercase;
  color: #111111;
  box-shadow: var(--shadow);
  border-radius: 30px;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.group-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.12);
}

.group-tile.done::after {
  content: attr(data-reward);
  position: absolute;
  right: 14px;
  bottom: 12px;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  font-size: 1.45rem;
  font-weight: 900;
}

.group-tile.used-hint {
  box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.28), var(--shadow);
}

.group-tile.used-hint::before {
  content: "!";
  position: absolute;
  left: 14px;
  top: 12px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #f59e0b;
  color: #111111;
  font-size: 1rem;
  font-weight: 900;
}

.final-card,
.side-card {
  background: var(--panel);
  border-radius: 32px;
  box-shadow: var(--shadow);
  padding: 18px;
  border: 1px solid var(--line);
}

.final-card {
  width: min(920px, 100%);
  margin: 0 auto;
}

.final-title {
  margin-bottom: 8px;
  font-size: clamp(1.5rem, 3vw, 2rem);
  text-align: left;
}

.final-text {
  color: var(--muted);
  font-size: 0.98rem;
  margin-bottom: 12px;
}

.legend-note {
  margin-top: -2px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.symbol-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.symbol-slot {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  background: #f7f7f4;
  border: 1px dashed rgba(17, 17, 17, 0.15);
  font-size: 1.55rem;
  font-weight: 900;
}

.panel-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 6px;
}

.panel-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.back-btn,
.check-btn,
.help-btn,
.lock-btn {
  min-height: 48px;
  padding: 10px 18px;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  border-radius: 20px;
}

.back-btn,
.help-btn,
.lock-btn {
  color: #111111;
}

.back-btn {
  background: #111111;
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.12), var(--shadow);
}

.back-btn:hover {
  transform: translateY(-2px) scale(1.01);
}

.help-btn {
  background: #ececec;
  color: #111111;
}

.lock-btn {
  background: rgba(255, 248, 234, 0.92);
  border: 1px solid rgba(72, 49, 28, 0.18);
}

.check-btn {
  background: linear-gradient(180deg, #4c2d18, #2e180b);
  color: #fff9ef;
  box-shadow: 0 12px 26px rgba(60, 34, 12, 0.22);
}

.access-card .check-btn {
  min-width: 140px;
  margin-top: 4px;
}

.board-wrap {
  display: grid;
  grid-template-columns: minmax(760px, 1fr) 320px;
  gap: 28px;
  align-items: start;
  max-width: 1240px;
  margin: 0 auto;
}

.task-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  width: min(100%, 860px);
  margin: 0;
  justify-self: center;
}

.task-tile {
  aspect-ratio: 1 / 1;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: clamp(4.8rem, 9.2vw, 7rem);
  font-weight: 900;
  color: #111111;
  box-shadow: var(--shadow);
  border-radius: 38px;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.task-tile:hover {
  transform: scale(1.02);
}

.task-tile.revealed {
  font-size: clamp(3.9rem, 7.5vw, 5.8rem);
}

.task-tile.locked {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.side-label,
.field,
.message,
.reward-text,
.hint-text {
  font-size: 1rem;
}

.side-label,
.field {
  display: block;
  font-weight: 800;
}

.panel-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.revealed-word {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0 14px;
  padding: 10px 14px;
  background: #f7f7f4;
  border-radius: 22px;
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

input {
  width: 100%;
  min-height: 48px;
  margin: 8px 0 10px;
  padding: 10px 14px;
  border: 1px solid rgba(72, 49, 28, 0.18);
  border-radius: 20px;
  font: inherit;
  font-size: 1rem;
  text-transform: uppercase;
  background: rgba(255, 252, 246, 0.92);
}

.message {
  min-height: 22px;
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.message.success {
  color: #157347;
}

.hint-box,
.reward-box {
  margin-top: 12px;
  padding: 14px;
  border-radius: 24px;
}

.hint-box {
  background: #f4f0d7;
  border: 2px solid rgba(245, 158, 11, 0.45);
}

.reward-box {
  background: #e8f0fb;
}

.reward-symbol {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 900;
}

.reward-text,
.hint-text {
  margin: 8px 0 0;
}

.reward-text {
  text-align: center;
}

.color-green {
  background: var(--green);
}

.color-blue {
  background: var(--blue);
}

.color-pink {
  background: var(--pink);
}

.color-yellow {
  background: var(--yellow);
}

.color-violet {
  background: var(--violet);
}

.color-purple {
  background: var(--purple);
}

.door-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background:
    linear-gradient(rgba(12, 9, 6, 0.42), rgba(12, 9, 6, 0.42)),
    url("./bela.jpg") center center / cover no-repeat;
  overflow: hidden;
}

.door {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.08), transparent 12%, transparent 88%, rgba(0, 0, 0, 0.12)),
    linear-gradient(180deg, #8a5a35, #6c4325);
  box-shadow: inset 0 0 0 3px rgba(58, 34, 18, 0.35);
  animation-duration: 2.1s;
  animation-fill-mode: forwards;
  animation-timing-function: ease-in-out;
}

.door-left {
  left: 0;
  border-right: 2px solid rgba(58, 34, 18, 0.55);
  animation-name: open-left-door;
}

.door-right {
  right: 0;
  border-left: 2px solid rgba(58, 34, 18, 0.55);
  animation-name: open-right-door;
}

.door-scene {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  padding: 36px;
  opacity: 0;
  animation: show-message 2.2s ease forwards;
  animation-delay: 1.1s;
}

.door-scene h2 {
  margin-bottom: 12px;
  font-size: clamp(3rem, 8vw, 5.6rem);
  color: #ffffff;
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.door-scene p {
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #ffffff;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.door-badge {
  min-width: 320px;
  margin-bottom: 26px;
  padding: 18px 34px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(17, 17, 17, 0.08);
  display: grid;
  place-items: center;
  font-size: clamp(1.2rem, 3vw, 1.9rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.door-scene::before {
  content: "";
  width: min(760px, 84vw);
  min-height: 260px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 48px;
  background:
    linear-gradient(180deg, rgba(16, 12, 8, 0.42), rgba(16, 12, 8, 0.58));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(3px);
  z-index: -1;
}

@keyframes open-left-door {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

@keyframes open-right-door {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}

@keyframes show-message {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 1100px) {
  .board-wrap {
    grid-template-columns: 1fr;
  }

  .side-card {
    max-width: 700px;
  }
}

@media (max-width: 900px) {
  .group-grid,
  .task-board,
  .symbol-strip {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .page {
    width: calc(100% - 24px);
    padding-top: 20px;
  }

  .group-grid,
  .task-board,
  .symbol-strip {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .group-tile {
    min-height: 150px;
  }

  .panel-top {
    flex-direction: column;
    align-items: stretch;
  }
}
