/* middleearth: page-specific styles (shared look lives in /tool.css) */
:root { --tag: #fffdf6; --tag-ink: #2b2417; --marker: #c8442b; }
@media (prefers-color-scheme: dark) { :root { --tag: #2b2619; --tag-ink: #f2ead2; --marker: #ff7a5e; } }
.stage { position: relative; aspect-ratio: 16 / 10; margin: 0 0 .75rem; border-radius: 14px; overflow: hidden; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); line-height: 1.4; background: #14101c; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
@media (max-width: 520px) { .stage { aspect-ratio: 1 / 1.05; } }
.stage:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.game { position: absolute; left: 0; top: 0; display: block; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; }
.hud { position: absolute; left: .5rem; top: .5rem; display: flex; flex-direction: column; gap: .2rem; align-items: flex-start; pointer-events: none; z-index: 2; }
.hud-name, .hud-days { background: var(--tag); color: var(--tag-ink); border: 2px solid var(--tag-ink); border-radius: 4px; padding: .1rem .6rem; font-weight: 800; font-size: .9rem; box-shadow: 2px 2px 0 rgba(0,0,0,.35); }
.hud-days { font-weight: 700; font-size: .75rem; }
.hud-share { pointer-events: auto; font: inherit; font-weight: 800; font-size: .8rem; min-height: 2.5rem; padding: 0 .9rem; background: var(--tag); color: var(--tag-ink); border: 2px solid var(--marker); border-radius: 4px; box-shadow: 2px 2px 0 rgba(0,0,0,.35); cursor: pointer; }
.hud-share:hover { filter: brightness(1.08); }
.hud-share:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.friend[hidden] { display: none; }
.friend-line { margin: 0 0 .5rem; font-weight: 700; line-height: 1.6; }
.hud[data-mood="shire"] .hud-name { background: #d4efb4; color: #1f4a2a; }
.hud[data-mood="isengard"] .hud-name { background: #c8cdd0; color: #2a2c34; }
.hud[data-mood="rohan"] .hud-name { background: #f6e4a0; color: #5a3e12; }
.hud[data-mood="gondor"] .hud-name { background: #e4ecf8; color: #24385c; }
.hud[data-mood="mordor"] .hud-name { background: #4a1c14; color: #ffd8b0; border-color: #14080a; }
.minibox { position: absolute; right: .5rem; top: .5rem; width: 28%; max-width: 11rem; background: var(--tag); border: 2px solid var(--tag-ink); border-radius: 4px; overflow: hidden; line-height: 0; z-index: 2; box-shadow: 2px 2px 0 rgba(0,0,0,.35); }
.minibox.big { width: min(92%, 34rem); max-width: none; z-index: 3; }
.mini { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.minibtn { position: absolute; right: 2px; bottom: 2px; font: inherit; font-size: .72rem; line-height: 1.2; padding: .15rem .45rem; border-radius: 4px; border: 1px solid var(--tag-ink); background: var(--tag); color: var(--tag-ink); cursor: pointer; }
.minibtn:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.banner { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); margin: 0; z-index: 2; pointer-events: none; padding: .35rem 1.4rem; font-size: 1.5rem; font-weight: 900; letter-spacing: .12em; color: #fff4c8; background: rgba(20,16,28,.78); border: 3px solid #fff4c8; box-shadow: 4px 4px 0 rgba(0,0,0,.45); text-shadow: 2px 2px 0 #14101c; white-space: nowrap; }
.banner[hidden], .prompt[hidden], .card[hidden] { display: none; }
.prompt { position: absolute; left: 50%; top: .6rem; transform: translateX(-50%); margin: 0; z-index: 2; background: var(--tag); color: var(--tag-ink); border: 2px solid var(--marker); border-radius: 4px; padding: .2rem .8rem; font-weight: 700; font-size: .85rem; white-space: nowrap; pointer-events: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.card { position: absolute; left: .6rem; right: .6rem; bottom: .6rem; max-width: 30rem; margin: 0 auto; background: var(--tag); color: var(--tag-ink); border: 3px solid var(--tag-ink); border-radius: 4px; padding: .7rem .9rem; z-index: 5; max-height: 42%; overflow-y: auto; box-shadow: 3px 3px 0 rgba(0,0,0,.4); }
.card h3 { margin: 0 0 .3rem; font-size: 1.05rem; }
.card p { margin: 0 0 .5rem; font-size: .9rem; line-height: 1.6; }
.card .linkbtn { background: var(--tag); color: var(--tag-ink); border-color: var(--tag-ink); }
@media (max-width: 520px) { .card { bottom: .4rem; } .stage.card-open .dpad, .stage.card-open .act { visibility: hidden; } .banner { font-size: 1.1rem; } }
.dpad { position: absolute; left: .5rem; bottom: .5rem; width: 8.4rem; height: 8.4rem; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 2px; opacity: .85; z-index: 2; }
.pad { font: inherit; font-size: 1rem; border: 2px solid var(--tag-ink); background: var(--tag); color: var(--tag-ink); border-radius: 6px; cursor: pointer; touch-action: none; padding: 0; }
.pad:active { background: var(--accent); color: var(--accent-ink); }
.pad:focus-visible, .act:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.pad-up { grid-column: 2; grid-row: 1; } .pad-left { grid-column: 1; grid-row: 2; } .pad-right { grid-column: 3; grid-row: 2; } .pad-down { grid-column: 2; grid-row: 3; }
.act { position: absolute; right: .5rem; bottom: .5rem; padding: .7rem 1rem; box-shadow: 2px 2px 0 rgba(0,0,0,.4); max-width: 45%; z-index: 2; border-radius: 4px; }
@media (min-width: 900px) and (hover: hover) { .dpad { width: 6rem; height: 6rem; opacity: .6; } }
.tip { margin: 0 0 1rem; }

.navlist { list-style: none; margin: 0 0 .5rem; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.navbtn { padding: .5rem .8rem; font-weight: 600; }
.navbtn:focus-visible, .spotbtn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.navbtn.far { opacity: .6; border-style: dashed; }
.navbtn[aria-current] { border-color: var(--accent); }

.region { border-left-width: 6px; }
.region[data-mood="shire"] { border-left-color: #6aa84f; }
.region[data-mood="isengard"] { border-left-color: #7f857a; }
.region[data-mood="rohan"] { border-left-color: #c4ac3a; }
.region[data-mood="gondor"] { border-left-color: #8da0b5; }
.region[data-mood="mordor"] { border-left-color: #a6402c; }
.region-top { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); margin-bottom: 1rem; }
@media (min-width: 640px) { .region-top { grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); align-items: start; } }
.scene { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; image-rendering: pixelated; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
.region-text h2 { margin: 0 0 .5rem; font-size: 1.4rem; }
.region-text p { margin: 0 0 .5rem; line-height: 1.65; }
.region-text .eyebrow { margin: 0 0 .2rem; }
.sub { margin: 1rem 0 .5rem; font-size: 1rem; }
.sub .count { color: var(--muted); font-weight: 600; font-size: .9rem; margin-left: .4rem; }
.spots { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: .4rem; }
.spots li { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .75rem; line-height: 1.6; color: var(--muted); }
.spots li.got { color: var(--text); border-color: var(--accent); }
.spotbtn { padding: .5rem .9rem; }
.spotbtn.got { border-style: solid; }
.btn.secondary[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.spot-detail { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; line-height: 1.7; }
.spot-detail.empty { color: var(--muted); }
.spot-detail h4 { margin: 0 0 .3rem; font-size: 1rem; }
.spot-detail p { margin: 0; }
.bar { width: 100%; height: 12px; margin: .9rem 0 .5rem; accent-color: var(--accent); }
.badges { list-style: none; margin: 0 0 .75rem; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.badge { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: .25rem .7rem; font-size: .85rem; color: var(--muted); }
.badge.full { border-color: var(--accent); color: var(--text); font-weight: 700; }
.done { margin: 0 0 .75rem; padding: .7rem .9rem; border-radius: 8px; border: 2px solid var(--accent); font-weight: 600; }
.done[hidden], #reset-confirm[hidden] { display: none; }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; max-height: 14rem; overflow-y: auto; }
.log li { display: flex; gap: .6rem; font-size: .9rem; border-bottom: 1px dashed var(--line); padding-bottom: .3rem; }
.log-day { flex: none; min-width: 3.6rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.disclaimer { margin: 0 0 1rem; }


/* dialogue box, toast, journal sections (characters / quests / souvenirs / share) */
.dlg { position: absolute; left: .5rem; right: .5rem; bottom: .5rem; max-width: 34rem; margin: 0 auto; z-index: 6; display: grid; grid-template-columns: 3.6rem minmax(0, 1fr); gap: .6rem; padding: .6rem .7rem; background: var(--tag); color: var(--tag-ink); border: 3px solid var(--tag-ink); border-radius: 4px; box-shadow: 3px 3px 0 rgba(0,0,0,.45); max-height: 78%; overflow-y: auto; }
.dlg[hidden], .toast[hidden], .share-text[hidden], .cert-preview[hidden] { display: none; }
.dlg-face { width: 3.6rem; height: 3.6rem; image-rendering: pixelated; image-rendering: crisp-edges; border: 2px solid var(--tag-ink); border-radius: 3px; background: #3a3250; }
.dlg-main { min-width: 0; }
.dlg-name { margin: 0 0 .15rem; font-weight: 800; font-size: .95rem; }
.dlg-text { margin: 0 0 .4rem; font-size: .95rem; line-height: 1.6; min-height: 3.2em; word-break: keep-all; overflow-wrap: anywhere; }
.dlg-choices { list-style: none; margin: 0 0 .4rem; padding: 0; display: grid; gap: .3rem; }
.dlg-choices[hidden] { display: none; }
.dlg-choice { width: 100%; text-align: left; font: inherit; font-size: .9rem; padding: .5rem .7rem; min-height: 2.5rem; border: 2px solid var(--tag-ink); border-radius: 4px; background: var(--tag); color: var(--tag-ink); cursor: pointer; }
.dlg-choice:hover, .dlg-choice:focus-visible { background: var(--accent); color: var(--accent-ink); outline: 3px solid var(--focus); outline-offset: 1px; }
.dlg-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.dlg-keys { font-size: .72rem; opacity: .7; }
.dlg-next { padding: .45rem 1rem; min-height: 2.5rem; }
.stage.dlg-open .dpad, .stage.dlg-open .act, .stage.dlg-open .prompt { visibility: hidden; }
@media (max-width: 520px) {
  .dlg { left: .35rem; right: .35rem; bottom: .35rem; grid-template-columns: 2.4rem minmax(0, 1fr); gap: .4rem; padding: .3rem .45rem; max-height: 45%; border-width: 2px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .dlg-face { width: 2.4rem; height: 2.4rem; }
  .dlg-name { margin: 0; font-size: .82rem; line-height: 1.2; }
  .dlg-text { margin: 0 0 .2rem; font-size: .85rem; line-height: 1.4; min-height: 2.8em; }
  .dlg-choices { gap: .15rem; margin: 0 0 .1rem; }
  .dlg-choice { font-size: .82rem; line-height: 1.3; padding: .15rem .55rem; min-height: 2.5rem; }
  .dlg-keys { display: none; }
  .dlg-foot { justify-content: flex-end; }
  .dlg-next { padding: .25rem .9rem; min-height: 2.5rem; font-size: .85rem; }
}
.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); margin: 0; z-index: 30; max-width: calc(100% - 2rem); padding: .55rem 1.1rem; background: var(--tag-ink); color: var(--tag); border-radius: 6px; font-weight: 700; font-size: .95rem; box-shadow: 0 2px 10px rgba(0,0,0,.4); text-align: center; }

.stats { flex-wrap: wrap; }
.share-row { margin: .25rem 0 .25rem; gap: .5rem; }
.share-btn { font-weight: 800; }
.share-text { display: block; width: 100%; box-sizing: border-box; margin: 0 0 .6rem; padding: .6rem .75rem; font: inherit; font-size: .9rem; line-height: 1.6; color: var(--text); background: var(--bg); border: 2px solid var(--accent); border-radius: 8px; resize: vertical; }
.cert-preview { display: block; width: 100%; max-width: 30rem; height: auto; margin: 0 0 .8rem; image-rendering: pixelated; border: 2px solid var(--line); border-radius: 6px; }
.done .share-btn { margin-left: .4rem; }
.met, .quests { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: .35rem; }
.met { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
.met li { display: flex; align-items: center; gap: .5rem; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .35rem .6rem; font-size: .88rem; color: var(--muted); min-height: 2.6rem; }
.met li.got { color: var(--text); border-color: var(--accent); }
.met .face { width: 2rem; height: 2rem; flex: none; image-rendering: pixelated; image-rendering: crisp-edges; border-radius: 3px; background: #3a3250; }
.met .face.empty { opacity: .35; }
.met .who { display: block; line-height: 1.35; }
.met .who small { display: block; color: var(--muted); font-size: .75rem; }
.quests li { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .75rem; line-height: 1.55; color: var(--muted); font-size: .9rem; }
.quests li.active { border-color: var(--accent); color: var(--text); }
.quests li.done { border-color: var(--accent); color: var(--text); background: var(--surface); }
.quests strong { display: block; }
.quests .state { font-weight: 700; margin-right: .4rem; }
.bag { margin: 0 0 .75rem; font-size: .9rem; color: var(--muted); }
.souv { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(5.6rem, 1fr)); gap: .4rem; }
.souv li { display: flex; flex-direction: column; align-items: center; gap: .25rem; text-align: center; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .45rem .3rem; font-size: .75rem; line-height: 1.3; color: var(--muted); min-height: 4.6rem; }
.souv li.got { color: var(--text); border-color: var(--accent); }
.souv .ico { width: 2.4rem; height: 2.4rem; image-rendering: pixelated; image-rendering: crisp-edges; }
.souv li:not(.got) .ico { opacity: .25; filter: grayscale(1); }
#card-text { white-space: pre-line; }
