/*
  Goblin 4X — Shared Theme
  All design tokens, base styles, and reusable components live here.
  To add a new page: create an HTML file, link this CSS and js/core.js.
*/

/* ==================== DESIGN TOKENS ==================== */
:root {
  --bg0:    #14110d;
  --bg1:    #1f1a14;
  --panel:  #2a221a;
  --panel2: #221c16;
  --wood:   #5b3f24;
  --wood2:  #7a5531;
  --moss:   #3f6b45;
  --moss2:  #7aa36a;
  --metal:  #4b5450;
  --metal2: #9aa39c;
  --ink:    #e7decf;
  --muted:  #c6b9a3;
  --danger: #b65444;
  --warn:   #b58a3a;
  --ok:     #6ea86b;
  --line:   rgba(231, 222, 207, .10);
  --line2:  rgba(231, 222, 207, .16);
  --shadow: 0 8px 18px rgba(0,0,0,.35);
  --radius:  14px;
  --radius2: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --ui:   ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  --nav-h: 62px;
}

/* ==================== RESET & BASE ==================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--ui);
  background:
    radial-gradient(1200px 600px at 50% -40%, rgba(122,163,106,.18), transparent 55%),
    radial-gradient(900px 500px at 10% 20%,   rgba(154,163,156,.10), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  background-attachment: fixed;
  color: var(--ink);
  /* leave room for sticky global nav */
  padding-bottom: calc(var(--nav-h) + 8px);
}
button { cursor: pointer; font-family: var(--ui); }
a { color: inherit; }

/* ==================== APP WRAPPER ==================== */
.app {
  max-width: 540px;
  margin: 0 auto;
  padding: 12px 12px 18px;
}

/* ==================== TOPBAR ==================== */
.topbar {
  background: linear-gradient(180deg, rgba(122,85,49,.20), rgba(0,0,0,0));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 12px;
}
.row          { display: flex; gap: 10px; align-items: center; }
.row.between  { justify-content: space-between; }
.title        { display: flex; align-items: baseline; gap: 10px; }
.title h1     { margin: 0; font-size: 18px; letter-spacing: .4px; }
.subtitle     { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.chips        { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: rgba(43,47,44,.22);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.chip b    { color: var(--ink); font-weight: 600; }
.chip .ico {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border-radius: 6px;
  background: rgba(63,107,69,.18);
  border: 1px solid rgba(122,163,106,.20);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--moss2);
}

/* ==================== PAGE HEADER (subpages) ==================== */
.page-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(122,85,49,.15), rgba(0,0,0,0));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.back-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid var(--line2);
  border-radius: var(--radius2);
  background: rgba(43,47,44,.35);
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: color .15s;
}
.back-btn:hover { color: var(--ink); }
.page-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .3px;
  flex: 1;
}
.page-subtitle {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ==================== FLAVOR STRIP ==================== */
.flavor {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(47,74,50,.18), rgba(0,0,0,0));
}
.flavor .quote {
  font-style: italic;
  color: var(--muted);
  line-height: 1.35;
  font-size: 13px;
}
.flavor .note {
  margin-top: 8px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(231,222,207,.85);
}
.badge {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: rgba(90,63,36,.22);
  color: var(--muted);
}

/* ==================== PANEL ==================== */
.content { margin-top: 12px; display: grid; gap: 12px; }
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(154,163,156,.06), rgba(0,0,0,0)),
    rgba(42,34,26,.86);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.phead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(31,26,20,.55);
}
.phead h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: rgba(231,222,207,.95);
}
.phead .right {
  display: flex; gap: 8px; align-items: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.pbody { padding: 12px; }

/* ==================== TYPOGRAPHY HELPERS ==================== */
.muted  { color: var(--muted); }
.small  { font-size: 12px; }
.mono   { font-family: var(--mono); }
.kicker { font-size: 12px; color: rgba(231,222,207,.82); line-height: 1.35; }

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(122,85,49,.25), rgba(43,47,44,.18));
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .3px;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn.secondary {
  background: rgba(43,47,44,.18);
  color: var(--muted);
}
.btn.primary {
  border-color: rgba(122,163,106,.35);
  background: linear-gradient(180deg, rgba(63,107,69,.35), rgba(42,34,26,.78));
}
.btn.danger {
  border-color: rgba(182,84,68,.35);
  background: linear-gradient(180deg, rgba(182,84,68,.18), rgba(43,47,44,.14));
}
.btn:disabled {
  opacity: .45;
  cursor: default;
}

/* ==================== FORM CONTROLS ==================== */
.controls { display: flex; gap: 10px; align-items: center; }
.input {
  flex: 1;
  border: 1px solid var(--line);
  background: rgba(20,17,13,.55);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 12px;
  outline: none;
  font-size: 13px;
  font-family: var(--ui);
}
.input::placeholder { color: var(--muted); opacity: .7; }
.input:focus { border-color: var(--line2); }

/* ==================== TABLE ==================== */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 8px; vertical-align: top; }
th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: rgba(231,222,207,.75);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
}
tr + tr td { border-top: 1px solid var(--line); }
.rightAlign { text-align: right; }

/* ==================== ICON ==================== */
.icon {
  width: 28px; height: 28px;
  border-radius: 10px;
  border: 1px solid rgba(231,222,207,.14);
  background:
    radial-gradient(16px 14px at 30% 30%, rgba(122,163,106,.25), rgba(0,0,0,0)),
    rgba(43,47,44,.25);
  display: grid; place-items: center;
  font-family: var(--mono);
  color: var(--moss2);
  flex: 0 0 auto;
  font-size: 14px;
}
.icon.lg {
  width: 40px; height: 40px;
  border-radius: 12px;
  font-size: 20px;
}

/* ==================== ITEM ROW ==================== */
.itemRow    { display: flex; gap: 10px; align-items: flex-start; }
.itemTitle  { font-weight: 700; }

/* ==================== TAGS ==================== */
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(31,26,20,.55);
  color: rgba(231,222,207,.78);
  font-family: var(--mono);
}
.tag.ok   { border-color: rgba(110,168,107,.35); color: rgba(167,224,165,.9); }
.tag.warn { border-color: rgba(181,138,58,.35);  color: rgba(240,204,140,.9); }
.tag.bad  { border-color: rgba(182,84,68,.35);   color: rgba(255,182,170,.9); }

/* ==================== PROGRESS BAR ==================== */
.progress {
  margin-top: 8px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(20,17,13,.55);
  overflow: hidden;
}
.bar {
  height: 100%;
  background: linear-gradient(90deg, rgba(63,107,69,.35), rgba(122,163,106,.55));
}

/* ==================== CARD LIST ==================== */
.list { display: grid; gap: 10px; }
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius2);
  background: rgba(31,26,20,.35);
  padding: 10px;
}
.cardTop     { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.cardTitle   { display: flex; gap: 10px; align-items: flex-start; }
.cardTitle .name { font-weight: 800; }
.cardTitle .desc { margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.35; }
.cardActions {
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  min-width: 80px;
}
.timer {
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(231,222,207,.9);
  text-align: right;
}

/* ==================== SECTION LABEL ==================== */
.section-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: rgba(231,222,207,.45);
  margin: 14px 2px 6px;
}

/* ==================== NAV GRID (hub pages) ==================== */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}
.nav-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 14px 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(42,34,26,.86);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--muted);
  text-align: center;
  transition: border-color .15s, background .15s, color .15s;
}
.nav-tile:hover,
.nav-tile:active {
  border-color: rgba(122,163,106,.35);
  background: linear-gradient(180deg, rgba(63,107,69,.18), rgba(42,34,26,.78));
  color: var(--ink);
}
.nav-tile .tile-icon { font-size: 22px; line-height: 1; }
.nav-tile .tile-name { font-weight: 700; font-size: 12px; color: var(--ink); }
.nav-tile .tile-desc { font-size: 10px; line-height: 1.3; font-family: var(--mono); }
.nav-tile .tile-stat {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: rgba(43,47,44,.35);
  color: var(--muted);
}

/* ==================== HOMEPAGE HUB TILES ==================== */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 8px;
}
.hub-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(42,34,26,.86);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s, background .15s;
}
.hub-tile:hover { border-color: rgba(122,163,106,.35); }
.hub-tile.locked {
  opacity: .45;
  pointer-events: none;
}
.hub-tile .tile-ico  { font-size: 26px; flex: 0 0 auto; }
.hub-tile .tile-body .tile-name { font-weight: 800; font-size: 14px; }
.hub-tile .tile-body .tile-desc { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.hub-tile .tile-badge {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: rgba(63,107,69,.18);
  color: var(--moss2);
  white-space: nowrap;
  flex: 0 0 auto;
}
.hub-tile.locked .tile-badge {
  background: rgba(43,47,44,.35);
  color: var(--muted);
  border-color: var(--line);
}

/* ==================== HERO (homepage) ==================== */
.hero {
  text-align: center;
  padding: 24px 16px 18px;
  background: linear-gradient(180deg, rgba(63,107,69,.12), rgba(0,0,0,0));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero .game-icon { font-size: 48px; line-height: 1; display: block; }
.hero h1 { margin: 8px 0 4px; font-size: 26px; letter-spacing: 1.5px; text-transform: uppercase; }
.hero .tagline { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ==================== LOGIN BLOCK ==================== */
.login-block {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(42,34,26,.86);
  box-shadow: var(--shadow);
}
.login-block h3 {
  margin: 0 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
}

/* ==================== PLAYER CARD ==================== */
.player-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(42,34,26,.86);
  box-shadow: var(--shadow);
  margin-top: 10px;
}
.avatar {
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line2);
  background: radial-gradient(circle at 35% 35%, rgba(122,163,106,.3), rgba(42,34,26,.8));
  display: grid; place-items: center;
  font-size: 22px;
  flex: 0 0 auto;
}
.player-info .player-name  { font-weight: 800; font-size: 15px; }
.player-info .player-title { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.player-stats {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

/* ==================== QUICKBAR (in-page sticky) ==================== */
.quickbar {
  position: sticky;
  bottom: calc(var(--nav-h) + 8px);
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(231,222,207,.14);
  background: rgba(20,17,13,.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 14px 28px rgba(0,0,0,.4);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}
.qleft { display: flex; gap: 10px; align-items: center; }
.queuePill {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(122,163,106,.35);
  background: rgba(63,107,69,.18);
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(231,222,207,.92);
}

/* ==================== GLOBAL NAV ==================== */
.global-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(16,13,10,.90);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line2);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 200;
  padding: 0 4px;
}
.global-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  color: rgba(198,185,163,.55);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .3px;
  padding: 6px 16px;
  border-radius: 12px;
  transition: color .15s;
  white-space: nowrap;
}
.global-nav a .nav-ico { font-size: 20px; line-height: 1; }
.global-nav a.active   { color: var(--moss2); }
.global-nav a:hover    { color: var(--ink); }

/* ==================== PLACEHOLDER PAGES ==================== */
.placeholder-body {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
}
.placeholder-body .ph-icon { font-size: 52px; margin-bottom: 14px; }
.placeholder-body h2 { margin: 0 0 8px; color: var(--ink); font-size: 20px; }
.placeholder-body p {
  font-size: 13px;
  line-height: 1.55;
  font-family: var(--mono);
  max-width: 300px;
  margin: 0 auto;
}
.placeholder-body .coming-badge {
  display: inline-block;
  margin-top: 16px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: rgba(43,47,44,.35);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

/* ==================== ACCESSIBILITY ==================== */
.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;
}

/* ==================== JOURNAL / NOTIFICATION BADGE ==================== */

/* Nav badge wrapper — wraps the nav-ico to allow absolute badge */
.nav-ico-wrap {
  position: relative;
  display: inline-block;
  line-height: 1;
}
.journal-badge {
  position: absolute;
  top: -5px; right: -8px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 999px;
  border: 1.5px solid rgba(16,13,10,.9);
  min-width: 16px;
  text-align: center;
  font-family: var(--mono);
  line-height: 1.4;
  pointer-events: none;
}

/* ==================== JOURNAL PAGE ==================== */

/* Filter chip row */
.journal-filters {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.filter-chip {
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: rgba(42,34,26,.86);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--ui);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: border-color .15s, color .15s;
}
.filter-chip.active {
  border-color: rgba(122,163,106,.4);
  background: linear-gradient(180deg, rgba(63,107,69,.22), rgba(42,34,26,.78));
  color: var(--ink);
}
.filter-chip .fc-count {
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: rgba(43,47,44,.45);
  color: var(--muted);
  min-width: 20px;
  text-align: center;
}
.filter-chip.active .fc-count {
  border-color: rgba(122,163,106,.35);
  color: var(--moss2);
}

/* Journal entry card */
.journal-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.journal-entry {
  border: 1px solid var(--line);
  border-radius: var(--radius2);
  background: rgba(31,26,20,.35);
  padding: 10px 10px 10px 16px;
  position: relative;
  overflow: hidden;
  transition: background .15s;
}
.journal-entry.unread {
  background: rgba(44,38,28,.60);
  border-color: var(--line2);
}
/* type color strip */
.journal-entry::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: var(--radius2) 0 0 var(--radius2);
}
.journal-entry.type-ok::before     { background: var(--ok); }
.journal-entry.type-warn::before   { background: var(--warn); }
.journal-entry.type-bad::before    { background: var(--danger); }
.journal-entry.type-danger::before { background: var(--danger); }
.journal-entry.type-info::before   { background: rgba(154,163,156,.5); }

.je-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.je-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.unread-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--moss2);
  box-shadow: 0 0 6px rgba(122,163,106,.5);
  flex: 0 0 auto;
}
.je-time {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(198,185,163,.6);
}
.je-title {
  font-weight: 800;
  font-size: 13px;
  margin-top: 7px;
  line-height: 1.25;
}
.je-body {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
}
.je-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 5px 9px;
  border: 1px solid var(--line2);
  border-radius: var(--radius2);
  background: rgba(43,47,44,.35);
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  transition: color .15s, border-color .15s;
}
.je-link:hover {
  color: var(--moss2);
  border-color: rgba(122,163,106,.35);
}

/* Empty state (journal-specific) */
.journal-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.journal-empty .ph-icon { font-size: 48px; margin-bottom: 12px; }
.journal-empty h2 { margin: 0 0 8px; color: var(--ink); }
.journal-empty p  { font-size: 13px; font-family: var(--mono); line-height: 1.5; margin: 0; }

/* ==================== GLOBAL NAV (6 items) ==================== */
/* Override padding to fit 6th item */
.global-nav a {
  padding: 6px 10px;
}
