:root { --hand: "Chalkboard SE", "Comic Sans MS", "Comic Neue", "Marker Felt", cursive; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #fffdf8; }
body { font-family: var(--hand); color: #000; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }
#hud { position: fixed; top: 14px; left: 18px; pointer-events: none; }
h1 { margin: 0; font-size: 26px; line-height: 1; letter-spacing: .5px; }
#stats { margin-top: 6px; font-size: 14px; opacity: .75; }
#log { position: fixed; left: 18px; bottom: 14px; font-size: 15px; pointer-events: none; opacity: 0; transition: opacity 1.2s; max-width: calc(100vw - 140px); }
#log.on { opacity: .85; transition: opacity .25s; }
#hint { position: fixed; left: 0; right: 0; bottom: 44px; text-align: center; font-size: 15px; pointer-events: none; opacity: .7; transition: opacity 2s; padding: 0 16px; }
#hint.off { opacity: 0; }
button { font: 13px var(--hand); background: none; border: 2.5px solid #000; border-radius: 14px 11px 15px 10px; padding: 3px 10px 4px; cursor: pointer; opacity: .35; color: #000; }
button:hover, button:focus-visible { opacity: 1; background: #ffe66d; }
#reset { position: fixed; right: 14px; bottom: 12px; }
#reset.armed { opacity: 1; background: #ffab76; }
#radio { position: fixed; right: 14px; bottom: 46px; display: flex; gap: 6px; }
#radio-toggle.on { opacity: 1; background: #ff8fc7; }

#journal-btn { position: fixed; right: 14px; bottom: 80px; }
#journal-btn.new { opacity: 1; background: #a8dcf5; }
#journal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(620px, calc(100vw - 24px)); max-height: min(78vh, 720px); display: flex; flex-direction: column; background: #fffdf8; border: 3px solid #000; border-radius: 22px 16px 24px 14px; box-shadow: 5px 6px 0 rgba(0, 0, 0, .15); -webkit-user-select: text; user-select: text; }
#journal[hidden] { display: none; }
#journal .tabs { display: flex; gap: 8px; padding: 12px 14px 10px; border-bottom: 2.5px solid #000; }
#journal button { opacity: 1; font-size: 15px; }
#journal button.sel { background: #ffe66d; }
#journal-close { margin-left: auto; }
#journal-body { overflow-y: auto; padding: 4px 16px 16px; font-size: 15px; line-height: 1.4; }
#journal .lede { opacity: .75; }
#journal h3 { margin: 0 0 2px; font-size: 17px; }
#journal h3.day { margin: 16px 0 4px; }
#journal ul { margin: 0; padding-left: 20px; }
#journal li { margin: 3px 0; }
#journal .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
#journal .card { border: 2.5px solid #000; border-radius: 14px 18px 12px 16px; padding: 8px 10px 10px; background: #fff; }
#journal .card canvas { display: block; margin: 0 auto 4px; }
#journal .card p { margin: 4px 0 0; }
#journal .card .meta { opacity: .65; font-size: 13px; }
#journal .card.unseen { border-style: dashed; background: none; }

h1 { pointer-events: auto; cursor: pointer; }
#version { display: none; margin-top: 3px; font-size: 12px; opacity: .45; pointer-events: auto; }
#version.show, #version.stale { display: block; }   /* click the title to see it; it also appears by itself when out of date */
#version.stale { opacity: 1; }
#version a { color: inherit; background: #ffe66d; border: 2px solid #000; border-radius: 10px 8px 11px 7px; padding: 0 7px 1px; text-decoration: none; cursor: pointer; }

#sound-btn { position: fixed; right: 14px; bottom: 114px; }
#sound-btn.off { text-decoration: line-through; }
#journal .song { display: flex; align-items: center; gap: 10px; border: 2.5px solid #000; border-radius: 14px 18px 12px 16px; padding: 8px 12px; margin: 8px 0; background: #fff; }
#journal .song h3 { margin: 0; }
#journal .song .meta { margin: 2px 0 0; opacity: .65; font-size: 13px; }
#journal .song button { margin-left: auto; white-space: nowrap; }

#journal .playbill { border: 2.5px solid #000; border-radius: 16px 12px 18px 14px; padding: 8px 12px 10px; margin: 8px 0; background: #fff; }
#journal .playbill h3 { margin: 0; }
#journal .playbill ul { margin: 6px 0; }
#journal .playbill p { margin: 4px 0 0; }

#journal .photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
#journal .photos img { width: min(250px, 100%); border: 2.5px solid #000; border-radius: 10px 13px 9px 12px; display: block; }

#share-btn { position: fixed; right: 14px; bottom: 148px; }
#visiting { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); font-size: 14px; background: #fffdf8; border: 2.5px solid #000; border-radius: 14px 11px 15px 10px; padding: 4px 8px 5px 12px; white-space: nowrap; }
#visiting[hidden] { display: none; }
#visiting button { opacity: 1; background: #ffe66d; margin-left: 6px; }
body.visiting #reset, body.visiting #share-btn { display: none; }
@media (max-width: 560px) { #visiting { top: auto; bottom: 74px; } }

#towns-btn { position: fixed; right: 14px; bottom: 182px; }
#dialog { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 24px)); max-height: min(78vh, 680px); display: flex; flex-direction: column; background: #fffdf8; border: 3px solid #000; border-radius: 22px 16px 24px 14px; box-shadow: 5px 6px 0 rgba(0, 0, 0, .15); z-index: 5; }
#dialog[hidden] { display: none; }
#dialog .tabs { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 2.5px solid #000; }
#dialog h3 { margin: 0; font-size: 18px; }
#dialog-close { margin-left: auto; }
#dialog button { opacity: 1; font-size: 15px; }
#dialog-body { overflow-y: auto; padding: 4px 16px 16px; font-size: 15px; line-height: 1.4; }
#dialog .lede { opacity: .75; }
#dialog .names { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 10px 0 14px; }
#dialog .names button { padding: 6px 8px 7px; background: #fff; }
#dialog .names button:hover, #dialog .names button:focus-visible { background: #ffe66d; }
#dialog .town { display: flex; align-items: center; gap: 10px; border: 2.5px solid #000; border-radius: 14px 18px 12px 16px; padding: 8px 12px; margin: 8px 0; background: #fff; }
#dialog .town div { flex: 1; min-width: 0; }
#dialog .town h4 { margin: 0; font-size: 17px; }
#dialog .town p, #dialog .meta { margin: 2px 0 0; opacity: .65; font-size: 13px; }
#dialog .town button, #dialog .row button { background: #ffe66d; }
#dialog .row { display: flex; gap: 8px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
#dialog input { flex: 1; min-width: 180px; font: 14px var(--hand); border: 2.5px solid #000; border-radius: 10px; padding: 5px 8px; background: #fff; }
#dialog .google { min-height: 44px; margin: 12px 0; }
body.visiting #towns-btn { bottom: 148px; }

#splash { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255, 253, 248, .72); z-index: 4; padding: 16px; }
#splash[hidden] { display: none; }
#splash .card { width: min(420px, 100%); text-align: center; background: #fffdf8; border: 3px solid #000; border-radius: 26px 18px 28px 16px; box-shadow: 6px 7px 0 rgba(0, 0, 0, .15); padding: 20px 22px 24px; }
#splash img { display: block; margin: 0 auto 4px; }
#splash h2 { margin: 0; font-size: 38px; letter-spacing: 1px; }
#splash p { font-size: 16px; line-height: 1.4; margin: 10px 0 18px; }
#splash button { display: block; width: 100%; opacity: 1; font-size: 19px; padding: 9px 12px 10px; margin-top: 10px; background: #fff; }
#splash #splash-new { background: #ffe66d; }
#splash button:hover, #splash button:focus-visible { background: #ffd23f; }
body.splash #hud, body.splash #hint, body.splash #log, body.splash > button, body.splash #radio { display: none; }
