/* ==========================================================================
   MottleWiki Stylesheet (style.css)
   Clean, dark theme, responsive, zero external dependencies
   ========================================================================== */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --text-primary: #f0f6fc;
  --text-secondary: #c9d1d9;
  --text-muted: #8b949e;
  --border-color: #30363d;
  --border-accent: #388bfd;
  --accent-blue: #58a6ff;
  --accent-green: #3fb950;
  --accent-yellow: #d29922;
  --content-max-width: 680px;
  --container-max-width: 1080px;
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  font-family: var(--font-stack);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Links */
a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.15s ease-in-out;
}

a:hover, a:focus {
  text-decoration: underline;
  color: #79c0ff;
}

/* Header & Navigation */
.site-header {
  border-bottom: 1px solid var(--border-color);
  background-color: rgba(13, 17, 23, 0.95);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-inner {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.site-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-logo:hover {
  text-decoration: none;
  color: var(--accent-blue);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--text-secondary);
  font-size: 0.95rem;
  padding: 4px 8px;
  border-radius: 6px;
}

.site-nav a:hover, .site-nav a.active {
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
  text-decoration: none;
}

/* Layout Containers */
.container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* Main readable prose width: 680px */
.content-body {
  max-width: var(--content-max-width);
  margin: 0 auto;
}

/* Typography */
h1, h2, h3, h4 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.3;
  margin-top: 1.8em;
  margin-bottom: 0.6em;
}

h1 {
  font-size: 2rem;
  margin-top: 0.5em;
  margin-bottom: 0.8em;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.4em;
}

h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.3em;
}

h3 {
  font-size: 1.2rem;
}

p {
  margin: 0.9em 0;
}

/* Hero layout with iframe */
.hero-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 32px;
}

.hero-iframe-col {
  flex: 1 1 72%;
  min-width: 0;
}

.hero-side-col {
  flex: 0 0 250px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-side-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.game-iframe {
  width: 100%;
  height: 600px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: #000;
  display: block;
}

/* Responsive iframe height on narrow screens */
@media (max-width: 768px) {
  .hero-layout {
    flex-direction: column;
  }
  .hero-iframe-col, .hero-side-col {
    width: 100%;
    flex: none;
  }
  .game-iframe {
    height: 70vh;
  }
}

/* Cards grid: wide 2 cols, narrow 1 col */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 28px 0;
}

@media (max-width: 640px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}

.nav-card {
  display: block;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 18px 20px;
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
  color: var(--text-secondary);
}

.nav-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-accent);
  background-color: var(--bg-tertiary);
  text-decoration: none;
}

.nav-card-title {
  color: var(--text-primary);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-card-desc {
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
  color: var(--text-muted);
}

/* Image preview gallery */
.preview-gallery {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin: 24px 0;
}

.preview-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.preview-box img {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
  border: 1px solid var(--border-color);
}

.preview-box figcaption {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* FAQ section */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 24px 0;
}

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

.faq-question {
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 8px 0;
}

.faq-answer {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Step-by-step numbered guide */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 28px 0;
}

.step-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-blue);
  border-radius: 6px;
  padding: 16px 20px;
}

.step-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.step-num {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-blue);
  background-color: rgba(88, 166, 255, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
}

.step-title {
  color: var(--text-primary);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
}

.step-desc {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Controls list */
.controls-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0;
}

.control-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 0.95rem;
}

.control-label {
  font-weight: 600;
  color: var(--text-primary);
}

.control-value {
  color: var(--accent-yellow);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 20px 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

th, td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

th {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
}

tr:nth-child(even) td {
  background-color: rgba(22, 27, 34, 0.5);
}

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

.todo-tag {
  color: var(--accent-yellow);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
}

.table-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 8px;
}

/* Internal links list */
.internal-links {
  list-style: none;
  padding: 0;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.internal-links li a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-weight: 500;
  width: 100%;
}

.internal-links li a:hover {
  border-color: var(--border-accent);
  background-color: var(--bg-tertiary);
  color: var(--accent-blue);
  text-decoration: none;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  padding: 32px 16px;
  margin-top: 48px;
  text-align: center;
}

.footer-inner {
  max-width: var(--content-max-width);
  margin: 0 auto;
}

.footer-declaration {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
  margin: 0;
}
