/* Self-hosted fonts (latin subset). Replaces the render-blocking Google
   Fonts request + removes the third-party dependency. Files live at
   /static/cms/fonts/, fetched from Google Fonts at build time. */
/* Cinzel is a variable font — one file covers the 500-700 range. */
@font-face {
  font-family: 'Cinzel'; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url('/static/cms/fonts/cinzel.woff2') format('woff2');
}
@font-face {
  font-family: 'Lora'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/static/cms/fonts/lora-400.woff2') format('woff2');
}

:root {
  --bg: #0a0805; --bg-card: #1a1410; --bg-alt: #14100a;
  --fg: #e8dcc4; --fg-muted: #a89880; --fg-dim: #6b5d48;
  --accent: #c89d3a; --accent-strong: #f0c14b; --accent-glow: #ffd966;
  --border: #3d2f1f; --border-bright: #6b5638;
  --danger: #8b2c2c; --success: #4a7c59;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(200,157,58,.08) 0%, transparent 60%),
    linear-gradient(180deg, #0a0805 0%, #060403 100%);
  background-attachment: fixed;
  color: var(--fg);
  font-family: Lora, Georgia, serif;
  font-size: 17px;
  line-height: 1.6;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 28px; }

a { color: var(--accent-strong); text-decoration: none; }
a:hover { color: var(--accent-glow); }

h1, h2, h3 { font-family: Cinzel, serif; letter-spacing: .04em; }

.cms-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(10,8,5,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.cms-header .wrap { display: flex; align-items: center; justify-content: space-between; padding: 14px 28px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--fg); }
.brand-mark {
  width: 36px; height: 36px;
  background: linear-gradient(180deg, var(--accent-glow), var(--accent), #8a6a26);
  color: #1a1410; border-radius: 4px;
  font-family: Cinzel, serif; font-weight: 700; font-size: 22px;
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-name { font-family: Cinzel, serif; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 18px; }
.cms-header nav { display: inline-flex; align-items: center; gap: 16px; }
.cms-header nav a { font-family: Cinzel, serif; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }

.user-pill { font-family: Cinzel, serif; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-muted); }
.admin-link { color: var(--accent-glow); }
.inline-form { display: inline; margin: 0; }
.link-btn { background: none; border: 0; color: var(--fg-muted); font-family: Cinzel, serif; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; cursor: pointer; padding: 0; }
.link-btn:hover { color: var(--accent-strong); }

.btn {
  display: inline-flex; gap: 10px; align-items: center;
  font-family: Cinzel, serif; font-weight: 700; font-size: 13px; letter-spacing: .16em; text-transform: uppercase;
  padding: 13px 26px; border-radius: 3px; border: 1px solid transparent;
  cursor: pointer; transition: all .18s;
}
.btn.primary {
  background: linear-gradient(180deg, var(--accent-strong), var(--accent), #8a6a26);
  color: #1a1410; border-color: var(--accent);
}
.btn.primary:hover { filter: brightness(1.05); transform: translateY(-1px); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--border-bright); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent-strong); text-decoration: none; }

.btn-primary { /* link variant in header */
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  color: #1a1410 !important; padding: 6px 14px; border-radius: 3px;
}

.flash { padding: 12px 0; }
.flash-ok  { background: rgba(74,124,89,.15); border-bottom: 1px solid var(--success); color: #b6d4bf; }
.flash-err { background: rgba(139,44,44,.15); border-bottom: 1px solid var(--danger); color: #e0a8a8; }
.flash-info { background: rgba(200,157,58,.1); border-bottom: 1px solid var(--accent); color: var(--accent-strong); }

.hero { padding: 88px 0; text-align: center; }
.hero .kicker { color: var(--accent); text-transform: uppercase; letter-spacing: .32em; font-size: 11px; font-family: Cinzel, serif; }
.hero h1 {
  font-size: clamp(48px, 8vw, 84px);
  text-transform: uppercase; letter-spacing: .08em;
  background: linear-gradient(180deg, var(--accent-glow), var(--accent-strong), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin: 14px 0;
}
.hero .lede { color: var(--fg); font-style: italic; max-width: 600px; margin: 0 auto 30px; }
.hero .cta { display: inline-flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

.auth-card {
  max-width: 460px; margin: 64px auto;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px;
  padding: 40px 36px; position: relative;
}
.auth-card::before { content: ''; position: absolute; inset: 5px; border: 1px solid var(--border); border-radius: 2px; pointer-events: none; opacity: .6; }
.auth-card > * { position: relative; }
.auth-card h1 { text-align: center; margin: 0 0 24px; font-size: 30px; color: var(--accent-strong); text-transform: uppercase; letter-spacing: .06em; }
.auth-form label { display: block; font-family: Cinzel, serif; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--fg-muted); margin: 14px 0 6px; }
.auth-form input {
  width: 100%;
  background: #100c08; border: 1px solid var(--border); border-radius: 3px;
  padding: 12px 14px; color: var(--fg); font-family: Lora, serif; font-size: 15px;
}
.auth-form input:focus { outline: none; border-color: var(--accent); }
.auth-form .btn { width: 100%; justify-content: center; margin-top: 22px; }
.form-error { padding: 10px 14px; background: rgba(139,44,44,.15); border: 1px solid var(--danger); border-radius: 3px; color: #e0a8a8; }
.alt-link { text-align: center; color: var(--fg-muted); margin-top: 18px; font-size: 14px; }

.admin-page h1 { font-size: 32px; color: var(--accent-strong); margin: 32px 0 6px; text-transform: uppercase; letter-spacing: .06em; }
.admin-page h2 { font-size: 18px; color: var(--accent-strong); margin: 32px 0 12px; text-transform: uppercase; letter-spacing: .08em; }
.admin-meta { color: var(--fg-muted); margin-top: 0; }
.admin-flash { padding: 12px 18px; border-radius: 3px; margin: 16px 0; }
.admin-flash-ok { background: rgba(74,124,89,.15); border: 1px solid var(--success); color: #b6d4bf; }
.admin-flash-err { background: rgba(139,44,44,.15); border: 1px solid var(--danger); color: #e0a8a8; }
.admin-search { display: inline-flex; gap: 8px; align-items: center; }
.admin-search input { background: #100c08; border: 1px solid var(--border); padding: 9px 12px; color: var(--fg); border-radius: 3px; min-width: 240px; }

.admin-table { width: 100%; border-collapse: collapse; background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.admin-table th, .admin-table td { text-align: left; padding: 12px 18px; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.admin-table th { background: var(--bg-alt); color: var(--accent-strong); font-family: Cinzel, serif; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; }
.admin-table tr:last-child td { border-bottom: 0; }
.muted { color: var(--fg-muted); }
.small { font-size: 13px; }
code { background: var(--bg-card); padding: 2px 7px; border-radius: 3px; border: 1px solid var(--border); color: var(--accent-strong); font-family: Consolas, monospace; font-size: 13px; }

.admin-form { background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; padding: 22px 24px; margin-top: 12px; }
.admin-form .row { margin-bottom: 14px; }
.admin-form .row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.admin-form label { display: block; font-family: Cinzel, serif; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: 5px; }
.admin-form input, .admin-form select {
  width: 100%; background: #100c08; border: 1px solid var(--border); border-radius: 3px;
  padding: 10px 12px; color: var(--fg); font-family: Lora, serif; font-size: 15px;
}
.admin-form input:focus, .admin-form select:focus { outline: none; border-color: var(--accent); }

.field-hint { font-family: Lora, serif; font-style: italic; color: var(--fg-muted); font-size: 13px; margin: 2px 0 12px; }
.inline-form { display: inline-block; margin: 0; }
.inline-form .btn { margin: 0; padding: 6px 12px; font-size: 11px; }

.cms-footer { border-top: 1px solid var(--border); padding: 32px 0; text-align: center; color: var(--fg-dim); font-family: Cinzel, serif; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; margin-top: 64px; }
.cms-footer a { color: var(--fg-muted); margin: 0 10px; }
.cms-footer a:hover { color: var(--accent-strong); }

/* ===== Hero (homepage) ===== */
.hero { padding: 84px 0 48px; position: relative; text-align: center; }
.hero-bg { position: absolute; inset: -40px 0 0 0; overflow: hidden; pointer-events: none; z-index: 0; }
.hero > *:not(.hero-bg) { position: relative; z-index: 1; }

.hero-glow {
  position: absolute; top: -20%; left: 50%; transform: translateX(-50%);
  width: 900px; height: 900px; max-width: 130vw;
  background: radial-gradient(circle, rgba(200,157,58,.18) 0%, rgba(200,157,58,.08) 30%, transparent 65%);
  filter: blur(8px);
  animation: heroGlow 14s ease-in-out infinite alternate;
}
@keyframes heroGlow {
  0%   { opacity: .65; transform: translateX(-50%) scale(1); }
  100% { opacity: 1;   transform: translateX(-50%) scale(1.08); }
}
.hero-rune {
  position: absolute; top: 50%; left: 50%;
  width: 520px; height: 520px; max-width: 90vw; max-height: 90vw;
  transform: translate(-50%, -50%);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200' fill='none' stroke='%23c89d3a' stroke-width='0.4' opacity='0.5'><circle cx='100' cy='100' r='98'/><circle cx='100' cy='100' r='80'/><circle cx='100' cy='100' r='60'/><circle cx='100' cy='100' r='40'/><line x1='100' y1='0' x2='100' y2='200'/><line x1='0' y1='100' x2='200' y2='100'/><line x1='29' y1='29' x2='171' y2='171'/><line x1='171' y1='29' x2='29' y2='171'/></svg>");
  background-repeat: no-repeat;
  background-size: contain;
  opacity: .12;
  animation: runeSpin 90s linear infinite;
}
@keyframes runeSpin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.hero-title {
  font-family: Cinzel, serif;
  font-size: clamp(56px, 9vw, 96px);
  letter-spacing: .04em;
  margin: 6px 0 14px;
  background: linear-gradient(180deg, #ffd966 0%, #c89d3a 55%, #8a6a26 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(200,157,58,.25);
}
.hero .kicker { margin-bottom: 0; }
.hero .lede { max-width: 640px; margin: 0 auto 24px; font-size: 18px; font-style: italic; }
.hero .lede strong { color: var(--accent-strong); font-style: normal; }

/* ===== Wishing Bough (sparkle tree) ===== */
.wishing-tree {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(260px, 38vw, 460px);
  aspect-ratio: 3 / 4;
  pointer-events: none;
  z-index: 0;
  opacity: .85;
}
.tree-svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  filter: drop-shadow(0 0 18px rgba(255, 217, 102, .18));
}

.sparkles {
  position: absolute; inset: 0; pointer-events: none;
}
.spark {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation-name: sparkRise;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
  opacity: 0;
  transform: translate(-50%, -50%);
}
.spark-gold { background: #ffd966; box-shadow: 0 0 6px 1px rgba(255,217,102,.7), 0 0 14px 3px rgba(255,193,80,.35); }
.spark-pale { background: #fff7da; box-shadow: 0 0 5px 1px rgba(255,247,218,.7), 0 0 12px 3px rgba(255,247,218,.32); }

@keyframes sparkRise {
  0%   { opacity: 0;   transform: translate(-50%, -50%) translateY(0) scale(.6); }
  20%  { opacity: 1;   transform: translate(-50%, -50%) translateY(-6px) scale(1); }
  60%  { opacity: .85; transform: translate(-50%, -50%) translateY(-28px) scale(1.08); }
  100% { opacity: 0;   transform: translate(-50%, -50%) translateY(-56px) scale(.4); }
}

/* Server status pill */
.status-pill {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-family: Cinzel, serif; font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 30px;
  transition: border-color .3s, color .3s;
}
.status-pill .status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #8a7c68;
  box-shadow: 0 0 0 3px rgba(138,124,104,.18);
}
.status-pill[data-state="online"]  { border-color: rgba(74,124,89,.6); color: #a4d3b1; }
.status-pill[data-state="online"]  .status-dot { background: #4a7c59; box-shadow: 0 0 0 3px rgba(74,124,89,.25); animation: pulseOnline 2.2s ease-in-out infinite; }
.status-pill[data-state="offline"] { border-color: rgba(139,44,44,.6); color: #e0a8a8; }
.status-pill[data-state="offline"] .status-dot { background: #8b2c2c; box-shadow: 0 0 0 3px rgba(139,44,44,.25); }
.status-pill[data-state="unknown"] { border-color: rgba(200,157,58,.6); color: #d8b56a; }
.status-pill[data-state="unknown"] .status-dot { background: #c89d3a; box-shadow: 0 0 0 3px rgba(200,157,58,.25); animation: pulseSlow 2.4s ease-in-out infinite; }
.status-pill[data-state="checking"] .status-dot { animation: pulseSlow 1.6s ease-in-out infinite; }
@keyframes pulseOnline {
  0%, 100% { box-shadow: 0 0 0 3px rgba(74,124,89,.25); }
  50%      { box-shadow: 0 0 0 7px rgba(74,124,89,.08); }
}
@keyframes pulseSlow {
  0%, 100% { opacity: .55; } 50% { opacity: 1; }
}

/* ===== Splash CTAs (homepage) ===== */
.hero-tight { padding: 64px 0 36px; }

.splash-cta { display: grid; gap: 18px; grid-template-columns: 1fr; max-width: 880px; margin: 24px auto 0; text-align: left; }
.splash-cta-2 { max-width: 640px; }
.splash-cta-2 { grid-template-columns: 1fr; }
@media (min-width: 640px) { .splash-cta-2 { grid-template-columns: 1fr 1fr; } }

.hero-note {
  text-align: center;
  font-family: Lora, serif;
  font-style: italic;
  font-size: 13.5px;
  color: var(--fg-dim);
  margin: 22px auto 0;
  max-width: 460px;
  opacity: .85;
}
@media (min-width: 720px) { .splash-cta { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .splash-cta { grid-template-columns: repeat(3, 1fr); } }

.splash-btn {
  display: flex; flex-direction: column; gap: 6px;
  padding: 26px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  position: relative;
  transition: all .2s;
}
.splash-btn::before { content: ''; position: absolute; inset: 5px; border: 1px solid var(--border); border-radius: 2px; pointer-events: none; opacity: .6; }
.splash-btn > * { position: relative; }
.splash-btn:hover { transform: translateY(-4px); border-color: var(--border-bright); text-decoration: none; box-shadow: 0 18px 36px -16px rgba(200,157,58,.35); }
.splash-btn:hover .splash-icon { transform: scale(1.08); color: var(--accent-glow); }
.splash-icon { transition: transform .25s ease, color .25s ease; }

.splash-icon { font-family: Cinzel, serif; font-size: 26px; color: var(--accent-strong); line-height: 1; }
.splash-label { font-family: Cinzel, serif; font-weight: 700; font-size: 17px; letter-spacing: .08em; text-transform: uppercase; color: var(--fg); }
.splash-sub { font-family: Lora, serif; color: var(--fg-muted); font-size: 14px; font-style: italic; }

.splash-btn.primary { background: linear-gradient(180deg, rgba(200,157,58,.12) 0%, var(--bg-card) 60%); border-color: var(--accent); }
.splash-btn.primary .splash-icon { color: var(--accent-glow); filter: drop-shadow(0 0 8px rgba(200,157,58,.4)); }
.splash-btn.primary-alt { border-color: var(--border-bright); }
.splash-btn.primary-alt .splash-icon { color: var(--accent-strong); }

/* ===== Section headers (shared) ===== */
.section-header { text-align: center; margin: 48px auto 28px; max-width: 720px; }
.section-header h2 { font-size: 28px; color: var(--accent-strong); text-transform: uppercase; letter-spacing: .08em; margin-top: 6px; font-family: Cinzel, serif; }
.section-header::after {
  content: ''; display: block; width: 80px; height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
  margin: 14px auto 0;
}

/* ===== News section ===== */
.news-section { max-width: 800px; margin: 12px auto 12px; }
.news-header { text-align: center; margin-bottom: 24px; }
.news-header h2 { font-size: 24px; color: var(--accent-strong); text-transform: uppercase; letter-spacing: .08em; margin-top: 6px; }
.news-list { list-style: none; padding: 0; margin: 0; }
.news-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; padding: 18px 22px; margin-bottom: 14px; position: relative; }
.news-meta { font-family: Cinzel, serif; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--fg-muted); margin: 0 0 6px; }
.news-item h3 { font-size: 18px; letter-spacing: .04em; color: var(--fg); margin: 0 0 6px; text-transform: none; }
.news-excerpt { color: var(--fg-muted); margin: 0; font-size: 14.5px; }
.news-item { transition: border-color .2s, transform .2s; }
.news-item:hover { border-color: var(--border-bright); transform: translateX(2px); }
.news-item h3 a { color: var(--fg); text-decoration: none; }
.news-item h3 a:hover { color: var(--accent-strong); text-decoration: none; }
.news-readmore { margin: 8px 0 0; font-family: Cinzel, serif; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.news-readmore a { color: var(--accent-strong); }
.news-feed-link { text-align: center; margin: 18px 0 0; }
.news-feed-link a { color: var(--accent-strong); font-family: Cinzel, serif; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }

/* ===== News index (/news) ===== */
.news-index { max-width: 800px; margin: 32px auto 64px; }
.news-list-wide .news-item { padding: 22px 26px; }
.news-pager { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 24px 0 0; }
.news-pager-label { font-family: Cinzel, serif; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-muted); flex: 1; text-align: center; }
.news-empty { text-align: center; padding: 48px 16px; font-style: italic; }

/* ===== Single news post (/news/{slug}) ===== */
.news-single { max-width: 760px; margin: 32px auto 48px; }
.news-single-head { text-align: center; margin-bottom: 32px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.news-single-head h1 { font-family: Cinzel, serif; font-size: clamp(28px, 4vw, 40px); letter-spacing: .04em; color: var(--accent-strong); margin: 8px 0 14px; }
.news-single-head .news-meta a { color: var(--fg-muted); }
.news-single-head .news-meta a:hover { color: var(--accent-strong); }
.news-single-excerpt { font-family: Lora, serif; font-style: italic; color: var(--fg-muted); font-size: 17px; line-height: 1.65; max-width: 600px; margin: 0 auto; }
.news-single-body { background: transparent; border: 0; padding: 0; }
.news-single-body p { font-size: 16.5px; line-height: 1.8; }

.news-single-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); }
.news-single-nav > span { display: block; }
.news-single-nav a { display: flex; flex-direction: column; gap: 4px; padding: 14px 18px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 3px; transition: all .2s; text-decoration: none; }
.news-single-nav a:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.news-nav-dir { font-family: Cinzel, serif; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-muted); }
.news-nav-title { font-family: Cinzel, serif; font-size: 14px; color: var(--fg); }
.news-nav-prev .news-nav-dir { text-align: left; } .news-nav-prev .news-nav-title { text-align: left; }
.news-nav-next .news-nav-dir { text-align: right; } .news-nav-next .news-nav-title { text-align: right; }

/* ===== 404 ===== */
.error-page { text-align: center; padding: 72px 16px; max-width: 600px; margin: 0 auto; }
.error-page .kicker { font-family: Cinzel, serif; font-size: 56px; color: var(--accent-strong); letter-spacing: .08em; margin-bottom: 0; opacity: .8; }
.error-page h1 { font-family: Cinzel, serif; font-size: 28px; letter-spacing: .06em; color: var(--fg); margin: 8px 0 18px; }

/* ===== Nav link ===== */
.nav-link { font-family: Cinzel, serif; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; margin-right: 14px; color: var(--fg-muted); }
.nav-link:hover { color: var(--accent-strong); }

/* ===== Teleport admin ===== */
.tele-cat { margin: 30px 0; }
.tele-cat-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 4px; }
.tele-cat-head h2 { font-family: Cinzel, serif; font-size: 18px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-strong); margin: 0; }
.tele-cat-glyph { font-family: Cinzel, serif; font-size: 22px; color: var(--accent); padding-right: 4px; }
.tele-table th, .tele-table td { vertical-align: top; }
.tele-flavor { color: var(--fg-muted); font-style: italic; max-width: 320px; font-size: 13px; }
.tele-dest-icon { display: inline-flex; vertical-align: -.2em; margin-right: 6px; color: var(--accent-strong); }
.tele-foot { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--border); font-style: italic; }
.badge-dyn { background: rgba(121,199,255,.12); color: #79c7ff; border: 1px solid rgba(121,199,255,.35); padding: 2px 8px; border-radius: 3px; font-family: Cinzel, serif; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }

.tele-form select { background: #100c08; border: 1px solid var(--border); border-radius: 3px; padding: 10px 12px; color: var(--fg); font-family: Lora, serif; font-size: 15px; width: 100%; }
.tele-form select:focus { outline: none; border-color: var(--accent); }
.tele-form textarea { width: 100%; background: #100c08; border: 1px solid var(--border); border-radius: 3px; padding: 10px 12px; color: var(--fg); font-family: Lora, serif; font-size: 14.5px; resize: vertical; }
.checkbox-row { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.checkbox-row input { margin: 0; }
.checkbox-row span { font-family: Lora, serif; font-style: italic; color: var(--fg); font-size: 14px; }

/* ===== Features grid ===== */
.features { max-width: 1100px; margin: 36px auto 64px; padding: 0 12px; }
.feature-grid {
  display: grid; gap: 22px;
  grid-template-columns: 1fr;
}
@media (min-width: 760px) { .feature-grid { grid-template-columns: repeat(3, 1fr); } }

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 26px 24px 24px;
  text-align: center;
  position: relative;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.feature-card::before { content: ''; position: absolute; inset: 5px; border: 1px solid var(--border); border-radius: 2px; pointer-events: none; opacity: .55; }
.feature-card:hover { transform: translateY(-3px); border-color: var(--border-bright); box-shadow: 0 14px 28px -16px rgba(200,157,58,.3); }
.feature-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  font-family: Cinzel, serif; font-size: 30px; font-weight: 700;
  color: var(--accent-strong);
  border: 1px solid var(--border);
  border-radius: 50%;
  margin-bottom: 14px;
  background: radial-gradient(circle, rgba(200,157,58,.18) 0%, transparent 70%);
}
.feature-mark-blade { color: #d8b56a; }
.feature-mark-wisp  { color: #79c7ff; }
.feature-mark-coin  { color: #ffd966; }
.feature-mark-bough { color: #ffe28a; text-shadow: 0 0 14px rgba(255,217,102,.5); }
.feature-mark-bough { animation: boughPulse 4s ease-in-out infinite alternate; }
@keyframes boughPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,217,102,.0); }
  100% { box-shadow: 0 0 22px 4px rgba(255,217,102,.18); }
}

/* ===== Brevison icons (SVG sprite) ===== */
/* The sprite is included once in base.html. Each icon is a <symbol> there.
   Default style: line-art (no fill, currentColor stroke). The workflow's
   design system picks the stroke weight + linecap/linejoin globally on the
   sprite — we just add color/sizing rules here. */
.bri-icon {
  display: inline-block;
  vertical-align: -0.15em;       /* align with mid-cap baseline next to text */
  fill: none;
  stroke: currentColor;
  flex-shrink: 0;
  line-height: 0;
  transition: color .25s ease, transform .25s ease;
}
/* When the icon is a filled symbol, the symbol itself sets fill="currentColor"
   on its inner shapes — our default fill:none on the host won't override that
   because the symbol's children carry their own attributes. */

/* Hero / feature tints */
.feature-mark .bri-icon { width: 32px; height: 32px; }
.portal-tile-glyph .bri-icon { width: 28px; height: 28px; }
.portal-tab-glyph  .bri-icon { width: 22px; height: 22px; }
.portal-detail-glyph .bri-icon { width: 56px; height: 56px; }
.tele-cat-glyph .bri-icon { width: 22px; height: 22px; vertical-align: -0.2em; }

/* ===== The Realm Portal ===== */
.portal-section { max-width: 880px; margin: 24px auto 60px; text-align: center; padding: 0 16px; }
.portal-blurb { font-family: Lora, serif; font-style: italic; color: var(--fg-muted); font-size: 15px; margin: 24px auto 0; max-width: 480px; line-height: 1.65; }

/* The clickable stone */
.portal-stone {
  position: relative;
  width: 200px; height: 200px;
  margin: 12px auto 0;
  border: 0; background: transparent;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  isolation: isolate;
}
.portal-stone:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 50%; }
.portal-ring {
  position: absolute; left: 50%; top: 50%;
  border-radius: 50%;
  border: 1px solid var(--accent);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.portal-ring-outer { width: 200px; height: 200px; border-color: rgba(200,157,58,.6); animation: ringSpin 16s linear infinite; }
.portal-ring-mid   { width: 150px; height: 150px; border-color: rgba(255,217,102,.45); animation: ringSpin 11s linear infinite reverse; border-style: dashed; }
.portal-ring-inner { width: 100px; height: 100px; border-color: rgba(255,217,102,.7); animation: ringSpin 8s linear infinite; }
@keyframes ringSpin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.portal-core {
  position: absolute; left: 50%; top: 50%;
  width: 60px; height: 60px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, #fff7da 0%, #ffd966 30%, #c89d3a 70%, transparent 100%);
  box-shadow:
    0 0 20px 8px rgba(255,217,102,.5),
    0 0 50px 18px rgba(200,157,58,.3);
  animation: corePulse 3s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes corePulse {
  0%   { transform: translate(-50%, -50%) scale(.92); opacity: .9; }
  100% { transform: translate(-50%, -50%) scale(1.06); opacity: 1; }
}
.portal-label {
  position: absolute; bottom: -36px; left: 50%; transform: translateX(-50%);
  font-family: Cinzel, serif; font-size: 12px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent-strong);
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(200,157,58,.4);
}
.portal-stone:hover .portal-core { box-shadow: 0 0 32px 14px rgba(255,217,102,.65), 0 0 80px 28px rgba(200,157,58,.45); }
.portal-stone:hover .portal-ring-outer { border-color: rgba(255,217,102,.85); }

/* Modal */
.portal-modal {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; transition: opacity .25s ease;
}
/* The hidden attribute must win over display:flex above, or the invisible
   (opacity:0) backdrop sits over the whole page and eats every click. */
.portal-modal[hidden] { display: none; }
.portal-modal.is-open { opacity: 1; }
.portal-backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 5, 3, .82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
}
.portal-frame {
  position: relative;
  background: linear-gradient(180deg, #1a130b 0%, #110c08 100%);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 28px 32px 32px;
  width: 100%; max-width: 980px; max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.55), 0 0 60px rgba(200,157,58,.25), inset 0 0 0 4px #0e0a06, inset 0 0 0 5px rgba(200,157,58,.35);
  transform: translateY(20px) scale(.97);
  transition: transform .3s ease;
}
.portal-modal.is-open .portal-frame { transform: translateY(0) scale(1); }
body.portal-locked { overflow: hidden; }

.portal-frame-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.portal-frame-head h2 {
  font-family: Cinzel, serif; font-size: 22px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-strong); margin: 0;
}
.portal-close {
  background: transparent; border: 1px solid var(--border); color: var(--fg-muted);
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 22px; line-height: 1; cursor: pointer;
  transition: all .2s;
}
.portal-close:hover { color: var(--accent-glow); border-color: var(--accent); transform: rotate(90deg); }

/* Tabs */
.portal-tabs {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px; margin-bottom: 14px;
}
.portal-tabs.is-dim { opacity: .4; pointer-events: none; }
.portal-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-muted);
  padding: 10px 12px;
  border-radius: 3px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: all .2s;
}
.portal-tab:hover { color: var(--fg); border-color: var(--border); background: rgba(200,157,58,.06); }
.portal-tab.is-active { color: var(--accent-strong); border-color: var(--accent); background: rgba(200,157,58,.1); box-shadow: 0 0 16px rgba(200,157,58,.15) inset; }
.portal-tab-glyph { font-family: Cinzel, serif; font-size: 20px; color: var(--accent-strong); }
.portal-tab-label { font-family: Cinzel, serif; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; }

.portal-blurb-inline {
  font-family: Lora, serif; font-style: italic; color: var(--fg-muted);
  font-size: 13.5px; text-align: center; margin: 0 0 16px;
}

/* Grid */
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  overflow-y: auto;
  padding: 4px 4px 12px;
  scrollbar-color: var(--accent) #100c08;
}
.portal-grid::-webkit-scrollbar { width: 8px; }
.portal-grid::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }
.portal-grid::-webkit-scrollbar-track { background: #100c08; }

.portal-tile {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 18px 12px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
  cursor: pointer;
  color: var(--fg);
  transition: all .22s ease;
  min-height: 120px;
  overflow: hidden;
}
.portal-tile::before {
  content: ''; position: absolute; inset: 4px;
  border: 1px solid var(--border); border-radius: 2px;
  pointer-events: none; opacity: .5;
  transition: opacity .22s, border-color .22s;
}
.portal-tile::after {
  content: ''; position: absolute;
  top: -50%; left: -100%; width: 60%; height: 200%;
  background: linear-gradient(115deg, transparent 0%, rgba(255,217,102,.22) 50%, transparent 100%);
  transform: skewX(-20deg);
  transition: left .6s ease;
  pointer-events: none;
}
.portal-tile:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 10px 24px -10px rgba(200,157,58,.45);
}
.portal-tile:hover::before { opacity: 1; border-color: var(--accent); }
.portal-tile:hover::after  { left: 130%; }
.portal-tile-glyph {
  font-family: Cinzel, serif; font-size: 26px; color: var(--accent-strong);
  text-shadow: 0 0 12px rgba(200,157,58,.4);
}
.portal-tile-name { font-family: Cinzel, serif; font-size: 13px; letter-spacing: .04em; line-height: 1.3; color: var(--fg); margin-top: 2px; }
.portal-tile-req { font-family: Cinzel, serif; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-muted); }
.portal-tile-dyn { font-family: Lora, serif; font-style: italic; font-size: 11px; color: #79c7ff; }
.portal-tile.is-dynamic .portal-tile-glyph { color: #79c7ff; text-shadow: 0 0 10px rgba(121,199,255,.4); }
.portal-tile.is-dynamic { border-color: rgba(121,199,255,.35); }

.portal-loading { text-align: center; color: var(--fg-muted); font-family: Lora, serif; font-style: italic; padding: 32px; grid-column: 1 / -1; }

/* Detail view */
.portal-detail { overflow-y: auto; padding: 4px 4px 12px; }
.portal-detail-back {
  background: transparent; border: 0; color: var(--accent-strong);
  font-family: Cinzel, serif; font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  cursor: pointer; padding: 6px 0 18px;
}
.portal-detail-back:hover { color: var(--accent-glow); }
.portal-detail-inner {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px;
  padding: 32px 36px; text-align: center; position: relative;
}
.portal-detail-inner::before { content: ''; position: absolute; inset: 5px; border: 1px solid var(--border); border-radius: 2px; pointer-events: none; opacity: .55; }
.portal-detail-glyph { font-family: Cinzel, serif; font-size: 54px; color: var(--accent-strong); text-shadow: 0 0 24px rgba(200,157,58,.5); margin-bottom: 6px; }
.portal-detail-inner h3 { font-family: Cinzel, serif; font-size: 22px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-strong); margin: 0 0 12px; }
.portal-detail-flavor { font-family: Lora, serif; font-style: italic; color: var(--fg-muted); font-size: 15px; line-height: 1.7; max-width: 500px; margin: 0 auto 22px; }
.portal-detail-meta {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 16px;
  max-width: 380px; margin: 0 auto 24px;
  text-align: left;
}
.portal-detail-meta dt { font-family: Cinzel, serif; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-muted); }
.portal-detail-meta dd { margin: 0; color: var(--fg); font-size: 14px; }
.portal-detail-action {
  background: linear-gradient(180deg, #c89d3a 0%, #8a6a26 100%);
  color: #1a1410; border: 1px solid var(--accent);
  font-family: Cinzel, serif; font-weight: 700; font-size: 12px;
  letter-spacing: .12em; text-transform: uppercase;
  padding: 12px 24px; border-radius: 3px; cursor: pointer;
}
.portal-detail-action:disabled { opacity: .55; cursor: not-allowed; background: var(--bg-card); color: var(--fg-muted); }
.portal-detail-note { font-family: Lora, serif; font-style: italic; color: var(--fg-dim); font-size: 12px; margin: 14px 0 0; }

/* ===== Realm Tokens card ===== */
.token-card { background: linear-gradient(180deg, rgba(200,157,58,.10) 0%, var(--bg-card) 70%); position: relative; }
.token-card h2 { color: #ffe28a; text-shadow: 0 0 12px rgba(255,217,102,.3); }
.token-balance {
  display: flex; align-items: baseline; gap: 10px;
  margin: 8px 0 18px;
  padding: 14px 18px;
  background: rgba(15,11,8,.55);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.token-balance-num {
  font-family: Cinzel, serif; font-size: 36px; font-weight: 700;
  background: linear-gradient(180deg, #fff7da 0%, #ffd966 60%, #c89d3a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: .02em;
}
.token-balance-label {
  font-family: Cinzel, serif; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--fg-muted);
}
.feature-card h3 { font-family: Cinzel, serif; font-size: 18px; letter-spacing: .08em; text-transform: uppercase; color: var(--fg); margin: 0 0 10px; }
.feature-card p  { color: var(--fg-muted); margin: 0; line-height: 1.65; font-size: 14.5px; }

/* ===== Account ===== */
.account-page h1 { font-size: 32px; color: var(--accent-strong); margin: 32px 0 6px; text-transform: uppercase; letter-spacing: .06em; }
.account-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; padding: 24px 26px; margin: 18px 0; position: relative; }
.account-card::before { content: ''; position: absolute; inset: 5px; border: 1px solid var(--border); border-radius: 2px; pointer-events: none; opacity: .6; }
.account-card > * { position: relative; }
.account-card h2 { font-size: 16px; color: var(--accent-strong); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 12px; }
.account-fields { display: grid; grid-template-columns: 180px 1fr; gap: 8px 18px; margin: 8px 0 18px; }
.account-fields dt { font-family: Cinzel, serif; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-muted); }
.account-fields dd { margin: 0; color: var(--fg); font-size: 15px; }
.account-form label { display: block; font-family: Cinzel, serif; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--fg-muted); margin: 14px 0 5px; }
.account-form input {
  width: 100%; background: #100c08; border: 1px solid var(--border); border-radius: 3px;
  padding: 10px 12px; color: var(--fg); font-family: Lora, serif; font-size: 15px;
}
.account-form input:focus { outline: none; border-color: var(--accent); }
.account-form .btn { margin-top: 14px; }
.logout-row { margin-top: 24px; display: flex; justify-content: flex-end; }

/* ===== Posts ===== */
.badge { padding: 3px 9px; border-radius: 3px; font-family: Cinzel, serif; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; }
.badge-ok { background: rgba(74,124,89,.2); color: #a4d3b1; border: 1px solid var(--success); }
.badge-draft { background: var(--bg-alt); color: var(--fg-muted); border: 1px solid var(--border); }

.post-editor textarea {
  width: 100%; min-height: 320px;
  background: #100c08; border: 1px solid var(--border); border-radius: 3px;
  padding: 12px 14px; color: var(--fg);
  font-family: 'IM Fell DW Pica', 'Consolas', monospace; font-size: 14.5px;
}
.post-editor textarea:focus { outline: none; border-color: var(--accent); }
.post-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.btn.danger { background: rgba(139,44,44,.2); color: #e0a8a8; border-color: var(--danger); }
.btn.danger:hover { background: rgba(139,44,44,.35); text-decoration: none; }

.post-preview { margin-top: 36px; }
.post-preview h2 { font-size: 18px; color: var(--accent-strong); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 12px; }
.post-rendered { background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; padding: 22px 26px; }
.post-rendered h1, .post-rendered h2, .post-rendered h3 { color: var(--accent-strong); text-transform: none; letter-spacing: .02em; }
.post-rendered p { color: var(--fg); margin-bottom: 14px; }
.post-rendered code { background: #100c08; padding: 2px 7px; border-radius: 3px; border: 1px solid var(--border); color: var(--accent-strong); }
.post-rendered pre { background: #100c08; padding: 16px; border-radius: 4px; border: 1px solid var(--border); overflow-x: auto; }
.post-rendered pre code { background: none; border: 0; padding: 0; }
.post-rendered ul, .post-rendered ol { color: var(--fg); padding-left: 24px; }
.post-rendered blockquote { border-left: 3px solid var(--accent); padding-left: 16px; color: var(--fg-muted); font-style: italic; }
.post-rendered a { color: var(--accent-glow); }
.post-rendered table { border-collapse: collapse; margin: 12px 0; }
.post-rendered th, .post-rendered td { border: 1px solid var(--border); padding: 6px 12px; }
.post-rendered th { background: var(--bg-alt); color: var(--accent-strong); }
