/* Dungeon Realms: the table on top of a fullscreen scene picture. Loaded after theme-dark.css. */

/* ---------- lobby: realms, races, looks ---------- */
h3.sub { font-family: var(--serif); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin: 18px 0 8px; font-weight: 600; }
.realms { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.realm { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start; text-align: left; padding: 8px; }
.realm-map { aspect-ratio: 3 / 2; border-radius: 4px; background: radial-gradient(ellipse at 40% 40%, #5a4630, #2a2118 70%); background-size: cover; background-position: center;
  box-shadow: inset 0 0 0 1px rgba(201,164,92,.25); }
.realm-txt { display: flex; flex-direction: column; gap: 2px; }
.realm-txt b { font-family: var(--serif); letter-spacing: .04em; color: var(--ink); font-size: 15px; }
.realm-txt .small { font-family: var(--book); font-size: 14px; line-height: 1.3; color: #c9bfae; }
.realm.sel { border-color: var(--gold); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--gold); }
.races { grid-template-columns: repeat(3, 1fr) !important; }
#in-look { width: 100%; min-height: 70px; font: 17px/1.4 var(--book); background: var(--card-2); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
#screen-lobby, #screen-char { max-width: 760px; }

/* ---------- the table ---------- */
body.at-table { overflow: hidden; }
body.at-table .top { display: none; }
body.at-table main { padding: 0; }
.table-fs { position: fixed; inset: 0; z-index: 2; overflow: hidden; }
.scene { position: absolute; inset: 0; background: #080706; }
.scene .layer { position: absolute; inset: 0; opacity: 0; transform: scale(1.08); filter: blur(6px) brightness(.8);
  transition: opacity 2.8s ease, transform 6s cubic-bezier(.2, .7, .2, 1), filter 3.2s ease; will-change: opacity, transform, filter; }
.scene .layer.in { opacity: 1; transform: scale(1); filter: none; }
.scene .layer.leaving { transform: scale(1.18); filter: blur(4px) brightness(.42) saturate(.65);
  transition: transform 9s cubic-bezier(.35, 0, .2, 1), filter 4.5s ease, opacity 2.8s ease; }
.scene .layer.out { opacity: 0; transition: opacity 2.6s ease, transform 3s ease, filter 2.6s ease; }
.scene .pic { position: absolute; inset: -3%; background-size: cover; background-position: center; animation: drift-pic 48s ease-in-out infinite alternate; }
@keyframes drift-pic { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.07) translate(-1.6%, -1.1%); } }
.scene-shade { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(8,7,6,.55), transparent 18%, transparent 52%, rgba(8,7,6,.82) 88%),
              radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,.5)); }

.glass, .hud, .story, .drawer, .party-strip .pc { backdrop-filter: blur(8px); }
.hud { position: absolute; top: 14px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 8px 14px; background: rgba(12,10,8,.5); border: 1px solid rgba(201,164,92,.18); border-radius: 8px; }
.hud-place b { font-family: var(--serif); letter-spacing: .06em; font-size: 17px; color: var(--gold); margin-right: 10px; }
.hud-place .muted { font-family: var(--book); font-size: 15px; }
.hud-btns { display: flex; gap: 6px; }
.hud-btns button { padding: 6px 12px; font-family: var(--serif); font-size: 12px; letter-spacing: .1em; background: rgba(20,18,16,.6); }

.party-strip { position: absolute; left: 16px; top: 76px; width: 230px; display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 380px); overflow: auto; }
.party-strip .pc { display: grid; grid-template-columns: 58px 1fr; gap: 10px; align-items: center; padding: 8px; background: rgba(12,10,8,.55);
  border: 1px solid rgba(201,164,92,.15); border-radius: 8px; }
.party-strip .pc.mine { border-color: rgba(201,164,92,.5); }
.portrait { width: 58px; height: 58px; border-radius: 50%; background: #241e18 center / cover; box-shadow: 0 0 0 2px rgba(201,164,92,.55), 0 4px 14px rgba(0,0,0,.5);
  display: grid; place-items: center; font-family: var(--serif); font-size: 22px; color: var(--gold-dim); }
.portrait.waiting { animation: portraitWait 2s ease-in-out infinite; }
@keyframes portraitWait { 50% { box-shadow: 0 0 0 2px rgba(201,164,92,.2), 0 0 18px rgba(201,164,92,.25); } }
.pc-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pc-txt b { font-family: var(--serif); font-size: 14px; letter-spacing: .04em; }
.pc-txt .hpbar { margin: 3px 0 1px; }
.redo { align-self: flex-start; font-size: 12px; padding: 0; background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; }

.story { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(920px, calc(100% - 520px)); min-width: 520px;
  padding: 16px 20px; background: rgba(12,10,8,.62); border: 1px solid rgba(201,164,92,.2); border-radius: 10px; max-height: 48vh; overflow: auto; }
.gm-box { background: none !important; padding: 0; min-height: 0; aspect-ratio: auto !important; border: 0 !important; }
.story .narration { font: 20px/1.45 var(--book); margin: 0 0 8px; color: #efe6d6; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.story .gm-line { font: italic 18px/1.4 var(--book); color: var(--gold); margin: 0 0 10px; }
.gm-box.speaking .narration { color: #fff; }
.story .options { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.story .options button { text-align: left; background: rgba(20,18,16,.72); font: 17px/1.3 var(--book); padding: 9px 12px; }
.story .gm-controls { margin-top: 8px; }
.story .gm-controls .primary { width: 100%; }

.drawer { position: absolute; top: 76px; right: 16px; bottom: 16px; width: 320px; overflow: auto; padding: 16px 18px; background: rgba(12,10,8,.78);
  border: 1px solid rgba(201,164,92,.2); border-radius: 10px; z-index: 5; }
.drawer .ov-close { position: absolute; top: 8px; right: 10px; }
.drawer #log { font-size: 14px; }

body.ui-hidden .hud, body.ui-hidden .story, body.ui-hidden .party-strip, body.ui-hidden .drawer { opacity: 0; pointer-events: none; }
.hud, .story, .party-strip, .drawer { transition: opacity .6s ease; }
.show-ui { position: absolute; right: 16px; bottom: 16px; z-index: 6; opacity: .7; }
.show-ui:hover { opacity: 1; }

/* ---------- painted realm map with pins ---------- */
.paper { position: relative; width: min(100%, calc((100vh - 190px) * 1.5)); margin: 0 auto; border-radius: 6px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%, #d8c39a, #a88c5e 70%, #6f5735); box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.paper img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; display: block; }
.proads { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.proad { stroke: rgba(70,40,20,.0); stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-dasharray: 6 6; fill: none; }
.paper.no-art .proad { stroke: rgba(70,40,20,.55); }
.proad.live { stroke: rgba(201,140,40,.95) !important; stroke-width: 3; animation: proadDash 1.4s linear infinite; }
@keyframes proadDash { to { stroke-dashoffset: -24; } }
.pin { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0; background: none; border: 0; cursor: pointer; }
.pin svg { width: 26px; height: 26px; padding: 5px; box-sizing: content-box; border-radius: 50%; color: #2b1d10; background: rgba(240,226,196,.92);
  box-shadow: 0 0 0 2px rgba(60,35,15,.75), 0 3px 8px rgba(0,0,0,.45); }
.pin span { font-family: var(--serif); font-size: 12px; font-weight: 600; letter-spacing: .03em; color: #2b1d10; white-space: nowrap;
  background: rgba(240,226,196,.88); padding: 1px 7px; border-radius: 3px; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.pin:not(.visited):not(.here) svg { opacity: .78; }
.pin.exit svg { background: #f6d98f; box-shadow: 0 0 0 2px #8a5a14, 0 0 16px rgba(255,200,90,.8); }
.pin.here svg { background: var(--gold); box-shadow: 0 0 0 3px #3b250c, 0 0 0 7px rgba(201,164,92,.55), 0 0 24px rgba(255,210,120,.9); animation: hereGlow 2s ease-in-out infinite; }
@keyframes hereGlow { 50% { box-shadow: 0 0 0 3px #3b250c, 0 0 0 11px rgba(201,164,92,.25), 0 0 30px rgba(255,210,120,.9); } }
.pin:hover svg { transform: scale(1.12); }
.map-tip.below { transform: translate(-50%, 40px); }
.map-tip p { margin: 6px 0 0; font-family: var(--book); font-size: 15px; line-height: 1.35; }

/* ---------- phones: vertical picture, the story at the bottom, the rest behind buttons ---------- */
@media (max-width: 760px) {
  .realms { grid-template-columns: 1fr; }
  .hud { top: 8px; left: 8px; right: 8px; padding: 6px 10px; }
  .hud-place .muted { display: none; }
  .hud-btns button { padding: 5px 8px; font-size: 11px; letter-spacing: .04em; }
  .party-strip { top: 58px; left: 8px; right: 8px; width: auto; flex-direction: row; max-height: none; overflow-x: auto; }
  .party-strip .pc { grid-template-columns: 40px; padding: 4px; background: none; border: 0; backdrop-filter: none; }
  .party-strip .pc-txt { display: none; }
  .portrait { width: 40px; height: 40px; font-size: 16px; }
  .story { left: 8px; right: 8px; bottom: 8px; width: auto; min-width: 0; transform: none; padding: 12px 14px; max-height: 52vh; }
  .story .narration { font-size: 17px; }
  .story .gm-line { font-size: 16px; }
  .story .options { grid-template-columns: 1fr; }
  .story .options button { font-size: 16px; padding: 8px 10px; }
  .drawer { top: 0; right: 0; bottom: 0; left: 0; width: auto; border-radius: 0; }
  .paper { width: 100%; }
  .pin span { font-size: 10px; padding: 0 4px; }
  .pin svg { width: 18px; height: 18px; padding: 4px; }
}

/* pins are buttons: drop the theme's button look */
.paper .pin, .paper .pin:hover, .paper .pin:focus { background: none !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; min-height: 0; width: auto; }
.paper .pin:focus-visible svg { outline: 2px solid var(--gold); outline-offset: 2px; }

/* map on phones: the whole screen, names only for where you are and where you can go, the note at the bottom */
@media (max-width: 760px) {
  #ov-map { padding: 0; }
  #ov-map .sheet { width: 100%; height: 100%; max-height: 100vh; border-radius: 0; padding: 14px 10px; }
  #ov-map .map-legend { display: none; }
  #ov-map .sheet-head { padding-right: 36px; }
  .paper .pin:not(.here):not(.exit) span { display: none; }
  #ov-map .map-tip { position: fixed; left: 10px !important; right: 10px; bottom: 10px; top: auto !important; transform: none !important; max-width: none; z-index: 30; }
}
