/* Per-screen styles. Positions are the Canvas's (390 x 844 reference),
   measured from the top or bottom edge plus the safe area. */

/* ---------- Home ---------- */
.home .home-sky { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to bottom, rgba(6, 9, 26, .5) 0%, rgba(6, 9, 26, .1) 16%, rgba(6, 9, 26, 0) 30%), rgba(205, 218, 255, .09); }

.fog { position: absolute; left: 0; width: 200%; pointer-events: none; background-repeat: repeat-x; background-size: 50% 100%;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 32%, #000 68%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 32%, #000 68%, transparent 100%);
  animation: drift var(--t) linear infinite; will-change: transform; }
.fog.rev { animation-direction: reverse; }
.fog1 { top: 19%; height: 30%; --t: 85s; opacity: .95; }
.fog2 { top: 33%; height: 34%; --t: 60s; opacity: .9; }
.fog3 { top: 48%; height: 30%; --t: 42s; opacity: .9; }
.fog4 { top: 60%; height: 26%; --t: 30s; opacity: .7; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.home-title-wrap { position: absolute; left: 0; right: 0; top: calc(72px + var(--safe-top)); text-align: center; pointer-events: none; }
.home-title {
  position: relative; display: inline-block; margin: 0; line-height: 1.05;
  font-family: var(--f-display); font-weight: 700; font-size: min(40px, 10.4vw); letter-spacing: 2px; text-indent: 2px; text-transform: uppercase;
  color: transparent; background: linear-gradient(100deg, #ffe9a8 0%, #ffe9a8 38%, #ffffff 50%, #ffe9a8 62%, #ffd77a 100%);
  background-size: 250% 100%; background-position: 100% 0; -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 2px 0 rgba(8, 10, 28, .9)) drop-shadow(0 0 10px rgba(8, 10, 28, .9)) drop-shadow(0 0 22px rgba(150, 140, 255, .55));
  animation: shimmer 7s ease-in-out infinite;
}
@keyframes shimmer { 0%, 55% { background-position: 100% 0; } 100% { background-position: 0 0; } }
/* Drifting glitter around the title (replaces the Canvas's fixed twinkling stars). */
.glitter { position: absolute; left: 50%; top: -55%; width: min(380px, 104%); height: 210%; transform: translateX(-50%); pointer-events: none; }
.glitter i { position: absolute; width: var(--s); height: var(--s); opacity: 0; animation: glitterDrift var(--d) ease-in-out infinite; }
.glitter .speck { border-radius: 50%; background: radial-gradient(circle, #fff 0 30%, #ffeaa8 55%, transparent 75%); box-shadow: 0 0 4px 1px rgba(255, 233, 168, .7); }
.glitter .glint { background: radial-gradient(circle, #fff 0 18%, #ffeaa8 42%, transparent 70%); clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); filter: drop-shadow(0 0 3px #ffe9a8); }
@keyframes glitterDrift {
  0% { opacity: 0; transform: translate(0, 4px) scale(.3) rotate(0deg); }
  35% { opacity: 1; transform: translate(calc(var(--dx) * .4), -2px) scale(1) rotate(30deg); }
  60% { opacity: .6; transform: translate(calc(var(--dx) * .7), -6px) scale(.8) rotate(55deg); }
  100% { opacity: 0; transform: translate(var(--dx), -12px) scale(.3) rotate(90deg); }
}
.reduce-motion .glitter i { opacity: .7; transform: none; }
@media (prefers-reduced-motion: reduce) { .glitter i { opacity: .7; transform: none; } .home-title { background-position: 0 0; } }

.home-spots {
  position: absolute; left: 16px; right: 16px; top: calc(126px + var(--safe-top)); bottom: calc(122px + var(--safe-bottom));
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 44fr) minmax(0, 34fr); gap: 0 11px;
}
.spot { display: flex; flex-direction: column; align-items: center; gap: 1.2px; min-height: 0; min-width: 0; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.spot.low { padding-top: 27px; }
.spot .name { flex: none; align-self: stretch; text-align: center; font-family: var(--f-display); font-weight: 700; font-size: 18px; letter-spacing: .04em; line-height: 1.1; color: var(--gold);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .95), 0 0 8px rgba(5, 8, 22, .95), 0 0 18px rgba(5, 8, 22, .85); }
.spot .art { flex: 1; min-height: 0; width: 100%; display: flex; align-items: flex-start; justify-content: center; }
.spot img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .55)); transition: transform .25s ease; user-select: none; -webkit-user-drag: none; }
.spot:hover img { transform: scale(1.03); }
.spot:active img { transform: scale(.99); }
.spot:focus-visible { outline: none; }
.spot:focus-visible .name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .22em; }

/* ---------- rooms and hubs (placeholders) ---------- */
.placeholder-wrap { position: absolute; left: 24px; right: 24px; top: calc(170px + var(--safe-top)); }
.hub .placeholder-wrap { top: auto; bottom: calc(110px + var(--safe-bottom)); }
.hub.starry .placeholder-wrap { top: calc(170px + var(--safe-top)); bottom: auto; }

/* ---------- settings ---------- */
/* Canvas sizes, shrinking on narrower phones so each title stays on one line. */
.settings-title { left: 60px; right: 60px; white-space: nowrap; font-size: min(40px, 10.2vw); text-shadow: 0 0 18px rgba(236, 205, 142, .6), 0 2px 6px rgba(0, 0, 0, .85); }
.settings-title.title-36 { font-size: min(36px, 8.6vw); }
.settings-title.title-34 { font-size: min(34px, 7.6vw); }
.settings-title.title-32 { font-size: min(32px, 6.9vw); }
.settings-title.title-30 { font-size: min(30px, 6.9vw); }
/* The scroll area extends 16px past the content on every side so hover glows
   and the lift on menu rows aren't clipped; content sits where the Canvas has it. */
.settings-body {
  position: absolute; left: 0; right: 0; top: calc(124px + var(--safe-top)); bottom: calc(80px + var(--safe-bottom));
  overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 12px; padding: 16px 16px 14px;
}
.menu-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-decoration: none; border: 1px solid var(--panel-border); border-radius: 14px; background: var(--panel-bg); box-shadow: var(--panel-shadow); transition: box-shadow .15s ease, transform .15s ease; }
.menu-row:hover { box-shadow: 0 0 16px rgba(255, 224, 138, .5); transform: translateY(-1px); }
.menu-text { flex: 1; min-width: 0; }
.menu-title { font-family: var(--f-display); font-weight: 700; font-size: 19px; color: var(--cream); }
.menu-sub { font-size: calc(16px * var(--ts)); color: var(--muted); margin-top: 2px; line-height: 1.2; }
.about { text-align: center; margin-top: 12px; }
.about p { margin: 8px 0 0; font-size: calc(17px * var(--ts)); }
.about .build-version { font-size: calc(13px * var(--ts)); opacity: .7; }
.log-count { opacity: .75; }
.footnote { margin: 4px 8px 0; font-style: italic; font-size: calc(16px * var(--ts)); line-height: 1.35; color: #9089ad; text-align: center; }

.code-box { margin-top: 10px; padding: 10px 12px; border: 1px dashed rgba(236, 205, 142, .6); border-radius: 10px; background: rgba(6, 5, 16, .6); font-family: ui-monospace, Menlo, monospace; font-size: 12px; line-height: 1.35; color: #cfe3ff; word-break: break-all; max-height: 120px; overflow-y: auto; user-select: all; -webkit-user-select: all; }
.paste { display: block; width: 100%; margin-top: 10px; padding: 12px; min-height: 64px; border: 1px solid rgba(236, 205, 142, .6); border-radius: 10px; background: rgba(6, 5, 16, .6); font-family: ui-monospace, Menlo, monospace; font-size: 16px; color: #cfe3ff; resize: vertical; }
.paste::placeholder { font-family: var(--f-body); font-style: italic; font-size: 15px; color: #6f688f; }
.form-msg { margin: 8px 0 0 !important; font-size: 15px !important; }
.form-msg.error { color: var(--danger-text) !important; }

.step-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.step-row .row-label { flex: 1; font-size: 15px; }
.step-text { flex: 1; min-width: 0; }
.step-text .row-label { font-size: 14px; }
.duel-log { max-height: 220px; overflow: auto; white-space: pre; font-size: 11px; }
.step-btn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--gold-soft); background: rgba(36, 34, 78, .9); color: var(--gold); font-size: 22px; cursor: pointer; }
.step-value { min-width: 44px; text-align: center; font-family: var(--f-display); font-weight: 700; font-size: 19px; color: var(--cream); font-variant-numeric: tabular-nums; }
.link-row { justify-content: space-between; padding: 0 18px; flex: none; }
.state-box { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: rgba(6, 5, 16, .7); font-family: ui-monospace, Menlo, monospace; font-size: 12px; line-height: 1.45; color: #cfe3ff; white-space: pre-wrap; word-break: break-word; }

.jump .jump-list {
  position: absolute; left: 16px; right: 16px; top: calc(128px + var(--safe-top)); bottom: calc(148px + var(--safe-bottom));
  overflow-y: auto; border: 1px solid var(--panel-border); border-radius: 14px; background: var(--panel-bg); box-shadow: var(--panel-shadow); padding: 6px 8px 10px;
}
.jump-head { padding: 14px 8px 4px; }
.jrow { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 4px 8px; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; text-align: left; }
.jrow:hover { background: rgba(236, 205, 142, .1); }
.jrow[aria-pressed="true"] { border-color: var(--gold); background: rgba(236, 205, 142, .16); }
.jn { width: 26px; flex: none; font-family: var(--f-display); font-weight: 700; font-size: 14px; color: var(--label); text-align: right; }
.jt { flex: 1; font-size: calc(17px * var(--ts)); line-height: 1.2; color: #f1e8cf; }
.jump-note { position: absolute; left: 16px; right: 16px; bottom: calc(88px + var(--safe-bottom)); margin: 0; min-height: 48px; text-align: center; font-size: 16px; color: #cfe3ff; font-style: italic; line-height: 1.3; }
.jump-go { position: absolute; left: 16px; right: 16px; bottom: calc(86px + var(--safe-bottom)); width: auto; }

/* Hall of Doors (Canvas HallOfDoors): a door per deity defeated, in two columns. */
.hall-doors { position: absolute; left: 16px; right: 16px; bottom: calc(256px + var(--safe-bottom)); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hall-door { min-height: 52px; padding: 6px 8px; font-size: 15px; letter-spacing: 1px; cursor: pointer; }
.deity-talking .screen-title, .deity-talking .title-halo { visibility: hidden; }
/* Inside an overlay the shade sits at z 30; lift the deity to the same layer (it comes later, so it's on top and not dimmed). */
.overlay-layer > .deity-appears { z-index: 30; }
.hall-glow { background: radial-gradient(ellipse at 50% 55%, rgba(236, 205, 142, .35), rgba(236, 205, 142, 0) 68%); }

/* Socketing (Canvas WorkshopSocketing): the wand and the bench, highlighted in turn. */
.socket-wand { top: calc(150px + var(--safe-top)); height: 128px; }
.socket-bench { top: calc(300px + var(--safe-top)); height: 118px; }
.socket-bench .bench-slot { position: absolute; left: 50%; top: 30px; width: 76px; height: 76px; margin-left: -38px; cursor: default; }
.bench-slot img { transition: opacity .4s ease; }
.socket-shade { position: absolute; inset: 0; z-index: 20; background: rgba(6, 5, 16, .66); pointer-events: none; }
.pointed-panel { z-index: 25; outline: 2px solid var(--gold); outline-offset: 3px; }

/* The Gather Elemental Essence row (Canvas HomeEssence, 2026-10-26): between the top rooms and the
   bottom ones, shrinking to fit its tiles. It sits a little higher than plain grid flow, centred in
   the gap between the Spirit Gate art and the Workshop and Garden names. */
.home-spots.with-gather { grid-template-rows: minmax(0, 44fr) auto minmax(0, 34fr); }
.essence-row { grid-column: 1 / -1; justify-self: center; width: max-content; max-width: 100%; position: relative; top: -19px; margin: 8px 0 6px; padding: 7px 6px 8px; box-sizing: border-box; border: 1px solid rgba(243, 220, 160, .45); border-radius: 14px; background: rgba(10, 14, 36, .62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); box-shadow: 0 4px 16px rgba(0, 0, 0, .45); }
.essence-head { text-align: center; white-space: nowrap; padding: 0 10px; margin-bottom: 6px; font-family: var(--f-display); font-weight: 700; font-size: 13px; letter-spacing: .08em; line-height: 1.1; color: #ffe9a8; text-shadow: 0 1px 3px rgba(0, 0, 0, .95), 0 0 8px rgba(5, 8, 22, .9); }
.essence-tiles { display: flex; justify-content: center; gap: 6px; }
.essence-tile { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 82px; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.essence-label { display: flex; align-items: center; gap: 3px; white-space: nowrap; font-family: var(--f-display); font-weight: 700; font-size: 10.5px; line-height: 1.1; color: #ffe9a8; text-shadow: 0 1px 3px rgba(0, 0, 0, .95); }
.alchemy { width: 11px; height: 11px; flex: none; color: var(--c); }
.alchemy svg { display: block; width: 100%; height: 100%; overflow: visible; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .85)); }
.essence-tile img { display: block; width: 82px; height: 62px; object-fit: cover; object-position: center; box-sizing: border-box; border: 1.5px solid var(--c); border-radius: 9px; box-shadow: 0 0 8px color-mix(in srgb, var(--c) 55%, transparent); transition: transform .2s ease; }
.essence-tile:hover img { transform: scale(1.04); }
.essence-tile:active img { transform: scale(.98); }
.essence-tile:focus-visible { outline: none; }
.essence-tile:focus-visible img { outline: 2px solid #ffe9a8; outline-offset: 2px; }
