:root {
  --ink: #090b10;
  --panel: #10131a;
  --hairline: rgb(255 255 255 / 0.08);
  --label: rgb(255 255 255 / 0.42);
  --text: rgb(255 255 255 / 0.88);
  --sun: #ffb847;
  --now: #73d9f2;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC",
          "PingFang TC", "Microsoft JhengHei", sans-serif;
}

:root:lang(zh-Hans) {
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
:root:lang(ja) {
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
          "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif;
}

* { box-sizing: border-box; }

html {
  height: 100%;
  background: var(--ink);
}

body {
  margin: 0;
  /* Not `height: 100%`: on a phone the panels are taller than the viewport and
     a fixed height clips them instead of letting the page scroll. */
  min-height: 100%;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  padding: 18px 20px 14px;
  gap: 14px;
  /* Tinted from the top by whatever light there is right now; app.js sets it. */
  background-image: linear-gradient(to bottom, var(--sky, transparent) 0%, transparent 46%);
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dim { color: var(--label); }

/* ---- header ---- */

.bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.wordmark strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.24em;
}
.wordmark span {
  display: block;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--label);
}

.field { display: inline-flex; align-items: center; gap: 5px; color: var(--text); }
.pin { width: 14px; height: 14px; opacity: 0.7; }

select, button, input { font: inherit; color: inherit; }

select {
  background: transparent;
  border: 0;
  padding: 3px 2px;
  border-radius: 6px;
  cursor: pointer;
}
select option { background: #15181f; }

.ghost {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 4px 9px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.ghost:hover { background: rgb(255 255 255 / 0.07); }
.ghost:focus-visible { outline: 2px solid var(--now); outline-offset: 1px; }

.stepper { display: inline-flex; align-items: center; gap: 2px; }
.stepper .mono { min-width: 15.5em; text-align: center; font-size: 12px; }

.spacer { flex: 1 1 auto; }
.clock { font-size: 20px; font-weight: 300; letter-spacing: 0.04em; }

.tabs {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  background: rgb(255 255 255 / 0.06);
  border-radius: 9px;
}
.tabs button {
  background: transparent;
  border: 0;
  border-radius: 7px;
  padding: 4px 12px;
  cursor: pointer;
  color: var(--label);
}
.tabs button.on { background: rgb(255 255 255 / 0.14); color: var(--text); }

.sound { display: inline-flex; align-items: center; gap: 6px; border-color: var(--hairline); }
.sound[aria-pressed="true"] { color: var(--sun); border-color: rgb(255 184 71 / 0.45); }
.sound .glyph { font-size: 13px; }
.sound[hidden] { display: none; }

.lang { display: inline-flex; align-items: center; gap: 4px; color: var(--label); }
.lang svg { width: 13px; height: 13px; flex: none; }
.lang select { font-size: 12px; color: var(--label); padding: 3px 0; }
.lang select:hover, .lang select:focus-visible { color: var(--text); }
.lang select:focus-visible { outline: 2px solid var(--now); outline-offset: 1px; }

/* ---- panels ---- */

main { flex: 1 1 auto; min-height: 0; display: flex; }
.panel { display: none; flex: 1 1 auto; min-height: 0; flex-direction: column; gap: 10px; }
.panel.on { display: flex; }

.split { display: flex; gap: 22px; flex: 1 1 auto; min-height: 0; }
.stage { flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.stage canvas { flex: 1 1 auto; width: 100%; min-height: 0; }
.stage canvas.strip { flex: 0 0 34px; height: 34px; min-height: 34px; border-radius: 6px; }
.caption { margin: 0; font-size: 10px; color: var(--label); }

.readouts { flex: 0 0 322px; display: flex; flex-direction: column; gap: 10px; overflow: auto; }

.card {
  padding: 13px 14px;
  background: rgb(16 19 26 / 0.7);
  border: 1px solid var(--hairline);
  border-radius: 10px;
}
.card h3 {
  margin: 0 0 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--label);
}
.row { display: flex; align-items: baseline; gap: 12px; padding: 2px 0; }
.row .k { font-size: 11px; color: var(--label); }
.row .v { margin-left: auto; text-align: right; font-family: var(--mono); font-size: 14px; }
.row .v.big { font-size: 23px; font-weight: 300; }
.row .d { font-size: 10px; color: var(--label); }
.card > .d { font-size: 11px; line-height: 1.5; color: var(--label); }
.row.sun .v { color: var(--sun); }
.row.blue .v { color: #8cb3f2; }
.pair { display: flex; gap: 16px; }
.pair .row { flex: 1 1 0; }
.hr { height: 1px; background: var(--hairline); margin: 6px 0; }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.shadow { display: flex; align-items: center; gap: 12px; padding-top: 6px; }
.shadow canvas { flex: 0 0 74px; width: 74px; height: 74px; }

/* ---- year ---- */

.head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.head h2 { margin: 0; font-size: 17px; font-weight: 300; }
.stats { font-size: 11px; color: var(--label); display: flex; gap: 16px; flex-wrap: wrap; }
.stats b { color: var(--sun); font-weight: 400; }

.mapwrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  overflow: hidden;
}
.mapwrap canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }

.progress {
  position: absolute; inset: auto 0 0 0; height: 2px;
  background: rgb(255 255 255 / 0.08);
}
.progress span { display: block; height: 100%; width: 0; background: var(--sun); transition: width 0.1s linear; }
.progress[hidden] { display: none; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 10px; color: var(--label); }
.legend i { width: 22px; height: 10px; border-radius: 2px; display: inline-block; border: 1px solid var(--hairline); margin-right: 5px; vertical-align: -1px; }

/* ---- analemma ---- */

.panel[data-panel="analemma"] canvas {
  flex: 1 1 auto; width: 100%; min-height: 0;
  background: rgb(16 19 26 / 0.5);
  border: 1px solid var(--hairline);
  border-radius: 8px;
}
input[type="range"] { width: 210px; accent-color: var(--sun); }

/* ---- terms ---- */

.split.terms .stage { flex: 0 0 420px; }
.split.terms .stage canvas { flex: 0 0 400px; height: 400px; }
.next { text-align: center; }
.next .k { font-size: 10px; color: var(--label); }
.next .n { font-size: 26px; font-weight: 300; color: var(--sun); }
.next .t { font-family: var(--mono); font-size: 12px; }
.next .c { font-size: 11px; color: var(--label); }

.grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  align-content: center;
  overflow: auto;
}
.term {
  padding: 9px;
  background: rgb(16 19 26 / 0.55);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}
.term.next { background: var(--panel); border-color: rgb(255 184 71 / 0.6); }
.term .n { font-size: 14px; }
.term.next .n { color: var(--sun); }
.term .lam { float: right; font-family: var(--mono); font-size: 9px; color: rgb(255 255 255 / 0.3); }
.term .t { display: block; font-family: var(--mono); font-size: 11px; color: var(--label); margin-top: 2px; }

/* ---- footer ---- */

.foot { display: flex; flex-direction: column; gap: 2px; font-size: 10px; color: var(--label); }

/* ---- narrow ---- */

@media (max-width: 1080px) {
  body { padding: 14px 16px 12px; }
  .split, .split.terms { flex-direction: column; }
  .readouts { flex: 0 0 auto; overflow: visible; }
  .mapwrap { min-height: 420px; }
  .panel[data-panel="analemma"] canvas { min-height: 420px; }
  .split.terms .stage { flex: 0 0 auto; }
  .split.terms .stage canvas { flex: 0 0 320px; height: 320px; }
  .stage canvas { min-height: 340px; }
  .stage canvas.strip { min-height: 34px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .clock { font-size: 16px; }
  .stepper .mono { min-width: 12em; }
}

@media (max-width: 620px) {
  .grid { grid-template-columns: 1fr; }
  .sound .word { display: none; }
  .wordmark span { display: none; }
}

/* Back to the UTUVO Experimental hub (only shown when hosted there). */
.home { color: inherit; opacity: .72; text-decoration: none; font-size: 12px; letter-spacing: .08em; white-space: nowrap; }
.home:hover { opacity: 1; }
.home:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
@media (max-width: 720px) { .home-exp { display: none; } }
/* The hub link takes the tagline's room so the header stays on one row. */
.hosted .wordmark span { display: none; }
