:root {
  --game-green: #2b7f68;
  --game-yellow: #f0cf3b;
  --game-red: #d9553f;
}

.game-guide-page .mark {
  border-radius: 14px;
  object-fit: cover;
}

.game-guide-page .primary-nav a {
  font-weight: 850;
}

.game-hero {
  padding-top: 54px;
}

.game-hero-content h1 {
  max-width: 980px;
  margin-inline: auto;
}

.game-command {
  padding-bottom: 30px;
}

.guide-console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .86fr);
  gap: clamp(18px, 3vw, 34px);
  align-items: center;
  min-height: auto;
  padding: clamp(18px, 3vw, 34px);
  cursor: default;
}

.guide-console:hover {
  transform: none;
}

.guide-console-copy h2 {
  max-width: 780px;
  margin: 8px 0 12px;
  font-size: clamp(30px, 4vw, 54px);
  line-height: .98;
}

.guide-console-copy p {
  max-width: 760px;
  color: var(--muted);
  font-size: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.hero-actions .upload-choose {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  text-decoration: none;
}

.hero-actions .secondary {
  background: var(--sun);
}

.hero-actions .quiet {
  background: #fff;
}

.guide-preview {
  margin: 0;
  padding: 10px;
  background: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 10px 10px 0 rgba(42, 33, 27, .18);
  transform: rotate(.6deg);
}

.guide-preview img,
.media-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
}

.guide-preview figcaption,
.media-card figcaption {
  margin-top: 8px;
  color: #6d6257;
  font-size: 14px;
}

.guide-preview figcaption {
  color: #f7eddc;
}

.dashboard-grid {
  margin-top: 18px;
}

.mini-route-card {
  min-height: 210px;
}

.mini-route-card h3 {
  margin-top: 0;
}

.mini-route-card a {
  color: var(--ink);
  text-decoration: none;
}

.guide-table-wrap {
  margin-top: 18px;
}

.guide-table th,
.guide-table td {
  vertical-align: top;
}

.guide-table td:first-child {
  font-weight: 900;
}

.guide-note {
  margin: 16px 0 0;
  padding: 16px 18px;
  color: #2a211b;
  background: #fff8e5;
  border: 2px solid var(--ink);
  border-left: 10px solid var(--game-red);
  border-radius: 18px;
}

.media-grid {
  margin-top: 18px;
}

.media-card {
  margin: 0;
  min-height: 0;
}

.guide-context-figure {
  max-width: 840px;
  margin: 0 auto;
}

.guide-context-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 2px solid var(--ink);
  border-radius: 18px;
}

.guide-context-figure figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.guide-related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  margin-top: 6px;
}

.guide-related-links a {
  color: var(--ink);
  font-weight: 850;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.legal-copy p {
  color: var(--muted);
  font-size: 18px;
}

.game-legal-hero {
  min-height: 360px;
}

.layout-generator-command {
  padding-bottom: 30px;
}

.layout-tool-card {
  padding: clamp(18px, 3vw, 34px);
}

.layout-tool-heading {
  max-width: 920px;
}

.layout-tool-heading h2 {
  margin: 8px 0 12px;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1;
}

.layout-tool-heading p {
  max-width: 820px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.layout-tool-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
  margin-top: 24px;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 22px;
  background: var(--wash);
}

.layout-control {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.layout-control label,
.layout-map-label {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.layout-control input,
.layout-control select {
  width: 100%;
  min-height: 46px;
  padding: 9px 12px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 750;
}

.layout-control small {
  min-height: 38px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.layout-control-wide {
  grid-column: span 2;
}

.layout-actions {
  display: flex;
  flex-wrap: wrap;
  grid-column: span 2;
  gap: 10px;
}

.layout-actions .upload-choose,
.layout-copy-action {
  min-height: 46px;
  color: var(--ink);
  cursor: pointer;
}

.layout-primary-action {
  background: var(--mint);
}

.layout-result {
  margin-top: 22px;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 22px;
  background: var(--paper-tint);
}

.layout-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.layout-result-head strong {
  display: block;
  max-width: 580px;
  margin-top: 7px;
  color: var(--ink);
  line-height: 1.45;
}

.layout-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.layout-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.layout-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--line);
  border-radius: 4px;
}

.swatch-wall { background: #2a1826; }
.swatch-path { background: #d7f4e5; }
.swatch-entrance { background: #f0cf3b; }
.swatch-checkpoint { background: #d9553f; }

.layout-grid-wrap {
  display: grid;
  place-items: center;
  min-height: 300px;
  padding: 14px;
  overflow: auto;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: #f4eadb;
}

.layout-grid {
  display: grid;
  grid-template-columns: repeat(var(--layout-cols, 12), minmax(0, 1fr));
  width: min(100%, 680px);
  aspect-ratio: 1;
  gap: 2px;
  padding: 5px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.layout-cell {
  min-width: 0;
  aspect-ratio: 1;
  border-radius: 2px;
}

.layout-cell-wall { background: #2a1826; }
.layout-cell-path { background: #d7f4e5; }
.layout-cell-entrance { background: #f0cf3b; box-shadow: inset 0 0 0 2px var(--line); }
.layout-cell-checkpoint { background: #d9553f; box-shadow: inset 0 0 0 2px var(--line); }

.layout-map-label {
  display: block;
  margin-top: 16px;
}

.layout-text-map {
  display: block;
  width: 100%;
  min-height: 150px;
  margin-top: 8px;
  padding: 12px;
  resize: vertical;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #2a1826;
  color: #fff8e8;
  font: 12px/1.35 var(--mono);
  letter-spacing: .05em;
}

.layout-copy-action {
  margin-top: 12px;
  color: var(--ink);
}

.layout-step-cards {
  grid-template-columns: repeat(4, 1fr);
}

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

  .layout-tool-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layout-control-wide,
  .layout-actions {
    grid-column: span 1;
  }

  .layout-step-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .game-guide-page {
    overflow-x: hidden;
  }

  .game-guide-page .topbar:before {
    inset: 0;
  }

  .wrap,
  .tool-card,
  .upload,
  .info,
  .size-table-wrapper {
    max-width: calc(100vw - 20px);
  }

  .game-hero {
    padding-top: 34px;
  }

  .game-hero-content {
    width: 100%;
    max-width: calc(100vw - 32px);
    overflow: visible;
  }

  .game-hero-content p {
    width: 100%;
    max-width: calc(100vw - 52px);
    font-size: 15px;
    overflow-wrap: anywhere;
  }

  .tool-hero h1 {
    display: block;
    width: min(100%, 318px);
    max-width: 318px !important;
    margin-inline: auto;
    font-size: 30px !important;
    line-height: 1.12 !important;
    text-align: center;
    text-shadow: 1.5px 1.5px 0 #fff, 3px 3px 0 rgba(55,39,51,.08) !important;
    overflow-wrap: anywhere;
    word-break: normal;
    text-wrap: wrap;
  }

  .tool-hero h1 span {
    display: block !important;
    width: 100%;
    max-width: 100%;
    white-space: normal;
    transform: none !important;
    color: var(--ink) !important;
  }

  .guide-console {
    padding: 16px;
    gap: 16px;
  }

  .layout-tool-card {
    padding: 16px;
  }

  .layout-tool-heading h2 {
    font-size: 26px;
  }

  .layout-tool-heading p {
    font-size: 15px;
  }

  .layout-tool-form {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .layout-control-wide,
  .layout-actions {
    grid-column: auto;
  }

  .layout-actions {
    display: grid;
  }

  .layout-actions .upload-choose {
    width: 100%;
  }

  .layout-result-head {
    display: grid;
  }

  .layout-legend {
    justify-content: flex-start;
  }

  .layout-grid-wrap {
    min-height: 0;
    padding: 8px;
  }

  .layout-grid {
    min-width: 300px;
  }

  .layout-step-cards {
    grid-template-columns: 1fr;
  }

  .guide-console-copy h2 {
    max-width: calc(100vw - 56px);
    margin-inline: auto;
    font-size: 24px;
    line-height: 1.08;
    text-align: center;
    overflow-wrap: anywhere;
    text-wrap: wrap;
  }

  .guide-console-copy p {
    width: 100%;
    max-width: calc(100vw - 56px);
    font-size: 15px;
    overflow-wrap: anywhere;
  }

  .hero-actions {
    display: grid;
  }

  .hero-actions .upload-choose {
    width: 100%;
  }

  .guide-table,
  .guide-table thead,
  .guide-table tbody,
  .guide-table tr,
  .guide-table th,
  .guide-table td {
    display: block;
  }

  .guide-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .guide-table tr {
    padding: 10px 0;
    border-bottom: 2px solid rgba(55,39,51,.14);
  }

  .guide-table tr:last-child {
    border-bottom: 0;
  }

  .guide-table td {
    padding: 5px 12px;
    border-bottom: 0;
    white-space: normal !important;
  }

  .guide-table td:first-child {
    font-size: 14px;
  }
}
