/* Words sit on chipped slabs of glacier ice. Orange belongs to Oto alone. */
:root {
  --deep: #16414f;      /* water under the glacier: text, page */
  --ice: #dff2f8;       /* a slab in daylight */
  --ice-bright: #f4fbfd;
  --crack: #8cc7d9;     /* edges and quiet lines */
  --shades: #ff7a12;    /* Oto's shades and the lit sign */
  --ember: #9c3b00;     /* orange dark enough to read */
  --quiet: #3d6773;
  --voice: "Arial Rounded MT Bold", "Nunito", ui-rounded, "SF Pro Rounded", "Trebuchet MS", sans-serif;
  --plain: "Trebuchet MS", ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", sans-serif;
  --chip: polygon(7px 0, calc(100% - 4px) 2px, 100% calc(100% - 9px), calc(100% - 8px) 100%, 5px calc(100% - 2px), 0 8px);
  --slab: polygon(16px 0, 62% 3px, calc(100% - 9px) 0, 100% 20px, calc(100% - 3px) 58%, 100% calc(100% - 12px), calc(100% - 20px) 100%, 38% calc(100% - 3px), 9px 100%, 0 calc(100% - 22px), 3px 40%, 0 13px);
  --edge: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { color: var(--deep); font: 17px/1.5 var(--plain); -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; }

/* the sign and the way about */
#top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(14px, env(safe-area-inset-top)) var(--edge) 0; }
#top h1 { line-height: 0; }
.sign { color: var(--shades); display: block; line-height: 0; }
.sign svg { width: 104px; height: auto; }
#top nav { display: flex; gap: 8px; }
.chip { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 16px; border: 0; background: var(--ice); color: var(--deep); clip-path: var(--chip); font-family: var(--voice); font-size: 15px; text-decoration: none; cursor: pointer; }
.chip:hover { background: #fff; }
.chip[aria-expanded="true"] { background: var(--deep); color: var(--ice-bright); }
:focus-visible { outline: 3px solid var(--ember); outline-offset: -5px; }
.sign:focus-visible { outline-color: var(--shades); outline-offset: 4px; }

/* ------------------------------------------------------------ live */
.live { position: fixed; inset: 0; overflow: hidden; background: #24485a; }
#stage { position: absolute; inset: 0; overflow: hidden; }
#world { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; opacity: 0; transition: opacity .9s; }
#world:active { cursor: grabbing; }
.ready #world { opacity: 1; }
.live #top { position: absolute; inset: 0 0 auto; pointer-events: none; z-index: 3; }
.live #top > * { pointer-events: auto; }
.live .sign { filter: drop-shadow(0 0 1px #40150a) drop-shadow(0 1px 8px rgb(60 12 0 / .55)); }
.chip[aria-pressed="true"] { background: var(--shades); color: #230d00; }

#now { position: absolute; left: var(--edge); bottom: max(18px, env(safe-area-inset-bottom)); width: min(460px, calc(100% - 2 * var(--edge))); padding: 18px 26px 20px; background: var(--ice); clip-path: var(--slab); }
#where { color: var(--quiet); font-size: 15px; font-variant-numeric: tabular-nums; }
#told { font: 21px/1.36 var(--voice); text-wrap: pretty; min-height: 1.36em; }
#hint { margin-top: 6px; color: var(--quiet); font-size: 15px; }
#again { display: flex; flex-wrap: wrap; gap: 8px; }
#again .chip { margin-top: 12px; background: var(--deep); color: var(--ice-bright); }
#again .chip:hover { background: #0d2d38; }
#again #back { background: var(--shades); color: #230d00; }
#lost { position: absolute; top: 84px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 8px 18px; background: var(--deep); color: var(--ice-bright); clip-path: var(--chip); font-size: 15px; }

.bubble { position: absolute; left: 0; top: 0; max-width: min(290px, 74vw); padding: 10px 18px 12px; font: 17px/1.34 var(--voice); text-align: center; text-wrap: balance; pointer-events: none; clip-path: var(--slab); will-change: transform; }
.says { background: var(--shades); color: #230d00; }
.thinks { background: var(--ice-bright); color: var(--ember); }
.guest { background: #d9ccff; color: #2a1a5c; font-family: var(--plain); }
.other { background: var(--deep); color: var(--ice-bright); font-family: var(--plain); }

/* the brain sits in dark meltwater, so its lights can glow */
.plainbutton { min-height: 40px; padding: 4px 10px; border: 0; background: none; color: var(--crack); font: 15px/1.2 var(--voice); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.plainbutton:hover { color: #fff; }
#brain { position: absolute; z-index: 2; top: 76px; right: var(--edge); width: 340px; display: none; padding: 10px 14px 10px 18px; background: #06181f; color: var(--ice); clip-path: var(--slab); }
#brain.open { display: flex; flex-direction: column; }
#brain :focus-visible { outline-color: var(--shades); }
#brain .head { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 10px; }
#brain h2 { font-size: 18px; color: var(--ice-bright); white-space: nowrap; }
#counts { font-size: 14px; color: var(--crack); font-variant-numeric: tabular-nums; }
#brain .ice { position: relative; flex: 1; min-height: 0; }
#brainView { display: block; width: 100%; height: 224px; touch-action: none; cursor: grab; }
#cell { position: absolute; left: 0; top: 0; max-width: 250px; padding: 6px 12px; background: var(--ice-bright); color: var(--deep); font-size: 14.5px; line-height: 1.3; clip-path: var(--chip); pointer-events: none; }
#partList { position: absolute; left: 0; top: 0; bottom: 0; width: min(340px, 100%); display: flex; flex-direction: column; padding: 10px 14px; background: rgba(6, 24, 31, .92); }
#partList[hidden] { display: none; }
#partList .head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
#partList h3 { font: 18px var(--voice); color: var(--ice-bright); }
#partList ul { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; margin: 6px 0 0; padding: 0; }
#partList li button { width: 100%; padding: 6px 2px; border: 0; border-bottom: 1px solid rgba(185, 220, 231, .15); background: none; color: var(--ice); font: 15px/1.35 var(--plain); text-align: left; cursor: pointer; }
#partList li button:hover { color: #fff; }
#parts { display: none; list-style: none; padding: 0; }
#parts button { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 4px 10px; border: 0; background: none; color: var(--ice); font: 16px var(--voice); cursor: pointer; text-align: left; }
#parts button:hover { color: #fff; }
#parts i { width: 13px; height: 13px; background: var(--part); clip-path: polygon(30% 0, 100% 12%, 82% 100%, 0 78%); }
#parts span { color: var(--crack); font: 15px var(--plain); font-variant-numeric: tabular-nums; }
#parts .frozen i { background: #b9dce7; opacity: .5; }
.grow { display: flex; align-items: center; gap: 6px; }
.grow .plainbutton { padding-left: 0; white-space: nowrap; }
#growth { flex: 1; min-width: 0; height: 40px; accent-color: var(--shades); cursor: pointer; }
#brain.large { inset: 70px var(--edge) 16px; width: auto; padding: 20px 28px; z-index: 4; }
#brain.large h2 { font-size: 30px; }
#brain.large #counts { font-size: 17px; }
#brain.large #brainView { height: 100%; }
#brain.large #parts { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 12px; }

#suggest { position: absolute; z-index: 7; top: 76px; left: 50%; transform: translateX(-50%); width: min(520px, calc(100% - 20px)); max-height: calc(100% - 92px); overflow-y: auto; overscroll-behavior: contain; padding: 20px 26px 24px; background: var(--ice-bright); clip-path: var(--slab); }
#suggest .head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
#suggest h2 { font: 22px/1.25 var(--voice); }
#suggest h3 { margin: 22px 0 4px; font: 18px/1.3 var(--voice); }
#suggest .plainbutton, #suggest .plainbutton:hover { color: var(--deep); }
#suggest fieldset { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 10px; padding: 0; border: 0; }
#suggest fieldset label { position: relative; }
#suggest fieldset input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
#suggest fieldset span { display: grid; place-items: center; min-height: 46px; background: var(--ice); font-family: var(--voice); clip-path: var(--chip); }
#suggest fieldset input:checked + span { background: var(--shades); color: #230d00; }
#suggest fieldset input:focus-visible + span { outline: 3px solid var(--ember); outline-offset: -5px; }
#suggest .send { display: flex; gap: 8px; margin-bottom: 8px; }
#words { flex: 1; min-width: 0; min-height: 46px; padding: 8px 14px; border: 2px solid var(--quiet); background: #fff; color: var(--deep); font: 17px var(--plain); }
#words::placeholder { color: #5d7f89; }
#words:focus-visible { outline-offset: 0; }
#suggest .chip { background: var(--deep); color: var(--ice-bright); }
#carried { font-size: 15px; color: var(--quiet); }
#onTheWay { list-style: none; padding: 0; }
#onTheWay li { padding: 5px 0; }
#thoughts { list-style: none; padding: 0; }
#thoughts li { padding: 12px 0; border-top: 2px solid var(--ice); }
#thoughts .top { display: flex; justify-content: space-between; gap: 14px; font: 17px/1.35 var(--voice); }
#thoughts .small, #thoughts a { color: var(--quiet); font-size: 14.5px; }
#thoughts .answer { margin: 4px 0; font-size: 16px; line-height: 1.45; }
#thoughts .answer b, #thoughts .quote b { font-family: var(--voice); font-weight: 400; color: var(--deep); }
#thoughts .quote { margin: 2px 0; font: 17px/1.4 var(--voice); color: var(--ember); }
#log { position: absolute; inset: 0 0 0 auto; width: 400px; display: flex; flex-direction: column; background: var(--ice-bright); z-index: 6; clip-path: polygon(9px 0, 100% 0, 100% 100%, 5px 100%, 0 83%, 8px 61%, 1px 37%, 9px 18%); }
#log .head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 8px 30px; }
#day { min-height: 44px; max-width: 200px; padding: 6px 10px; border: 2px solid var(--crack); background: #fff; color: var(--deep); font: 16px var(--voice); }
#log a { color: var(--deep); text-underline-offset: 3px; }
#log [role=tablist] { display: grid; grid-template-columns: repeat(5, auto); justify-content: space-between; padding: 0 16px 0 24px; border-bottom: 3px solid var(--ice); }
#log [role=tab] { min-height: 44px; padding: 4px 6px; border: 0; border-bottom: 5px solid transparent; background: none; color: var(--quiet); font: 15px var(--voice); cursor: pointer; text-align: left; }
#log [role=tab]:hover { color: var(--deep); }
#log [aria-selected=true] { color: var(--deep); border-bottom-color: var(--shades); }
#log .scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 20px 30px 30px; }
#nothing { padding: 18px 0; }
#moments { list-style: none; padding: 0; }
#moments li { padding: 12px 0; border-bottom: 2px solid var(--ice); }
#moments .current { margin: 0 -20px 0 -30px; padding: 12px 20px 12px 30px; background: var(--ice); }
#moments time { display: block; color: var(--quiet); font-size: 14px; font-variant-numeric: tabular-nums; }
.watch { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; line-height: 1.45; }
.watch:hover .told, .watch:hover .quote { text-decoration: underline; text-decoration-color: var(--crack); text-underline-offset: 4px; }
.quote { font: 18px/1.4 var(--voice); color: var(--ember); }
#moments p { margin-top: 5px; padding-left: 14px; font-size: 16px; line-height: 1.42; }
#moments b { font-family: var(--voice); font-weight: 400; }
#moments .thought, #moments .thought b { color: var(--ember); }
#moments .new { margin-left: 14px; padding: 5px 12px; width: fit-content; background: var(--shades); color: #230d00; font-family: var(--voice); font-size: 15px; clip-path: var(--chip); }
/* what Oto made */
#moments h3 { font: 18px/1.3 var(--voice); }
#moments h4 { margin: 12px 0 2px; color: var(--quiet); font: 15px var(--voice); }
#moments .small { padding: 0; color: var(--quiet); font-size: 14.5px; }
#moments .page { padding: 0; font-size: 17px; line-height: 1.55; }
#moments .quote { margin-top: 4px; padding: 0; font: 17px/1.4 var(--voice); color: var(--ember); }
#moments .answer { padding: 0; }
#moments summary { font: 18px/1.3 var(--voice); min-height: 44px; display: flex; align-items: center; cursor: pointer; text-decoration: underline; text-decoration-color: var(--crack); text-underline-offset: 4px; }
#moments canvas { display: block; width: 100%; aspect-ratio: 480 / 346; margin-bottom: 8px; clip-path: var(--slab); }
#moments .chip { background: var(--deep); color: var(--ice-bright); }
.song { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; }
#moments .score { font: 17px var(--voice); font-variant-numeric: tabular-nums; }
#moments .bar { display: block; height: 12px; background: var(--ice); clip-path: polygon(3px 0, 100% 2px, calc(100% - 4px) 100%, 0 calc(100% - 2px)); }
#moments .bar span { display: block; height: 100%; background: var(--shades); }
#moments .like { display: grid; grid-template-columns: 1fr 5.4em; gap: 2px 14px; align-items: center; }
#moments .like h3, #moments .like .small { margin: 0; }
#moments .like .bar { grid-row: 2; }
#moments .like .score { grid-area: 2 / 2; text-align: right; }
#moments .like .small { grid-area: 1 / 2; text-align: right; }
#listen { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
#listen .chip { flex: none; background: var(--shades); color: #230d00; }
#listen p { font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
#listen a { color: var(--quiet); }
.hide { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (min-width: 1020px) { #stage { right: 391px; } .phone { display: none; } }
@media (min-width: 1020px) and (max-width: 1299.9px) { #brain:not(.large) { width: 270px; } #brain:not(.large) #brainView { height: 170px; } }

/* ------------------------------------------------------------ the notebook */
.notebook { background: var(--deep); color: var(--ice); min-height: 100vh; }
.notebook main { max-width: 1060px; margin: 0 auto; padding: 34px var(--edge) 80px; }
.notebook h1 { font: clamp(38px, 7vw, 68px)/1.04 var(--voice); color: var(--ice-bright); }
#intro { max-width: 62ch; margin-top: 16px; font-size: 19px; }
.notebook h2 { margin: 54px 0 18px; color: var(--ice-bright); }
.none { color: var(--crack); }
.slabs { list-style: none; padding: 0; columns: 310px; column-gap: 18px; }
.slabs li { break-inside: avoid; margin-bottom: 18px; padding: 20px 24px 20px; background: var(--ice); color: var(--deep); clip-path: var(--slab); }
.slabs .guess { background: #b9dce7; }
.slabs .sure { background: var(--ice-bright); }
.slabs h3 { font: 20px/1.25 var(--voice); }
.noname, .source { color: var(--quiet); font-size: 14.5px; }
.guess .noname, .guess .source { color: #2a5360; }
.belief { margin: 8px 0; font: 18px/1.36 var(--voice); color: var(--ember); }
.guess .belief { color: #7c2f00; }
.before { margin-top: 8px; color: var(--quiet); }
#skills, #always { list-style: none; padding: 0; }
#skills li { display: grid; grid-template-columns: 170px 1fr 210px; gap: 6px 18px; align-items: center; padding: 9px 0; }
#skills .name { font-family: var(--voice); }
#skills .bar { height: 14px; background: #0d2d38; clip-path: polygon(3px 0, 100% 2px, calc(100% - 4px) 100%, 0 calc(100% - 2px)); }
#skills .bar span { display: block; height: 100%; background: var(--shades); }
#skills .score { color: var(--crack); font-size: 15px; font-variant-numeric: tabular-nums; }
#always { columns: 300px; column-gap: 30px; }
#always li { break-inside: avoid; padding: 5px 0; }
.plain { position: fixed; inset: auto 0 40% 0; text-align: center; padding: 20px; background: var(--ice); color: var(--deep); }

/* ------------------------------------------------------------ the owner's page */
.watchers { margin-top: 30px; font: 24px/1.2 var(--voice); }
.watchers strong { margin-right: 10px; color: var(--shades); font-size: clamp(84px, 18vw, 150px); font-weight: 400; line-height: 1; font-variant-numeric: tabular-nums; }
#chart { display: block; width: 100%; height: auto; }
#chart text { fill: var(--crack); font: 15px var(--plain); }
#chart .grid { stroke: #2a5d6c; stroke-width: 1; }
#chart .line { fill: none; stroke: var(--shades); stroke-width: 2.5; stroke-linejoin: round; }
#chart .under { fill: var(--shades); opacity: .18; }
#days, #running { list-style: none; padding: 0; }
#days li { display: grid; grid-template-columns: 130px 1fr 110px; gap: 16px; align-items: center; padding: 7px 0; }
#days .bar { height: 14px; background: #0d2d38; }
#days .bar span { display: block; height: 100%; background: var(--shades); }
#days .score { color: var(--crack); font-variant-numeric: tabular-nums; }
#running li { padding: 5px 0; }

/* ------------------------------------------------------------ phones */
@media (max-width: 1019.9px) {
  #log { inset: auto 0 0 0; width: 100%; height: 72%; visibility: hidden; transform: translateY(102%); transition: transform .28s, visibility 0s .28s; clip-path: polygon(0 12px, 22% 2px, 47% 10px, 71% 0, 100% 9px, 100% 100%, 0 100%); }
  #log.open { visibility: visible; transform: none; transition: transform .28s; }
  #log .head { padding: 22px 18px 6px; }
  #log [role=tablist] { padding: 0 10px; }
  #log .scroll { padding: 0 18px calc(24px + env(safe-area-inset-bottom)); }
  #moments .current { margin: 0 -18px; padding: 12px 18px; }
  #log .chip { background: var(--deep); color: var(--ice-bright); }
  #day { max-width: 42vw; }
}
@media (max-width: 720px) {
  .sign svg { width: 70px; }
  .chip { padding: 6px 12px; font-size: 14.5px; }
  .live #top { gap: 8px; padding-inline: 10px; }
  .live #top nav { gap: 6px; }
  .live #top .chip { padding: 6px 9px; }
  #now { left: 10px; width: calc(100% - 20px); padding: 14px 22px 16px; }
  #told { font-size: 18.5px; }
  .bubble { font-size: 16px; padding: 8px 15px 10px; }
  #brain.large { inset: 70px 8px 10px; padding: 14px 18px 12px; }
  #brain.large h2 { font-size: 22px; }
  #brain.large #counts { font-size: 14.5px; }
  #brain.large #parts { display: grid; grid-template-columns: 1fr 1fr; }
  #skills li { grid-template-columns: 1fr auto; }
  #skills .bar { grid-column: 1 / -1; order: 3; }
}
@media (max-width: 350px) { #top { flex-wrap: wrap; } }
@media (max-height: 460px) and (min-width: 560px) {
  #now { width: min(380px, 50%); padding: 10px 20px 12px; }
  #told { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) { #world, #log { transition: none !important; } }
