:root {
  --bg:        #0d0d0f;
  --bg-raised: #141418;
  --border:    #2a2a35;
  --accent:    #9b5fe0;
  --accent-dim:#6a3fa0;
  --text:      #d4d0e8;
  --text-dim:  #7a7690;
  --text-head: #ede8ff;
  --danger:    #e05f5f;
  --font-body: 'Georgia', serif;
  --font-ui:   'Courier New', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 18px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--text-head); }

/* ── Header ── */
header {
  display: flex;
  align-items: baseline;
  gap: 2rem;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
}

.site-name {
  font-family: var(--font-ui);
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--accent);
  letter-spacing: -0.02em;
  text-decoration: none;
}
.site-name:hover { color: var(--text-head); text-decoration: none; }

nav { display: flex; gap: 1.5rem; }
nav a {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: lowercase;
}
nav a:hover { color: var(--text); text-decoration: none; }

/* ── Main ── */
main {
  flex: 1;
  width: 100%;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.post-index {
  max-width: 720px;
}

/* ── Post index ── */
.index-title {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 2.5rem;
}

.post-listing {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.post-listing:last-child { border-bottom: none; }

.post-listing-title {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--text-head);
  grid-column: 1;
}
.post-listing-title:hover { color: var(--accent); text-decoration: none; }

.post-listing-date {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  grid-column: 2;
}

.post-listing-excerpt {
  font-size: 0.9rem;
  color: var(--text-dim);
  grid-column: 1 / -1;
  margin-top: 0.2rem;
}

.no-posts {
  font-family: var(--font-ui);
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ── Post ── */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-title {
  font-family: var(--font-body);
  font-size: 2rem;
  color: var(--text-head);
  line-height: 1.25;
  margin-bottom: 0.6rem;
}

.post-date {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.post-tags {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.post-body h1,
.post-body h2,
.post-body h3 {
  color: var(--text-head);
  font-family: var(--font-body);
  margin: 2rem 0 0.75rem;
  line-height: 1.3;
}
.post-body h2 { font-size: 1.35rem; }
.post-body h3 { font-size: 1.1rem; }

.post-body p { margin-bottom: 1.2rem; }

.post-body a { color: var(--accent); }

.post-body blockquote {
  border-left: 3px solid var(--accent-dim);
  padding-left: 1.2rem;
  margin: 1.5rem 0;
  color: var(--text-dim);
  font-style: italic;
}

.post-body code {
  font-family: var(--font-ui);
  font-size: 0.85em;
  background: var(--bg-raised);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--accent);
}

.post-body pre {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  padding: 1.2rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: 4px;
}
.post-body pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  color: var(--text);
}

.post-body ul,
.post-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.2rem;
}
.post-body li { margin-bottom: 0.3rem; }

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ── Footer ── */
footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ── Elsewhere ── */
.elsewhere-intro {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 2.5rem;
}

.elsewhere-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 1.5rem;
  align-items: baseline;
}
.elsewhere-item:last-child { border-bottom: none; }

.elsewhere-title {
  font-size: 1.05rem;
  color: var(--text-head);
  grid-column: 1;
}
.elsewhere-title:hover { color: var(--accent); text-decoration: none; }
.elsewhere-title::after { content: ' ↗'; font-size: 0.7em; color: var(--text-dim); }

.elsewhere-via {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-dim);
  grid-column: 1;
}

.elsewhere-note {
  font-size: 0.9rem;
  color: var(--text-dim);
  grid-column: 1;
  margin: 0;
}

.elsewhere-date {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  grid-column: 2;
  grid-row: 1;
}


@media (max-width: 600px) {
  main { padding: 2rem 1.2rem; }
  header { padding: 1.2rem; }
  .post-title { font-size: 1.5rem; }
  .post-listing { grid-template-columns: 1fr; }
  .post-listing-date { grid-column: 1; }
}

/* ── World ── */
body.fullwidth main { max-width: none; padding: 0; }

#game-wrap {
  width: 100%;
  height: calc(100vh - 7rem);
  position: relative;
  background: #0a0a0c;
  overflow: hidden;
}
#game-canvas { display: block; width: 100%; height: 100%; }
.game-hint {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
  padding: 0.5rem;
}
#modal {
  display: none;
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-raised);
  border: 1px solid var(--accent);
  padding: 2rem;
  min-width: 280px; max-width: 420px; width: 90%;
  z-index: 10;
}
#modal-name { color: var(--text-head); font-size: 1.3rem; font-family: var(--font-body); margin-bottom: 0.75rem; }
#modal-desc { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 1.5rem; line-height: 1.6; }
.modal-actions { display: flex; gap: 0.75rem; }
.modal-btn { font-family: var(--font-ui); font-size: 0.8rem; padding: 0.4rem 1rem; background: none; border: 1px solid var(--border); color: var(--text); cursor: pointer; }
.modal-btn:hover, .modal-btn.primary { border-color: var(--accent); color: var(--accent); }

.post-body details { margin-top: -1.2rem; }

/* ── Home layout ── */
.home-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 3rem;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 2rem;
}

.sidebar-title {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

#votd {
  border: 1px solid var(--border);
  padding: 1.25rem;
  background: var(--bg-raised);
}

#votd-text {
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text);
  font-style: italic;
  margin: 0 0 0.75rem 0;
  border: none;
  padding: 0;
}

#votd-ref {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--accent);
  display: block;
  text-align: right;
}

@media (max-width: 700px) {
  .home-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}

/* ── Forum shell ── */
body.forum-page main {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.forum-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height, 56px) - var(--footer-height, 48px));
}

.forum-shell iframe {
  flex: 1;
  width: 100%;
  border: none;
  display: block;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
