:root {
  --bg: #f7f1e8;
  --card: #fffaf2;
  --text: #2b2118;
  --muted: #6b5b4b;
  --primary: #b54922;
  --primary-hover: #963918;
  --accent: #e0a03a;
  --border: rgba(43, 33, 24, 0.14);
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

h1,
h2,
h3,
.font-display {
  font-family: Fraunces, Georgia, serif;
  line-height: 1.2;
  color: var(--text);
  margin-top: 0;
}

h1 {
  font-size: 40px;
  margin-bottom: 12px;
}

h2 {
  font-size: 28px;
  margin-bottom: 16px;
}

h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

p {
  max-width: 70ch;
  margin: 0 0 16px;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: Fraunces, Georgia, serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 15px;
  font-weight: 600;
}

.nav-links a {
  color: var(--text);
}

.nav-links a:hover {
  color: var(--primary);
  text-decoration: none;
}

/* Hero & Player Stage */
.hero-section {
  padding: 28px 0 32px;
}

.hero-sub {
  color: var(--muted);
  font-size: 18px;
  margin-bottom: 18px;
}

.stage-shell {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 12px;
}

.stage-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 320px;
  border-radius: 10px;
  overflow: hidden;
  background: #1e1410;
  box-shadow: inset 0 0 0 1px rgba(255, 240, 214, 0.14);
}

.stage-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.stage-cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.stage-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgba(28, 17, 10, 0.56) 0%, rgba(28, 17, 10, 0.24) 55%, rgba(20, 12, 7, 0.48) 100%),
    linear-gradient(to bottom, rgba(26, 15, 9, 0.12) 0%, rgba(26, 15, 9, 0.34) 100%);
}

.stage-cover::after {
  content: "";
  position: absolute;
  inset: 12px;
  z-index: 1;
  pointer-events: none;
  border: 1px solid rgba(255, 244, 222, 0.24);
  border-radius: 8px;
}

.stage-cover[hidden] {
  display: none;
}

.stage-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.001);
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.stage-cover:hover img {
  transform: scale(1.04);
}

.stage-play-overlay {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 24px 28px;
  text-align: center;
}

.cover-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(28, 18, 12, 0.66);
  border: 1px solid rgba(253, 230, 176, 0.38);
  color: #fde047;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

.cover-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2dd4bf;
  box-shadow: 0 0 8px #2dd4bf;
}

.cover-title {
  font-size: clamp(30px, 4.8vw, 56px);
  line-height: 1.05;
  color: #fffaf2;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 10px rgba(20, 11, 6, 0.72), 0 8px 28px rgba(20, 11, 6, 0.56);
}

.btn-play-hero {
  border-radius: 999px;
  min-height: 52px;
  padding: 13px 30px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, #b54922 0%, #b54922 52%, #963918 100%);
  border: 1px solid rgba(255, 224, 168, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 210, 0.35),
    0 10px 26px rgba(24, 12, 6, 0.48),
    0 0 0 4px rgba(224, 160, 58, 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.stage-cover:hover .btn-play-hero,
.btn-play-hero:hover {
  background: linear-gradient(180deg, #d96439 0%, #b54922 52%, #963918 100%);
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 220, 0.45),
    0 14px 32px rgba(24, 12, 6, 0.55),
    0 0 0 6px rgba(224, 160, 58, 0.26);
}

.btn-play-hero:active {
  transform: translateY(0);
}

.play-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 250, 242, 0.2);
  font-size: 12px;
  padding-left: 2px;
}

.cover-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 2px;
}

.cover-pills span {
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(24, 15, 10, 0.58);
  border: 1px solid rgba(255, 244, 222, 0.22);
  color: rgba(255, 248, 234, 0.92);
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(4px);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, transform 0.12s ease, border-color 0.15s ease;
}

.btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  color: #fffaf2;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  background: var(--primary-hover);
  text-decoration: none;
}

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--primary);
  text-decoration: none;
}

.btn-secondary[data-gf-liked],
.btn-secondary[aria-pressed="true"] {
  background: rgba(194, 86, 47, 0.12);
  border-color: var(--primary);
  color: var(--primary);
}

/* Custom Desert Loader */
.stage-loader {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: linear-gradient(160deg, #2b1d16, #1e1410);
  color: #fffaf2;
}

.stage-frame[data-gf-state="loading"] .stage-loader {
  display: flex;
}

.sand-hourglass {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(253, 230, 138, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spinLoader 0.85s linear infinite;
}

@keyframes spinLoader {
  to {
    transform: rotate(360deg);
  }
}

/* Action Bar below stage */
.stage-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.share-msg {
  font-size: 14px;
  color: var(--primary);
  font-weight: 600;
}

/* Content Sections */
.section {
  padding: 48px 0 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: start;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.badge-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(224, 160, 58, 0.18);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

/* Data Tables */
.table-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--muted);
  background: rgba(43, 33, 24, 0.03);
}

tr:last-child td {
  border-bottom: none;
}

/* Speedrun Leaderboard */
.board-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.board-tab {
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.board-tab.active {
  background: var(--primary);
  color: #fffaf2;
  border-color: transparent;
}

.board-empty {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* Numbered Walkthrough Steps */
.step-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.step-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.step-num {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fffaf2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

/* FAQ */
.faq-list {
  display: grid;
  gap: 12px;
}

.faq-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.faq-item h3 {
  font-size: 18px;
  margin-bottom: 6px;
}

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

/* Comments (Client-Side) */
.comment-form {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.comment-list {
  display: grid;
  gap: 10px;
}

.comment-item {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
}

.comment-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.comment-empty {
  color: var(--muted);
  font-size: 15px;
}

/* Footer */
.site-footer {
  margin-top: 64px;
  padding: 32px 0;
  border-top: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 14px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-links a {
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--primary);
}

/* Breadcrumbs */
.breadcrumb {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}

.stage-frame.is-pseudo-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  max-height: 100dvh !important;
  z-index: 9999 !important;
  border-radius: 0 !important;
  aspect-ratio: auto !important;
}

html.elg-fs-lock,
html.elg-fs-lock body {
  overflow: hidden !important;
}

@media (max-width: 640px) {
  h1 {
    font-size: 26px;
    line-height: 1.18;
    text-wrap: balance;
  }
  h2 {
    font-size: 24px;
  }
  .grid-2,
  .grid-cards {
    grid-template-columns: 1fr;
  }
  .header-inner {
    flex-wrap: wrap;
    gap: 8px;
    min-height: auto;
    padding: 8px 0;
  }
  .nav-links {
    width: 100%;
    gap: 10px;
    font-size: 14px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .nav-links a {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .nav-links::-webkit-scrollbar {
    display: none;
  }
  .stage-shell {
    padding: 6px;
  }
  .stage-frame {
    aspect-ratio: 4 / 5;
    min-height: 360px;
    max-height: 54dvh;
  }
  .stage-cover::after {
    inset: 8px;
  }
  .stage-play-overlay {
    gap: 10px;
    padding: 16px;
  }
  .cover-eyebrow {
    font-size: 12px;
    padding: 4px 11px;
  }
  .btn-play-hero {
    min-height: 46px;
    padding: 10px 22px;
    font-size: 15px;
  }
  .cover-pills {
    gap: 6px;
  }
  .cover-pills span {
    font-size: 12px;
    padding: 3px 9px;
  }
}

@media (max-width: 768px) {
  .stage-actions {
    gap: 8px;
  }
  .stage-actions .action-group {
    width: 100%;
  }
  .stage-actions .action-group:first-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .stage-actions .action-group:first-child .btn {
    flex: 1 1 calc(33.333% - 6px);
    min-width: 96px;
    width: auto;
    min-height: 44px;
    font-size: 14px;
    padding: 8px 6px;
    white-space: nowrap;
  }
  .stage-actions .action-group:last-child .btn {
    width: 100%;
    min-height: 44px;
    font-size: 14px;
    padding: 8px 10px;
  }
  .stage-actions [data-gf-fullscreen] {
    grid-column: auto;
    background: var(--card);
    color: var(--text);
    border-color: var(--border);
  }
  .stage-actions [data-gf-fullscreen]:hover {
    background: var(--card);
    border-color: var(--primary);
  }
  .stage-actions .share-msg:not(:empty) {
    flex: 1 0 100%;
    text-align: center;
  }
  .stage-actions .share-msg:empty {
    display: none;
  }
}

/* Article body refinements */
.article-body p {
  line-height: 1.75;
}

.article-body h2 {
  margin-top: 40px;
}

.article-body a {
  color: #8b2b10;
  text-decoration: underline;
  text-decoration-color: rgba(139, 43, 16, 0.4);
  text-underline-offset: 3px;
}

.article-body a:hover {
  color: var(--primary-hover);
  text-decoration-color: currentColor;
}

.article-body blockquote {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.article-body img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 4px 0 28px;
}

.article-body figure {
  margin: 0 0 28px;
}

.article-body figcaption {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.article-body ol,
.article-body ul {
  max-width: 70ch;
  padding-left: 24px;
  line-height: 1.65;
}

.article-body li {
  margin-bottom: 10px;
}

.article-body li:last-child {
  margin-bottom: 0;
}

@media (max-width: 767.98px) {
  .article-body ol,
  .article-body ul {
    padding-left: 22px;
  }
  .hero-sub {
    font-size: 16px;
    line-height: 1.6;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage-cover img,
  .btn-play-hero {
    transition: none;
  }
  .stage-cover:hover img,
  .stage-cover:hover .btn-play-hero,
  .btn-play-hero:hover {
    transform: none;
  }
}


/* Utility & Engine Integration */
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.stage-frame[data-gf-state="loading"] .stage-cover,
.stage-frame[data-gf-state="playing"] .stage-cover {
  display: none;
}

.stage-frame[data-gf-state="playing"] .stage-loader {
  display: none;
}

.board-mine {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(224, 160, 58, 0.14);
  border: 1px solid rgba(224, 160, 58, 0.36);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.board-note {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--muted);
}

.board-note p {
  margin: 0;
}

tr.is-mine-row td {
  background: rgba(224, 160, 58, 0.12);
  font-weight: 600;
}

/* Comments & Replies */
.reply-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(194, 86, 47, 0.09);
  border: 1px solid rgba(194, 86, 47, 0.25);
  font-size: 14px;
}

[data-gf-comment-form][data-gf-replying] .reply-banner {
  display: flex;
}

.btn-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--primary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-link:hover {
  text-decoration: underline;
}

.comment-card,
.reply-card {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
}

.comment-card[data-gf-owner],
.reply-card[data-gf-owner] {
  border-left: 3px solid var(--primary);
  background: rgba(194, 86, 47, 0.05);
}

.comment-author {
  color: var(--text);
  font-size: 14px;
}

.owner-badge {
  display: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary);
  color: #fffaf2;
  font-size: 12px;
  font-weight: 600;
}

[data-gf-owner] > .comment-meta .owner-badge,
[data-gf-c-owner]:not([hidden]) {
  display: inline-block;
}

[data-gf-c-owner][hidden] {
  display: none !important;
}

.reply-target {
  color: var(--primary);
  font-weight: 600;
}

.comment-time {
  margin-left: auto;
}

.comment-body {
  margin: 0 0 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-foot {
  display: flex;
  align-items: center;
  gap: 12px;
}

.comment-replies {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding-left: 16px;
  border-left: 2px solid var(--border);
}

.comment-replies:empty {
  display: none;
}

[data-gf-comments][data-gf-empty]::before {
  content: "No comments yet. Share your clear time, favorite relic, or which ending you unlocked!";
  display: block;
  color: var(--muted);
  font-size: 15px;
}

[data-gf-comments][data-gf-off]::before {
  content: "Comments are currently closed.";
  display: block;
  color: var(--muted);
  font-size: 15px;
}

/* Guide & Legal Content */
.article-body {
  display: grid;
  gap: 18px;
}

.article-body blockquote {
  margin: 0 0 8px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.article-body blockquote p {
  margin: 0;
}

.article-body h2 {
  margin-top: 28px;
  margin-bottom: 10px;
}

.article-body h3 {
  margin-top: 18px;
  margin-bottom: 6px;
}

.article-body ul,
.article-body ol {
  margin: 0 0 16px;
  padding-left: 22px;
  max-width: 70ch;
}

.article-body li {
  margin-bottom: 8px;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  font-size: 15px;
}

.article-body th,
.article-body td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.article-body th {
  background: rgba(43, 33, 24, 0.04);
  color: var(--muted);
  font-weight: 600;
}

.article-body tr:last-child td {
  border-bottom: none;
}

.cta-card {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.legal-card h2,
.legal-card h3 {
  margin-top: 20px;
}

.not-found-box {
  max-width: 620px;
  margin: 40px auto;
  text-align: center;
}

.not-found-box p {
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 640px) {
  .article-body table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .cta-card .btn {
    width: 100%;
  }
}

/* Embed Game Player Styles (Scoped to body.is-embed) */
html:has(body.is-embed),
body.is-embed {
  --g-bg: #1e1410;
  --g-panel: rgba(39, 26, 20, 0.88);
  --g-border: rgba(253, 230, 138, 0.24);
  --g-text: #fffaf2;
  --g-muted: #d6c5b3;
  --g-accent: #e0a03a;
  --g-primary: #b54922;
  --g-success: #22c55e;
  --g-teal: #2dd4bf;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--g-bg);
  color: var(--g-text);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body.is-embed .g-root {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.g-canvas {
  position: absolute;
  inset: 0;
  display: block;
}

#fx-canvas {
  cursor: crosshair;
  touch-action: none;
}

.hud-top-dock {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 14;
  pointer-events: none;
  padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hud-top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.hud-top-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  pointer-events: none;
}

.hud-sub-stats {
  display: contents;
}

.hud-top-right {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  flex: 0 0 auto;
  pointer-events: none;
}

.hud-top-dock .hud-pill,
.hud-top-dock .g-btn,
.hud-top-dock .event-banner {
  pointer-events: auto;
}

.hud-notices {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
  pointer-events: none;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--g-panel);
  border: 1px solid var(--g-border);
  backdrop-filter: blur(10px);
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

.hud-bar-track {
  width: 72px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.hud-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #e0a03a, #fde047);
  transition: width 0.15s ease;
}

.hud-hopper {
  gap: 7px;
}

.hud-hopper-track {
  width: 56px;
}

.hud-hopper-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #e0a03a, #fde047);
  transition: width 0.12s ease;
}

.hud-hopper.full {
  border-color: #fde047;
  color: #fde047;
  animation: pulseGold 1.4s ease-in-out infinite;
}

.hud-hopper-txt {
  font-variant-numeric: tabular-nums;
}

.hud-fever {
  color: var(--g-text);
  cursor: default;
  gap: 7px;
  font-family: inherit;
}

.hud-fever-track {
  width: 48px;
}

.hud-fever-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #e0a03a, #fde047);
  transition: width 0.12s ease;
}

.hud-fever.ready {
  cursor: pointer;
  border-color: #fde047;
  color: #fde047;
  animation: pulseGold 1.1s ease-in-out infinite;
}

.hud-fever.active {
  background: rgba(194, 86, 47, 0.92);
  border-color: #fde047;
  color: #fffaf2;
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.55);
}

.hud-cash {
  color: #22c55e;
  font-variant-numeric: tabular-nums;
}

.hud-timer {
  color: var(--g-muted);
  font-variant-numeric: tabular-nums;
}

.g-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--g-border);
  background: var(--g-panel);
  color: var(--g-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.g-btn:hover {
  background: rgba(65, 42, 30, 0.95);
  border-color: rgba(253, 230, 138, 0.45);
}

.g-btn:active {
  transform: scale(0.96);
}

.g-btn-icon,
.g-btn-fs {
  min-width: 32px;
  padding: 5px 8px;
}

.g-btn-exit-fs {
  background: var(--g-primary);
  border-color: #fde047;
  color: #fffaf2;
  padding: 5px 11px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.42);
}

.g-btn-exit-fs:hover {
  background: #963918;
  border-color: #fde047;
}

.g-btn-primary {
  background: var(--g-primary);
  border-color: rgba(255, 240, 210, 0.35);
}

.g-btn-primary:hover {
  background: #d96439;
}

.g-btn-gold {
  background: linear-gradient(135deg, #b54922, #963918);
  border-color: #fde047;
  color: #fffaf2;
  animation: pulseGold 1.4s ease-in-out infinite;
}

@keyframes pulseGold {
  0%, 100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(250, 204, 21, 0); }
}

.shop-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--g-success);
  border: 1.5px solid #1e1410;
  display: none;
}

.shop-badge.show {
  display: block;
}

.minimap-wrap {
  position: absolute;
  bottom: max(12px, env(safe-area-inset-bottom));
  right: max(12px, env(safe-area-inset-right));
  z-index: 10;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid var(--g-border);
  background: rgba(25, 16, 12, 0.86);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

#minimap-canvas {
  display: block;
  width: 140px;
  height: 88px;
}

.hud-bottom-left {
  position: absolute;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: max(12px, env(safe-area-inset-left));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.event-banner {
  position: static;
  transform: none;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: min(520px, 94%);
  padding: 5px 13px;
  border-radius: 999px;
  background: rgba(34, 24, 18, 0.92);
  border: 1px solid rgba(250, 204, 21, 0.55);
  font-size: 12px;
  font-weight: 600;
  color: #fde047;
  text-align: center;
  white-space: normal;
  line-height: 1.35;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.event-banner.show {
  display: inline-flex;
}

.toast {
  position: static;
  transform: none;
  display: none;
  pointer-events: none;
  max-width: min(520px, 94%);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(30, 20, 15, 0.94);
  border: 1px solid rgba(45, 212, 191, 0.55);
  font-size: 12px;
  font-weight: 600;
  color: #fffaf2;
  text-align: center;
  white-space: normal;
  line-height: 1.35;
}

.toast.show {
  display: inline-flex;
}

.region-banner {
  position: static;
  transform: none;
  display: none;
  pointer-events: none;
  max-width: min(520px, 94%);
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(25, 16, 12, 0.88);
  border: 1px solid rgba(253, 224, 71, 0.45);
  color: #fde047;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
  white-space: normal;
  line-height: 1.35;
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.region-banner.show {
  display: inline-flex;
}

.start-hint {
  position: absolute;
  bottom: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  pointer-events: none;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--g-panel);
  border: 1px solid var(--g-border);
  font-size: 12px;
  color: var(--g-text);
  white-space: nowrap;
  transition: opacity 0.45s ease;
}

.start-hint.hide {
  opacity: 0;
}

/* Modals */
.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(18, 11, 8, 0.72);
  backdrop-filter: blur(4px);
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 88%;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: #2b1d16;
  border: 1px solid rgba(253, 230, 138, 0.32);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(253, 230, 138, 0.18);
  font-size: 15px;
  font-weight: 700;
}

.modal-body {
  padding: 14px 16px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.55;
  color: var(--g-muted);
}

.modal-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 16px 0;
}

.tab-btn {
  flex: 1;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--g-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--g-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--g-primary);
  color: #fffaf2;
  border-color: transparent;
}

.shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(253, 230, 138, 0.14);
}

.contract-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(224, 160, 58, 0.14), rgba(194, 86, 47, 0.10));
  border: 1px solid rgba(253, 230, 138, 0.28);
}

.contract-portrait {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.contract-rank {
  font-size: 13px;
  font-weight: 700;
  color: #fde047;
  margin-bottom: 3px;
}

.contract-tagline {
  font-size: 12px;
  color: var(--g-text);
  opacity: 0.92;
  line-height: 1.4;
}

.shop-item-main {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.item-icon-slot,
.relic-icon-slot {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: radial-gradient(circle at 35% 30%, rgba(253, 230, 138, 0.16), rgba(20, 12, 8, 0.72));
  border: 1px solid rgba(253, 230, 138, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 250, 240, 0.14), 0 3px 8px rgba(0, 0, 0, 0.28);
  padding: 3px;
}

.item-icon-slot {
  width: 44px;
  height: 44px;
}

.relic-icon-slot {
  width: 38px;
  height: 38px;
  border-radius: 9px;
}

.item-icon-slot.equipped {
  border-color: #fde047;
  background: radial-gradient(circle at 35% 30%, rgba(250, 204, 21, 0.28), rgba(40, 22, 12, 0.8));
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.26);
}

.item-icon-slot.rune,
.relic-icon-slot.rune {
  border-color: rgba(45, 212, 191, 0.55);
  background: radial-gradient(circle at 35% 30%, rgba(45, 212, 191, 0.24), rgba(16, 36, 36, 0.78));
}

.item-icon-slot.locked,
.relic-icon-slot.locked {
  opacity: 0.65;
  filter: saturate(0.65);
}

.elg-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.shop-item-title {
  color: var(--g-text);
  font-weight: 600;
  font-size: 13px;
}

.shop-item-desc {
  color: var(--g-muted);
  font-size: 12px;
  margin-top: 2px;
}

.relic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.relic-card {
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(253, 230, 138, 0.14);
}

.relic-card-head {
  display: flex;
  align-items: center;
  gap: 9px;
}

.relic-card-info {
  min-width: 0;
}

.relic-card.found {
  border-color: rgba(45, 212, 191, 0.45);
  background: rgba(45, 212, 191, 0.08);
}

.g-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--g-border);
  background: rgba(0, 0, 0, 0.28);
  color: var(--g-text);
  font-size: 12px;
  margin: 6px 0;
}

@media (max-width: 920px) {
  .hud-bar-track {
    width: 44px;
  }
  .hud-hopper-track,
  .hud-fever-track {
    width: 34px;
  }
  .hud-top-right .btn-lbl {
    display: none;
  }
  .hud-top-dock .hud-pill,
  .hud-top-dock .g-btn {
    padding: 4px 9px;
    gap: 5px;
  }
}

@media (max-width: 960px) and (min-width: 641px) {
  .start-hint {
    left: max(12px, env(safe-area-inset-left));
    bottom: 54px;
    transform: none;
    max-width: calc(100% - 176px);
    white-space: normal;
    text-align: left;
  }
}

@media (max-width: 640px) {
  .minimap-wrap {
    display: none;
  }
  .relic-grid {
    grid-template-columns: 1fr;
  }
  .start-hint {
    max-width: 92%;
    white-space: normal;
    text-align: center;
  }
}

@media (max-width: 599px) {
  .hud-top-dock {
    padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));
    gap: 5px;
  }
  .hud-top-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 5px 4px;
  }
  .hud-top-left {
    display: contents;
  }
  .hud-main-pill {
    order: 1;
    padding: 4px 8px;
    gap: 5px;
  }
  .hud-main-pill .hud-bar-track,
  .hud-main-pill .hud-timer-wrap {
    display: none;
  }
  .hud-top-right {
    order: 2;
    gap: 4px;
    margin-left: auto;
  }
  .hud-top-right .g-btn {
    min-height: 28px;
    padding: 4px 7px;
  }
  .hud-top-right .btn-lbl {
    display: none;
  }
  .hud-sub-stats {
    order: 3;
    width: 100%;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 5px;
  }
  .hud-sub-stats .hud-pill {
    padding: 4px 8px;
    gap: 5px;
  }
  .hud-hopper-track,
  .hud-fever-track {
    width: 26px;
  }
  .hud-bottom-left {
    bottom: max(8px, env(safe-area-inset-bottom));
    left: max(8px, env(safe-area-inset-left));
    gap: 6px;
  }
  .hud-bottom-left .g-btn {
    min-height: 30px;
    padding: 4px 10px;
  }
}

@media (max-height: 440px) {
  .hud-top-dock {
    padding: max(6px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
    gap: 4px;
  }
  .hud-pill,
  .g-btn {
    min-height: 28px;
    padding: 4px 9px;
  }
}

@media (hover: none), (pointer: coarse), (max-width: 920px) {
  .hud-pill,
  .g-btn,
  .event-banner,
  .toast,
  .region-banner,
  .start-hint,
  .minimap-wrap,
  .modal-backdrop {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .hud-pill,
  .g-btn:not(.g-btn-primary):not(.g-btn-gold):not(.is-active),
  .event-banner,
  .toast,
  .region-banner,
  .start-hint {
    background: rgba(34, 21, 13, 0.88);
  }
  .modal-backdrop {
    background: rgba(16, 10, 6, 0.78);
  }
}
