/* Skylore: the star chart and the levels. Quiet, dark and warm, like Slow Cinema. */
:root {
  --ink: rgba(255, 246, 236, .86);
  --ink-soft: rgba(255, 246, 236, .55);
  --ink-faint: rgba(255, 246, 236, .22);
  --cool: #9cc0f0;
  --panel: rgba(12, 16, 28, .7);
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #070a12; color: var(--ink); font: 15px/1.45 var(--font); }
a { color: var(--cool); }
button { font: inherit; color: inherit; }

/* ---- a level ---- */
body.level { overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
canvas#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
canvas#view:active { cursor: grabbing; }
canvas#layer, canvas#trails { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }

#back { position: fixed; top: 14px; left: 14px; padding: 6px 12px; border-radius: 999px; background: var(--panel);
        color: var(--ink-soft); text-decoration: none; font-size: 13px; z-index: 3; }
#back:hover, #back:focus-visible { color: var(--ink); }

/* where and when: always on screen */
#where { position: fixed; top: 19px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 300px); text-align: center;
         font-size: 13px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
         text-shadow: 0 1px 6px rgba(0, 0, 0, .9); pointer-events: none; z-index: 2; }
#help { position: fixed; top: 14px; right: 14px; padding: 6px 14px; border: 0; border-radius: 999px; background: var(--panel);
        color: var(--ink-soft); font-size: 13px; cursor: pointer; z-index: 3; }
#help:hover, #help:focus-visible { color: var(--ink); outline: none; }
#help[hidden] { display: none; }

/* the sketch card: a page from a field guide, chalk on dark paper */
#card { position: fixed; top: 56px; left: 14px; width: 190px; padding: 10px 12px 8px; border-radius: 10px;
        background: rgba(16, 20, 32, .78); border: 1px solid rgba(255, 246, 236, .1);
        transition: opacity .8s; z-index: 2; pointer-events: none; }
#card[hidden] { display: block; opacity: 0; }
#card svg { display: block; width: 100%; height: auto; overflow: visible; }
#card .title { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 4px; }
#card .now { font-size: 10px; color: var(--cool); opacity: 0; transition: opacity .6s; margin-top: 2px; }
#card.turned .now { opacity: .8; }

/* the caption: one line at a time, like a subtitle */
#caption { position: fixed; left: 50%; bottom: max(28px, env(safe-area-inset-bottom)); transform: translateX(-50%);
           width: min(620px, calc(100% - 32px)); text-align: center; font-size: 17px; line-height: 1.4;
           text-shadow: 0 1px 8px rgba(0, 0, 0, .9); opacity: 0; transition: opacity .7s; pointer-events: none; z-index: 2; }
#caption.on { opacity: 1; }

/* a star's name, for a moment after a tap */
.tag { position: fixed; transform: translate(14px, -50%); font-size: 13px; color: var(--ink); white-space: nowrap;
       text-shadow: 0 0 6px rgba(0, 0, 0, .8); opacity: 0; transition: opacity .5s; pointer-events: none; z-index: 1; }
.tag.on { opacity: 1; }
.tag small { display: block; font-size: 11px; color: var(--ink-soft); }

/* the first hint: a soft glow at the edge of the screen, or around where to look */
#glow { position: fixed; width: 340px; height: 340px; margin: -170px 0 0 -170px; border-radius: 50%; pointer-events: none;
        background: radial-gradient(closest-side, rgba(156, 192, 240, .16), rgba(156, 192, 240, 0)); opacity: 0; transition: opacity 1.2s; }
#glow.on { opacity: 1; animation: breathe 4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.12); } }

/* passed */
#passed { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(5, 7, 12, .45); opacity: 0;
          transition: opacity 1.2s; pointer-events: none; z-index: 4; }
#passed.on { opacity: 1; pointer-events: auto; }
#passed .box { width: min(400px, calc(100% - 32px)); padding: 26px 24px 22px; border-radius: 14px; text-align: center;
               background: rgba(14, 18, 30, .92); border: 1px solid rgba(255, 246, 236, .1); }
#passed h2 { margin: 0 0 8px; font-weight: 500; font-size: 22px; }
#passed p { margin: 0 0 18px; color: var(--ink-soft); }
.btn { display: inline-block; padding: 9px 18px; margin: 4px; border-radius: 999px; border: 1px solid rgba(156, 192, 240, .5);
       background: rgba(156, 192, 240, .14); color: var(--ink); text-decoration: none; cursor: pointer; }
.btn.quiet { border-color: transparent; background: none; color: var(--ink-soft); }
.btn:hover, .btn:focus-visible { background: rgba(156, 192, 240, .26); outline: none; }

@media (max-width: 760px) {
  #where { top: 54px; left: auto; right: 14px; transform: none; max-width: calc(100% - 180px); white-space: normal;
           text-align: right; font-size: 11px; line-height: 1.35; }
}
@media (max-width: 600px) {
  #card { width: 140px; padding: 8px 9px 6px; top: 52px; }
  #caption { font-size: 15px; }
}

/* ---- the star chart ---- */
body.chart { min-height: 100%; display: flex; flex-direction: column; align-items: center; padding: 28px 16px 40px; }
.chart header { text-align: center; max-width: 560px; }
.chart h1 { margin: 0; font-weight: 400; font-size: 34px; letter-spacing: .04em; }
.chart header p { margin: 6px 0 0; color: var(--ink-soft); }
#map { width: min(720px, 100%); margin-top: 18px; }
#map svg { display: block; width: 100%; height: auto; }
#map .marker { cursor: pointer; }
#map .marker text { font: 13px var(--font); fill: var(--ink); }
#map .marker.soon { cursor: default; }
#map .marker.soon text { fill: var(--ink-soft); }
#map .marker text.state { font-size: 11px; fill: var(--cool); opacity: .75; }
#map .marker.soon text.state { fill: var(--ink-faint); opacity: 1; }
#map .marker:focus-visible { outline: none; }
#map .marker:focus-visible circle.ring, #map .marker:hover circle.ring { stroke-opacity: 1; }
.chart footer { margin-top: 18px; color: var(--ink-faint); font-size: 12px; text-align: center; max-width: 520px; }
.chart footer button { border: 0; background: none; color: var(--ink-soft); text-decoration: underline; cursor: pointer; padding: 0; font-size: 12px; }

/* ---- just looking: the place and time bar ---- */
#bar { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 3;
       display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; padding: 10px 14px;
       width: max-content; max-width: calc(100% - 24px); border-radius: 18px; background: var(--panel); font-size: 13px; }
#bar .field { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); }
#bar input { padding: 5px 10px; border: 1px solid rgba(255, 246, 236, .22); border-radius: 999px; background: rgba(255, 246, 236, .06);
             color: var(--ink); font: inherit; outline: none; color-scheme: dark; }
#bar input:focus { border-color: rgba(156, 192, 240, .7); }
#bar input#place { width: 190px; }
#bar .place { position: relative; }
#suggest { position: absolute; left: 14px; bottom: calc(100% + 6px); min-width: 240px; margin: 0; padding: 6px; list-style: none;
           border-radius: 12px; background: rgba(14, 18, 30, .96); border: 1px solid rgba(255, 246, 236, .12); }
#suggest[hidden] { display: none; }
#suggest li { padding: 7px 10px; border-radius: 8px; cursor: pointer; color: var(--ink); }
#suggest li small { margin-left: 8px; color: var(--ink-soft); font-size: 12px; }
#suggest li[aria-selected=true], #suggest li:hover { background: rgba(156, 192, 240, .2); }
#bar input#place::placeholder { color: var(--ink-soft); }
.pill { border: 0; border-radius: 999px; padding: 6px 11px; background: rgba(255, 246, 236, .08); color: var(--ink-soft); cursor: pointer; font-size: 13px; }
.pill:hover, .pill:focus-visible { color: var(--ink); background: rgba(255, 246, 236, .14); outline: none; }
.pill[aria-pressed=true] { color: var(--ink); background: rgba(156, 192, 240, .24); }
@media (max-width: 600px) {
  #bar .field span { display: none; }
  #bar input#place { width: 150px; }
}
.chart .actions { margin-top: 14px; }
.chart #status { color: var(--ink); margin-top: 10px; }

/* ---- the roof terrace (index.html) ---- */
.corner { position: fixed; top: 14px; z-index: 3; background: var(--panel); }
.corner.left { left: 14px; }
.corner.right { right: 14px; }
body.terrace #bar { top: 52px; bottom: auto; }
body.terrace #bar[hidden] { display: none; }
body.terrace #suggest { top: calc(100% + 6px); bottom: auto; }
#talk { position: fixed; left: 50%; bottom: max(26px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 2;
        width: min(640px, calc(100% - 32px)); display: flex; flex-direction: column; align-items: center; gap: 10px; }
body.terrace #caption { position: static; transform: none; width: auto; }
#choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
#choices:empty { display: none; }
#chartPanel { position: fixed; inset: 0; z-index: 5; display: grid; place-items: start center; overflow-y: auto;
              background: rgba(5, 7, 12, .72); padding: 24px 12px; }
#chartPanel[hidden] { display: none; }
#chartPanel .sheet { position: relative; width: min(760px, 100%); padding: 24px 20px 18px; border-radius: 16px; text-align: center;
                     background: rgba(12, 16, 28, .96); border: 1px solid rgba(255, 246, 236, .1); }
#chartPanel .corner { position: absolute; top: 14px; right: 14px; }
#chartPanel h2 { margin: 0; font-weight: 400; font-size: 24px; }
#chartPanel .intro { margin: 6px auto 0; max-width: 520px; color: var(--ink-soft); }
#chartPanel #status { margin: 10px 0 0; }
#chartPanel #map { margin: 12px auto 0; }
#chartPanel footer { margin-top: 12px; color: var(--ink-faint); font-size: 12px; }
#chartPanel footer button { border: 0; background: none; color: var(--ink-soft); text-decoration: underline; cursor: pointer; padding: 0; font-size: 12px; }
@media (max-width: 760px) {
  body.terrace #where { top: 56px; }
  body.terrace #bar { top: 96px; }
}

/* a caption can be clicked or tapped to move on */
#caption.on { pointer-events: auto; cursor: pointer; }

/* ---- dialogue (dialogue.js): the box at the bottom, the task line at the top ---- */
#dialog { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 4;
          width: min(620px, calc(100% - 24px)); display: flex; gap: 14px; align-items: flex-start; padding: 14px 40px 14px 14px;
          border-radius: 16px; background: rgba(12, 16, 28, .9); border: 1px solid rgba(255, 246, 236, .12); cursor: pointer; }
#dialog[hidden] { display: none; }
#dialog.in { animation: dialogIn .35s ease-out; }
@keyframes dialogIn { from { opacity: 0; transform: translate(-50%, 6px); } }
#dialog .avatar:empty { display: none; }
#dialog .avatar canvas { display: block; border-radius: 50%; }
#dialog .body { flex: 1; min-width: 0; }
#dialog .name { font-size: 12px; letter-spacing: .06em; color: var(--cool); margin-bottom: 3px; }
#dialog .name:empty { display: none; }
#dialog .text { margin: 0; font-size: 16px; line-height: 1.45; }
#dialog.narration .text { font-style: italic; color: rgba(255, 246, 236, .78); }
#dialog .choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
#dialog .choices:empty { display: none; }
#dialog .more { position: absolute; right: 16px; bottom: 12px; color: var(--cool); opacity: .7; font-size: 14px; }
#dialog .more.hidden { display: none; }
#dialog .more.nudge { animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { opacity: .15; transform: translateX(3px); } }
#taskLine { position: fixed; top: 48px; left: 50%; transform: translateX(-50%); z-index: 3; max-width: calc(100% - 24px);
            display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; border-radius: 999px;
            background: rgba(12, 16, 28, .78); border: 1px solid rgba(156, 192, 240, .25); font-size: 14px; }
#taskLine[hidden] { display: none; }
#taskLine .star { color: var(--cool); }
#taskLine .actions { display: flex; gap: 4px; }
#taskLine .actions:empty { display: none; }
#taskLine .actions .pill, #taskLine .actions .btn { margin: 0; padding: 4px 10px; font-size: 13px; }
@media (max-width: 760px) {
  #taskLine { top: 100px; font-size: 13px; }
  #dialog { padding: 12px 34px 12px 12px; gap: 10px; }
  #dialog .text { font-size: 15px; }
}

/* the sketch card sits below the task line */
body.level #card { top: 96px; }
#taskLine .actions .pill { white-space: nowrap; }
@media (max-width: 760px) { body.level #card { top: 142px; } }

/* ---- the almanac (index.html): a paper page ---- */
#almanacPanel { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(5, 7, 12, .6); padding: 16px; }
#almanacPanel[hidden] { display: none; }
#almanacPanel .page { position: relative; width: min(380px, 100%); padding: 26px 24px 20px; border-radius: 6px; text-align: center;
                      background: #efe6d2; color: #3a2b1c; font-family: Georgia, 'Times New Roman', serif;
                      box-shadow: inset 0 0 40px rgba(120, 90, 50, .18); }
#almanacPanel .close { position: absolute; top: 10px; right: 12px; border: 0; background: none; color: #7a6248; font-size: 16px; cursor: pointer; }
#almanacPanel .kicker { margin: 0; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: #8a6f50; }
#almanacPanel h2 { margin: 6px 0 2px; font-weight: 400; font-size: 22px; }
#almanacPanel .where { margin: 0 0 16px; font-size: 13px; color: #7a6248; }
#almanacPanel .sun { display: flex; justify-content: center; gap: 36px; margin: 0; }
#almanacPanel .sun dt { font-size: 13px; color: #7a6248; }
#almanacPanel .sun dd { margin: 2px 0 0; font-size: 30px; font-variant-numeric: tabular-nums; }
#almanacPanel .length { margin: 12px 0 18px; font-size: 14px; font-style: italic; color: #5a4632; min-height: 1.2em; }
#almanacPanel .turn { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
#almanacPanel .turn button, #almanacPanel .today { border: 1px solid rgba(90, 70, 50, .35); background: rgba(255, 255, 255, .35); color: #3a2b1c;
                      border-radius: 999px; padding: 5px 10px; font: 13px var(--font); cursor: pointer; }
#almanacPanel .turn input { border: 1px solid rgba(90, 70, 50, .35); background: rgba(255, 255, 255, .5); color: #3a2b1c; border-radius: 6px;
                            padding: 4px 6px; font: 13px var(--font); color-scheme: light; }
#almanacPanel .today { margin-top: 12px; }

/* ---- your coins (index.html): bottom right, a drawn gold coin and how many ---- */
#purse { position: fixed; right: 16px; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 3; display: flex; align-items: center; gap: 7px;
         padding: 6px 12px 6px 8px; border-radius: 999px; background: var(--panel); font-size: 15px; font-variant-numeric: tabular-nums; }
#purse[hidden] { display: none; }
#purse .coin { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff1b8, #e3b23c 45%, #9a6a12 100%);
               box-shadow: inset 0 0 0 1.5px rgba(120, 80, 10, .6); }
#purse.new { animation: purseIn .9s ease-out; }
@keyframes purseIn { 0% { transform: translateY(8px); opacity: 0; } 60% { transform: translateY(-3px); opacity: 1; } }
@media (max-width: 760px) { #purse { bottom: auto; top: 14px; right: 96px; padding: 4px 10px 4px 6px; } }

#bar [hidden] { display: none; }

/* ---- the astronomer's card (index.html): the same paper as the almanac ---- */
#lessonsPanel { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(5, 7, 12, .6); padding: 16px; }
#lessonsPanel[hidden] { display: none; }
#lessonsPanel .page { position: relative; width: min(480px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 24px 22px 18px;
                      border-radius: 6px; background: #efe6d2; color: #3a2b1c; font-family: Georgia, 'Times New Roman', serif;
                      box-shadow: inset 0 0 40px rgba(120, 90, 50, .18); }
#lessonsPanel .close { position: absolute; top: 10px; right: 12px; border: 0; background: none; color: #7a6248; font-size: 16px; cursor: pointer; }
#lessonsPanel .kicker { margin: 0; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: #8a6f50; text-align: center; }
#lessonsPanel h2 { margin: 6px 0 14px; font-weight: 400; font-size: 22px; text-align: center; }
#lessonList { list-style: none; margin: 0; padding: 0; }
#lessonList li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid rgba(90, 70, 50, .2); }
#lessonList li.learned { opacity: .55; }
#lessonList .what { flex: 1; display: flex; flex-direction: column; gap: 2px; }
#lessonList strong { font-weight: 400; font-size: 17px; }
#lessonList .about { font-size: 13px; color: #5a4632; font-family: var(--font); }
#lessonList .asked { font-size: 12px; color: #8a5a20; font-style: italic; }
#lessonList .asked:empty { display: none; }
#lessonList .do { font: 13px var(--font); color: #7a6248; text-align: right; white-space: nowrap; }
#lessonList .do .pill { background: #3a2b1c; color: #efe6d2; }
#lessonsPanel .note { margin: 12px 0 0; font-size: 13px; font-style: italic; color: #7a6248; text-align: center; }
.pill.quiet { background: none; }

/* the bell under your coins: lets the next visitor in */
#nextVisitor { position: fixed; right: 16px; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 3; width: 40px; height: 40px;
               display: grid; place-items: center; border: 1px solid rgba(156, 192, 240, .3); border-radius: 50%;
               background: var(--panel); color: var(--ink); cursor: pointer; }
#nextVisitor[hidden] { display: none; }
#nextVisitor:hover, #nextVisitor:focus-visible { background: rgba(156, 192, 240, .2); outline: none; }
#purse { bottom: calc(max(18px, env(safe-area-inset-bottom)) + 50px); }
@media (max-width: 760px) { #purse { bottom: auto; } }

/* the time bar sits below the task line, so a task and the clock never cover each other */
body.terrace #bar { top: 96px; }
@media (max-width: 760px) { body.terrace #bar { top: 142px; } }

/* ---- the astronomer's watch (clock.js): a 24-hour dial, bottom left ---- */
.watch { position: fixed; left: 16px; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 3; display: flex; align-items: center; gap: 10px; }
.watch[hidden] { display: none; }
.watch svg { width: 92px; height: 92px; display: block; cursor: grab; touch-action: none; border-radius: 50%; }
.watch svg:active { cursor: grabbing; }
.watch svg:focus-visible { outline: 2px solid var(--cool); outline-offset: 2px; }
.watch .face { fill: rgba(222, 200, 150, .16); stroke: #c9a24e; stroke-width: 2.5; }
.watch .night { fill: rgba(8, 12, 26, .75); }
.watch .ticks line { stroke: rgba(255, 246, 236, .55); stroke-width: 1.2; stroke-linecap: round; }
.watch .num { fill: rgba(255, 246, 236, .7); font: 9px var(--font); text-anchor: middle; dominant-baseline: middle; }
.watch .hand { stroke: #f2d48a; stroke-width: 3; stroke-linecap: round; }
.watch .pin { fill: #c9a24e; }
.watch .read { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 5px 10px; border-radius: 12px; background: var(--panel); }
.watch .hhmm { border: 0; padding: 0; background: none; color: var(--ink); font: 15px var(--font); font-variant-numeric: tabular-nums; cursor: text; }
.watch .hhmm:hover, .watch .hhmm:focus-visible { text-decoration: underline dotted; outline: none; }
.watch .hhmm[hidden], .watch .type[hidden] { display: none; }
.watch .type { width: 64px; padding: 2px 6px; border: 1px solid rgba(156, 192, 240, .6); border-radius: 6px; background: rgba(255, 246, 236, .06);
               color: var(--ink); font: 15px var(--font); font-variant-numeric: tabular-nums; outline: none; }
.watch .type::placeholder { color: var(--ink-faint); }
.watch .type.wrong { animation: typeWrong .3s; border-color: #e0a070; }
@keyframes typeWrong { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.watch .now { border: 0; padding: 0; background: none; color: var(--cool); font: 12px var(--font); cursor: pointer; text-decoration: underline; }
.watch .now[hidden] { display: none; }
.watch.nudged svg { animation: watchNudge 1.2s ease-in-out 2; }
@keyframes watchNudge { 50% { transform: scale(1.12); filter: drop-shadow(0 0 8px rgba(242, 212, 138, .7)); } }


/* what a thing on the table is, while the mouse is over it */
#thingLabel { position: fixed; z-index: 4; padding: 3px 9px; border-radius: 6px; background: rgba(12, 16, 28, .88); color: var(--ink);
              font-size: 13px; pointer-events: none; white-space: nowrap; }
#thingLabel[hidden] { display: none; }
