:root {
  --bg: #14110f;
  --bg-2: #1d1813;
  --ink: #f4ead9;
  --muted: #b8a891;
  --paper: #efe1c5;
  --paper-2: #d6c29a;
  --paper-ink: #211912;
  --brass: #c29a4a;
  --brass-bright: #e4c071;
  --red: #9c3d34;
  --green: #6f9f71;
  --line: rgba(228, 192, 113, 0.25);
  --line-strong: rgba(228, 192, 113, 0.48);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.36);
  --radius: 8px;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(226, 184, 92, 0.06) 1px, transparent 1px) 0 0 / 68px 68px,
    linear-gradient(0deg, rgba(226, 184, 92, 0.035) 1px, transparent 1px) 0 0 / 68px 68px,
    radial-gradient(circle at 24% 0%, rgba(156, 61, 52, 0.16), transparent 34rem),
    linear-gradient(135deg, #17120e 0%, #0f0d0c 48%, #23160f 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

svg {
  width: 1.05rem;
  height: 1.05rem;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex: 0 0 auto;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.topbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 760;
  letter-spacing: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--brass-bright);
  background: rgba(239, 225, 197, 0.05);
}

.layout {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr) 346px;
  gap: 22px;
  min-height: calc(100vh - 106px);
  padding-top: 22px;
}

.progress-panel,
.reward-panel,
.puzzle-surface,
.activity {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.progress-panel,
.reward-panel {
  align-self: start;
  position: sticky;
  top: 22px;
  overflow: hidden;
}

.progress-panel {
  padding: 18px;
  background: rgba(29, 24, 19, 0.86);
}

.panel-label,
.overline,
.seal-kicker,
.difficulty,
.answer-help,
.feedback,
.attempts {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.45;
}

.panel-label,
.overline,
.seal-kicker,
.difficulty {
  color: var(--brass-bright);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 760;
}

.seal-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  gap: 10px;
}

.seal-button {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--muted);
  background: rgba(239, 225, 197, 0.035);
  border: 1px solid rgba(228, 192, 113, 0.14);
  border-radius: var(--radius);
  text-align: left;
}

.seal-button:hover:not(:disabled),
.seal-button:focus-visible {
  color: var(--ink);
  border-color: var(--line-strong);
  outline: none;
}

.seal-button[aria-current="step"] {
  color: var(--ink);
  background: rgba(194, 154, 74, 0.18);
  border-color: var(--brass);
}

.seal-button.is-solved {
  color: var(--paper);
  border-color: rgba(111, 159, 113, 0.55);
}

.seal-button:disabled {
  color: rgba(184, 168, 145, 0.48);
}

.seal-number {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 780;
}

.seal-name {
  font-size: 0.85rem;
  font-weight: 720;
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(460px, auto) auto;
  gap: 16px;
}

.intro-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.attempts {
  color: var(--muted);
}

h1,
h2 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: 0;
}

h1 {
  max-width: 780px;
  color: var(--ink);
  font-size: clamp(2.45rem, 5vw, 5rem);
  line-height: 0.96;
  font-weight: 700;
}

.puzzle-surface {
  position: relative;
  overflow: hidden;
  padding: clamp(22px, 4vw, 42px);
  background:
    linear-gradient(120deg, rgba(36, 29, 22, 0.96), rgba(19, 15, 12, 0.98)),
    repeating-linear-gradient(135deg, rgba(228, 192, 113, 0.035) 0 1px, transparent 1px 14px);
  color: var(--ink);
}

.puzzle-surface::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(228, 192, 113, 0.08) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(0deg, rgba(228, 192, 113, 0.05) 1px, transparent 1px) 0 0 / 42px 42px;
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.5), transparent 76%);
}

.puzzle-heading,
.puzzle-body,
.answer-form,
.hint-toggle,
.hint-box {
  position: relative;
  z-index: 1;
}

.puzzle-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.puzzle-heading h2 {
  margin-top: 4px;
  font-size: clamp(1.65rem, 3vw, 2.6rem);
  line-height: 1.08;
}

.difficulty {
  padding-top: 8px;
  color: var(--brass-bright);
}

.puzzle-body {
  margin-top: 26px;
  max-width: 760px;
}

.puzzle-body p {
  margin: 0 0 14px;
  font-size: 1rem;
  line-height: 1.68;
  color: rgba(244, 234, 217, 0.9);
}

.puzzle-body code,
.cipher-strip,
.graph-strip {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.cipher-strip,
.graph-strip {
  display: block;
  margin: 18px 0;
  padding: 15px 16px;
  color: #20170f;
  background: rgba(255, 252, 242, 0.55);
  border: 1px solid rgba(33, 25, 18, 0.18);
  border-radius: var(--radius);
  font-size: clamp(0.88rem, 2vw, 1rem);
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.clue-list {
  margin: 14px 0 0;
  padding-left: 20px;
  line-height: 1.7;
}

.answer-form {
  margin-top: 28px;
}

.answer-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.86rem;
  font-weight: 760;
  color: var(--brass-bright);
}

.answer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(15, 13, 12, 0.86);
  outline: none;
}

input:focus {
  border-color: var(--brass-bright);
  box-shadow: 0 0 0 3px rgba(194, 154, 74, 0.22);
}

input::placeholder {
  color: rgba(244, 234, 217, 0.48);
}

.primary-button,
.secondary-button,
.ghost-button,
.hint-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 760;
  white-space: nowrap;
}

.primary-button {
  min-height: 48px;
  padding: 0 18px;
  color: #fff7ea;
  background: linear-gradient(180deg, #b9473e, #8d2f29);
  border-color: rgba(255, 235, 205, 0.22);
}

.primary-button:hover,
.secondary-button:hover:not(:disabled) {
  filter: brightness(1.04);
}

.primary-button:disabled {
  color: rgba(244, 234, 217, 0.44);
  background: rgba(239, 225, 197, 0.1);
  border-color: rgba(239, 225, 197, 0.18);
  filter: none;
}

.ghost-button {
  padding: 0 13px;
  color: var(--ink);
  background: rgba(239, 225, 197, 0.04);
  border-color: var(--line);
}

.ghost-button:hover {
  border-color: var(--line-strong);
}

.answer-help {
  margin-top: 9px;
  color: rgba(244, 234, 217, 0.58);
}

.feedback {
  min-height: 22px;
  margin-top: 8px;
  color: #df7e73;
  font-weight: 720;
}

.feedback.is-good {
  color: #9fd39b;
}

.hint-toggle {
  margin-top: 10px;
  padding: 0 12px;
  color: var(--paper);
  background: rgba(239, 225, 197, 0.08);
  border-color: var(--line);
}

.hint-box {
  max-width: 760px;
  margin-top: 12px;
  padding: 14px 16px;
  color: rgba(244, 234, 217, 0.82);
  background: rgba(239, 225, 197, 0.07);
  border-left: 3px solid var(--brass);
  line-height: 1.65;
}

.activity {
  min-height: 112px;
  padding: 16px 18px;
  background: rgba(20, 17, 15, 0.78);
}

.activity ul {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.87rem;
}

.activity li::before {
  content: "-";
  margin-right: 8px;
  color: var(--brass);
}

.reward-panel {
  background: rgba(29, 24, 19, 0.9);
}

.vault-visual {
  min-height: 214px;
  background:
    linear-gradient(180deg, transparent 52%, rgba(29, 24, 19, 0.92)),
    url("assets/vault-art.png") center / cover;
  border-bottom: 1px solid var(--line);
}

.reward-content {
  padding: 20px;
}

.reward-content h2 {
  margin-top: 8px;
  color: var(--ink);
  font-size: 1.7rem;
  line-height: 1.05;
}

.reward-content p:not(.panel-label) {
  margin: 13px 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.code-window {
  min-height: 58px;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #0f0d0c;
  color: var(--brass-bright);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(1rem, 2vw, 1.32rem);
  font-weight: 780;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.code-window.locked {
  color: rgba(228, 192, 113, 0.45);
}

.secondary-button {
  width: 100%;
  margin-top: 12px;
  padding: 0 14px;
  color: #18110c;
  background: var(--paper);
  border-color: rgba(239, 225, 197, 0.34);
}

.secondary-button:disabled {
  color: rgba(244, 234, 217, 0.34);
  background: rgba(239, 225, 197, 0.08);
}

.shake {
  animation: shake 0.36s ease both;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  50% {
    transform: translateX(7px);
  }
  75% {
    transform: translateX(-4px);
  }
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 160px minmax(0, 1fr);
  }

  .reward-panel {
    grid-column: 1 / -1;
    position: static;
    display: grid;
    grid-template-columns: minmax(240px, 0.8fr) 1fr;
  }

  .vault-visual {
    min-height: 100%;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 14px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding-bottom: 14px;
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 16px;
    min-height: auto;
    padding-top: 16px;
  }

  .progress-panel {
    position: static;
  }

  .seal-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .seal-button {
    min-height: 42px;
    justify-content: center;
  }

  .seal-name {
    display: none;
  }

  .intro-line,
  .puzzle-heading,
  .answer-row,
  .reward-panel {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .answer-row {
    display: grid;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }

  .reward-panel {
    display: block;
  }

  .vault-visual {
    min-height: 178px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
