/* The Odyssey — manuscript UI over the living sea.
   Ink, parchment and gold on deep wine-dark glass.
   Bottom-right is left clear for the host's share bar. */

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #241c2e; }
body { font-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif; color: #f0e2c8; }
#od-app, #od-app canvas { position: fixed; inset: 0; display: block; }

.od-ui { position: fixed; z-index: 20; user-select: none; }
.od-hidden { display: none !important; }
.od-scroll { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #8a6a40 transparent; }

/* ---------- top bar ---------- */
.od-topbar {
  top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
  background: linear-gradient(to bottom, rgba(24,16,32,0.88), rgba(24,16,32,0.0));
  pointer-events: none;
}
.od-topbar > * { pointer-events: auto; }
.od-title {
  font-size: 22px; letter-spacing: 0.14em; color: #e8c878;
  text-shadow: 0 2px 12px rgba(0,0,0,0.7);
}
.od-title span { font-size: 11px; color: #b8a888; letter-spacing: 0.06em; margin-left: 10px; font-style: italic; }
.od-topbtns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.od-btn {
  font-family: inherit; font-size: 13px;
  color: #e8d5a8; background: rgba(42,30,48,0.82);
  border: 1px solid rgba(210,170,90,0.45); border-radius: 3px;
  padding: 6px 12px; cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}
.od-btn:hover { background: rgba(72,50,70,0.9); border-color: rgba(232,200,120,0.9); transform: translateY(-1px); }
.od-btn.od-active { background: rgba(120,86,40,0.85); }

/* ---------- panels ---------- */
.od-panel, .od-charpanel {
  top: 64px; bottom: 130px;
  width: min(400px, 42vw);
  padding: 20px 22px;
  overflow-y: auto;
  background: linear-gradient(160deg, rgba(30,20,38,0.92), rgba(24,16,32,0.88));
  border: 1px solid rgba(210,170,90,0.4);
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.55), inset 0 0 60px rgba(120,80,30,0.06);
  scrollbar-width: thin; scrollbar-color: #8a6a40 transparent;
}
.od-panel { right: 16px; }
.od-charpanel { left: 16px; }
.od-panel h2, .od-charpanel h2 {
  margin: 2px 30px 4px 0; font-size: 24px; font-weight: normal;
  color: #ecd28f; letter-spacing: 0.03em; line-height: 1.15;
}
.od-ep-book, .od-ch-kind {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.18em; color: #a89060;
}
.od-epithet { font-style: italic; color: #c8b088; margin-bottom: 10px; font-size: 14px; }
.od-close {
  position: absolute; top: 10px; right: 10px;
  background: none; border: none; color: #a89060; font-size: 16px; cursor: pointer;
}
.od-close:hover { color: #ecd28f; }
.od-ep-surface { font-size: 16px; line-height: 1.5; color: #f4e4bd; font-style: italic; }
.od-ep-mid { font-size: 14.5px; line-height: 1.62; color: #e2cfa4; border-left: 2px solid rgba(210,170,90,0.5); padding-left: 12px; }
.od-ep-deep p, .od-ch-bg, .od-ch-fates { font-size: 14px; line-height: 1.62; color: #d5c39a; }
.od-flashback {
  display: inline-block; font-size: 11.5px; color: #b8a0d8; letter-spacing: 0.05em;
  border: 1px solid rgba(150,120,200,0.4); padding: 3px 8px; border-radius: 2px; margin: 4px 0 10px;
}
.od-moments h4, .od-cast-row h4, .od-charpanel h4 {
  margin: 18px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.16em; color: #b89858;
}
.od-moment { font-size: 13.5px; line-height: 1.5; color: #d8c8a0; margin: 4px 0; }
.od-speech {
  margin: 14px 0; padding: 12px 14px;
  background: rgba(70,48,80,0.28);
  border-left: 3px solid #c8a040;
  font-style: italic; font-size: 14.5px; line-height: 1.6; color: #f0dfae;
}
.od-speech cite { display: block; margin-top: 6px; font-size: 12px; font-style: normal; color: #a89060; }
.od-scope-more { margin-top: 14px; font-size: 12.5px; font-style: italic; color: #98886a; }
.od-cast-btn { margin: 3px 4px 3px 0; text-transform: capitalize; }

/* ---------- character relations ---------- */
.od-rel-list { max-height: 34vh; }
.od-rel-row {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: rgba(46,32,52,0.5); border: 1px solid rgba(150,120,80,0.25);
  border-radius: 3px; margin: 5px 0; padding: 8px 10px; font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
}
.od-rel-row:hover { border-color: rgba(232,200,120,0.8); background: rgba(70,50,74,0.6); }
.od-rel-swatch { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: baseline; }
.od-rel-label { font-size: 13px; color: #ecd28f; text-transform: capitalize; }
.od-rel-text { display: block; font-size: 12.5px; line-height: 1.45; color: #bfae8a; margin-top: 3px; }

/* ---------- thread tours ---------- */
.od-tours {
  left: 16px; top: 64px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  max-width: 46vw;
}
.od-tours-label { font-size: 12px; font-style: italic; color: #c0ad84; text-shadow: 0 1px 6px #000; }
.od-tour-btn { font-size: 12px; padding: 4px 9px; }
.od-dim-btn { opacity: 0.7; }
/* when the character panel opens, tours slide right to stay visible */
.od-charpanel:not(.od-hidden) ~ .od-tours { display: none; }

/* ---------- legend ---------- */
.od-legend {
  left: 16px; bottom: 14px;
  padding: 10px 13px;
  background: rgba(24,16,32,0.78);
  border: 1px solid rgba(210,170,90,0.3); border-radius: 4px;
  font-size: 11px; max-width: 210px;
}
.od-legend-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: #b89858; margin-bottom: 5px; }
.od-legend-row { display: flex; align-items: baseline; gap: 7px; margin: 2.5px 0; }
.od-legend-swatch { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; }
.od-legend-text { color: #cdbb92; }
.od-legend-text i { color: #8d7d61; }

/* ---------- timeline ---------- */
.od-timeline {
  left: 50%; transform: translateX(-50%);
  bottom: 14px;
  width: min(520px, 52vw);
  background: rgba(24,16,32,0.82);
  border: 1px solid rgba(210,170,90,0.35); border-radius: 4px;
  padding: 8px 14px 10px;
}
.od-tl-title {
  text-align: center; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  color: #cbb578; cursor: pointer;
}
.od-tl-title:hover { color: #ecd28f; }
.od-tl-body { display: none; }
.od-tl-open .od-tl-body { display: block; }
.od-tl-track { position: relative; height: 96px; margin-top: 8px; border-bottom: 1px solid rgba(210,170,90,0.4); }
.od-tl-mark { position: absolute; bottom: -1px; height: 8px; width: 1px; border-left: 2px solid; }
.od-tl-item {
  position: absolute; bottom: 30px; transform: translateX(-50%);
  font-size: 10px; width: 74px; text-align: center; cursor: pointer;
  line-height: 1.2; opacity: 0.9;
}
.od-tl-item.od-tl-low { bottom: 10px; }
.od-tl-item:hover { opacity: 1; text-decoration: underline; }
.od-tl-readout { font-size: 11.5px; color: #a5936c; margin-top: 8px; text-align: center; }

/* ---------- episodes index ---------- */
.od-index {
  inset: 0; z-index: 30;
  background: rgba(14,10,20,0.72);
  display: flex; align-items: center; justify-content: center;
}
.od-index-inner {
  width: min(720px, 90vw); max-height: 82vh;
  background: linear-gradient(165deg, #2c2136, #221a2c);
  border: 1px solid rgba(220,180,100,0.5); border-radius: 5px;
  padding: 26px 30px;
  box-shadow: 0 20px 80px rgba(0,0,0,0.7);
}
.od-index-inner h2 { margin: 0 0 4px; color: #ecd28f; font-weight: normal; font-size: 26px; }
.od-index-inner h3 { margin: 18px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.15em; color: #b89858; }
.od-dim { color: #99896b; font-size: 13px; line-height: 1.5; }
.od-index-row {
  display: block; width: 100%; text-align: left; margin: 4px 0; padding: 8px 10px;
  background: rgba(60,42,66,0.45); border: 1px solid rgba(150,120,80,0.2); border-radius: 3px;
  font-family: inherit; font-size: 13.5px; color: #dccb9e; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.od-index-row:hover { border-color: rgba(232,200,120,0.85); background: rgba(80,56,82,0.55); }
.od-index-row b { color: #ecd28f; font-weight: normal; }
.od-index-row i { color: #a9987a; font-size: 12.5px; }
.od-idx-num { color: #b8a0d8; margin-right: 4px; }
.od-idx-book { float: right; font-size: 11px; color: #8d7d61; }
.od-index-close { margin-top: 16px; }

/* ---------- help ---------- */
.od-help {
  inset: 0; z-index: 30; background: rgba(14,10,20,0.66);
  display: flex; align-items: center; justify-content: center;
}
.od-help h3 { color: #ecd28f; font-weight: normal; margin-top: 0; }
.od-help { line-height: 1.6; }
.od-help > * { pointer-events: none; }
.od-help { pointer-events: auto; }
.od-help::after { content: ''; }
.od-help h3, .od-help p {
  pointer-events: auto;
}
.od-help { flex-direction: column; }
.od-help > h3, .od-help > p { width: min(480px, 88vw); background: none; }
.od-help h3, .od-help p {
  background: linear-gradient(165deg, #2c2136, #221a2c);
  margin: 0; padding: 10px 26px;
  border-left: 1px solid rgba(220,180,100,0.5); border-right: 1px solid rgba(220,180,100,0.5);
}
.od-help h3 { border-top: 1px solid rgba(220,180,100,0.5); border-radius: 5px 5px 0 0; padding-top: 22px; }
.od-help p:last-of-type { border-bottom: 1px solid rgba(220,180,100,0.5); border-radius: 0 0 5px 5px; padding-bottom: 22px; }

/* ---------- voyage chip / scope hint ---------- */
.od-voyage-chip {
  top: 60px; left: 50%; transform: translateX(-50%);
  padding: 7px 16px; cursor: pointer;
  background: rgba(52,36,20,0.85); border: 1px solid rgba(232,200,120,0.6); border-radius: 20px;
  font-size: 13px; color: #ecd28f;
}
.od-scope-hint {
  bottom: 96px; left: 50%; transform: translateX(-50%);
  font-size: 11.5px; font-style: italic; color: rgba(220,200,160,0.65);
  text-shadow: 0 1px 6px #000; pointer-events: none;
}

/* ---------- intro ---------- */
.od-intro {
  inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(30,20,40,0.42), rgba(16,10,24,0.78));
  transition: opacity 0.9s;
}
.od-intro-out { opacity: 0; pointer-events: none; }
.od-intro-inner { width: min(560px, 88vw); text-align: center; }
.od-intro-kicker { font-style: italic; color: #a89060; font-size: 13px; margin-bottom: 8px; }
.od-intro-inner h1 {
  margin: 0 0 4px; font-size: clamp(38px, 7vw, 64px); font-weight: normal;
  letter-spacing: 0.22em; color: #ecd28f;
  text-shadow: 0 4px 30px rgba(200,150,60,0.3);
}
.od-intro-sub { font-style: italic; color: #c8b088; margin-bottom: 18px; font-size: 15px; }
.od-intro-inner p { font-size: 14.5px; line-height: 1.7; color: #d5c39a; }
.od-intro-go {
  margin-top: 14px; font-size: 17px; padding: 11px 34px; letter-spacing: 0.08em;
  background: rgba(120,86,40,0.7);
}
.od-intro-go:hover { background: rgba(150,110,55,0.9); }
.od-intro-hint { margin-top: 20px; font-size: 12px; color: #8d7d61; font-style: italic; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .od-panel, .od-charpanel { width: calc(100vw - 32px); top: auto; bottom: 96px; max-height: 46vh; }
  .od-panel { right: 16px; }
  .od-tours { display: none; }
  .od-legend { display: none; }
  .od-timeline { width: calc(100vw - 32px); }
  .od-title span { display: none; }
}
