/*
  Marea web. The family base (colours, corners, type stacks) comes from familia.css, loaded first;
  this file uses its tokens (var(--ec-...)) and adds only what is Marea's.
  Rules: 3px corners, fewer lines, DM Sans for words, IBM Plex Mono for every number,
  light preferred, dark is the same page inverted.
*/

/* Fonts: bundled, no outside requests. DM Sans Display is the cut used from 26px up. */
@font-face { font-family: "DM Sans"; src: url("fonts/DMSans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("fonts/DMSans-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("fonts/DMSans-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("fonts/DMSans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "DM Sans Display"; src: url("fonts/DMSans-Display.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "DM Sans Display"; src: url("fonts/DMSans-DisplaySemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-Light.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }

/*
  Marea has no accent of its own: the colour is the person's (moods and events).
  A mood is a tint of its colour over the page; an event is the full colour as a border.
*/
:root {
  --tint: var(--tint-l, 46%);   /* how much of a mood's colour goes into the day; each theme sets its own */
  --edge-w: 2.5px;      /* event border */
  --empty: var(--ec-soft);
  --cell-gap: 2px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --tint: var(--tint-d, 58%); } }
:root[data-theme="dark"] { --tint: var(--tint-d, 58%); }

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0; background: var(--ec-bg); color: var(--ec-ink);
  font-family: var(--ec-sans); font-size: 15px; line-height: 1.3;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:active { opacity: .6; }
:focus-visible { outline: 2px solid var(--ec-ink); outline-offset: 2px; }
p, h1, h2, h3, ul { margin: 0; }
ul { padding: 0; list-style: none; }
[hidden] { display: none !important; }
.mono { font-family: var(--ec-mono); }
.label { font: 700 13px/1.2 var(--ec-sans); letter-spacing: .6px; text-transform: uppercase; color: var(--ec-muted); }

/* Seal: ink with the drawing in paper; inverted in dark, with the drawing a touch thicker (+1.18). */
.mark { width: 30px; height: 29px; flex: 0 0 auto; --seal-b: var(--ec-ink); --seal-d: var(--ec-bg); --seal-x: 0; }
.seal-b { fill: var(--seal-b); }
.seal-d { fill: var(--seal-d); stroke: var(--seal-d); stroke-width: var(--seal-x); }
.seal-r { stroke: var(--seal-d); stroke-width: calc(9px + var(--seal-x) * 1px); stroke-linecap: round; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mark { --seal-x: 1.18; } }
:root[data-theme="dark"] .mark { --seal-x: 1.18; }

/* Small square icon buttons (arrows, close): just the drawing, no frame. */
.iconbtn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0;
  border: 0; border-radius: var(--ec-radius); background: transparent; color: var(--ec-ink);
}
.iconbtn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: square; }
@media (hover: hover) { .iconbtn:hover { background: var(--ec-soft); } }
.iconbtn:disabled { opacity: .25; cursor: default; background: none; }
.iconbtn.sm { width: 32px; height: 32px; }

.link {
  padding: 0; border: 0; background: none; color: var(--ec-ink);
  font: 700 12.5px/1.2 var(--ec-sans); letter-spacing: .6px; text-transform: uppercase;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px;
}
.link.danger { color: var(--ec-danger); }
.link:disabled { color: var(--ec-muted); text-decoration: none; cursor: default; }

.btn {
  height: 56px; padding: 0 20px; border-radius: var(--ec-radius);
  font: 700 15px/1 var(--ec-sans); letter-spacing: .8px; text-transform: uppercase;
}
.btn-ink { border: 0; background: var(--ec-ink); color: var(--ec-on-ink); }
.btn-line { border: 2px solid var(--ec-ink); background: transparent; color: var(--ec-ink); }
.btn-sm { height: 42px; padding: 0 16px; font-size: 13px; letter-spacing: .6px; }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- Layout ----------
   Phone: one direction at a time. The page scrolls down (the month names stay on top, the panel comes after day 31);
   the year scrolls sideways in its own strip (the day numbers stay at the left).
   From 900px: the whole year fits the screen, with the key in a grey panel on the right. */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.main { display: flex; flex-direction: column; min-width: 0; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(12px + env(safe-area-inset-top)) var(--ec-gutter) 10px;
}
.brand { display: flex; align-items: center; gap: 11px; font: 400 26px/1 var(--ec-display); letter-spacing: .35px; }
.topright { display: flex; align-items: center; gap: 10px; }
.year { display: flex; align-items: center; gap: 2px; }

/* The panel button: only on the computer, where the panel sits beside the year. */
.panelbtn { display: none; }
.panelbtn svg { width: 16px; height: 16px; stroke-width: 1.6; stroke-linecap: round; }
.panelbtn .pb-fill { fill: currentColor; stroke: none; }
.panel-closed .panelbtn .pb-fill { display: none; }
.yearnum { min-width: 64px; text-align: center; font: 400 22px/1 var(--ec-mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.head { position: sticky; top: 0; z-index: 6; background: var(--ec-bg); }
.monthbar { position: relative; overflow: hidden; padding-bottom: var(--cell-gap); }
.mb-track { display: grid; grid-template-columns: 34px repeat(12, 46px); gap: var(--cell-gap); height: 26px; width: max-content; will-change: transform; }
.mb-track .mh { position: static; grid-row: auto; }
.mb-corner { position: absolute; left: 0; top: 0; bottom: 0; width: calc(34px + var(--cell-gap)); background: var(--ec-bg); }
.gridwrap {
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  padding: 0 var(--ec-gutter) 24px 0; scrollbar-width: none;
}
.gridwrap::-webkit-scrollbar { display: none; }
.grid .corner, .grid .mh { display: none; }
.panel { background: var(--ec-soft); padding: 26px var(--ec-gutter) calc(26px + env(safe-area-inset-bottom)); }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: minmax(0, 1fr) 340px; height: 100dvh; overflow: hidden; }
  .main { height: 100dvh; padding: 0 28px 22px 16px; }
  .head { position: static; }
  .monthbar { display: none; }
  .grid .corner, .grid .mh { display: flex; }
  .top { padding: 18px 0 14px 12px; }
  .gridwrap { flex: 1 1 auto; height: auto; min-height: 0; overflow: hidden; padding: 0; }
  .panel { height: 100dvh; overflow-y: auto; padding: 26px 26px 24px; display: flex; flex-direction: column; }
  .panelbtn { display: inline-grid; }
  .app.panel-closed { grid-template-columns: minmax(0, 1fr); }
  .app.panel-closed .panel { display: none; }
  .app.panel-closed .main { padding-right: 20px; }
}

/* ---------- The year grid ---------- */
.grid {
  display: grid; gap: var(--cell-gap);
  grid-template-columns: 34px repeat(12, 46px);
  grid-template-rows: 0 repeat(31, 30px); margin-top: calc(var(--cell-gap) * -1);
  width: max-content;
}
@media (min-width: 900px) {
  .grid { width: 100%; height: 100%; grid-template-columns: 30px repeat(12, minmax(0, 1fr)); grid-template-rows: 24px repeat(31, minmax(0, 1fr)); margin-top: 0; }
}

/* Month names and day numbers stay in place while the phone scrolls. Today's month and day are ink blocks. */
.corner, .mh, .dn { background: var(--ec-bg); }
.corner { position: sticky; left: 0; top: 0; z-index: 3; grid-row: 1; grid-column: 1; }
.mh {
  position: sticky; top: 0; z-index: 2; grid-row: 1;
  display: flex; align-items: center; justify-content: center;
  font: 700 12px/1 var(--ec-sans); letter-spacing: .6px; text-transform: uppercase; color: var(--ec-muted);
}
.dn {
  position: sticky; left: 0; z-index: 1; grid-column: 1;
  display: flex; align-items: center; justify-content: flex-end; padding-right: 7px;
  font: 400 11.5px/1 var(--ec-mono); font-variant-numeric: tabular-nums; color: var(--ec-muted);
  box-shadow: var(--cell-gap) 0 0 var(--ec-bg); /* covers the gap, so days scrolling under do not peek */
}
.mh.is-today, .dn.is-today { background: var(--ec-ink); color: var(--ec-on-ink); border-radius: var(--ec-radius); }
.mh { box-shadow: 0 var(--cell-gap) 0 var(--ec-bg); }
.dn.is-today { justify-content: center; padding-right: 0; font-weight: 500; }

/* A day: square corners (Ceci's choice for the grid); grey when empty; mood = tint; event = border; conditions = symbols; notes = a folded corner. */
.cell {
  position: relative; min-width: 0; min-height: 0; padding: 0; margin: 0;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 0; background: var(--empty); color: var(--ec-ink);
  transition: opacity .15s ease;
}
.cell:active { opacity: 1; }
.cell.has-fill { background: color-mix(in oklab, var(--fill) var(--tint), var(--ec-bg)); }
.cell.has-edge { box-shadow: inset 0 0 0 var(--edge-w) var(--edge); }
.cell.has-note::after {
  content: ""; position: absolute; top: 0; right: 0; width: 7px; height: 7px;
  background: linear-gradient(225deg, currentColor 50%, transparent 50%);
}
.cell:hover { outline: 1.5px solid var(--ec-ink); outline-offset: 1px; z-index: 1; }
.cell:focus-visible { outline: 2px solid var(--ec-ink); outline-offset: 1px; z-index: 1; }
.cell.is-open { outline: 2px solid var(--ec-ink); outline-offset: 1px; z-index: 1; }
.cell { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.is-choosing .grid { cursor: cell; }
.is-choosing .cell:hover:not(.is-open) { outline: none; }
/* Several days: no notes (they belong to each day) and no previous or next day. */
.sheet.is-multi .notesec, .sheet.is-multi #prevDay, .sheet.is-multi #nextDay { display: none; }
.chip[aria-checked="mixed"], .chip[data-mixed] { border-color: var(--ec-ink); border-style: dashed; }
.cell.is-dim { opacity: .16; }

.syms { display: flex; align-items: center; justify-content: center; gap: 2px; pointer-events: none; }
.sym { width: 12px; height: 12px; flex: 0 0 auto; color: var(--ec-ink); }
.sym .f { fill: currentColor; }
.sym .s { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cell.many .sym { width: 10px; height: 10px; }
.cell .sym { color: inherit; } /* the cell picks an ink that reads on its colour */
.more { font: 500 9.5px/1 var(--ec-mono); }

@media (min-width: 900px) {
  .sym { width: 13px; height: 13px; }
  .cell.many .sym { width: 12px; height: 12px; }
  .syms { gap: 3px; }
}
/* Days that do not exist (Feb 30): nothing. */
.nocell { background: transparent; }

/* ---------- The key ---------- */
.account { margin-bottom: 30px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; }
.acct { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.acctmail { font: 500 14px/1.2 var(--ec-sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acctst { font: 400 12.5px/1 var(--ec-sans); color: var(--ec-muted); white-space: nowrap; }
.acctnote { font: 400 13px/1.4 var(--ec-sans); color: var(--ec-muted); flex: 1 1 140px; }
.acctnote.warn { color: var(--ec-danger); flex-basis: 100%; }
.state { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 2px; background: var(--ec-ink); }
.state.syncing, .state.idle { background: var(--ec-muted); animation: blink 1.4s ease-in-out infinite; }
.state.offline, .state.error { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ec-ink); }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.key + .key { margin-top: 26px; }
.keyhead { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.keyhead .label { color: var(--ec-ink); }
.keyhow { flex: 1 1 auto; font: 400 12.5px/1 var(--ec-sans); color: var(--ec-muted); }
.keylist { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.keyrow {
  width: 100%; min-height: 34px; display: flex; align-items: center; gap: 9px; padding: 0 4px 0 0;
  border: 0; border-radius: 0; background: none; color: var(--ec-ink); text-align: left;
}
.keyname { flex: 1 1 auto; min-width: 0; font: 500 14px/1.2 var(--ec-sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.keycount { font: 400 12.5px/1 var(--ec-mono); color: var(--ec-muted); font-variant-numeric: tabular-nums; }
.keyrow[aria-pressed="true"] .keyname { font-weight: 700; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.keyrow[aria-pressed="true"] .keycount { color: var(--ec-ink); }
.keyrow:hover .keyname { text-decoration: underline; text-underline-offset: 4px; }
/* Themes: each one a strip of its 12 colours, as they look in the days. */
.themes { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.theme {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 7px 7px 8px; min-width: 0;
  border: 1.5px solid transparent; border-radius: var(--ec-radius); background: var(--ec-bg); color: var(--ec-ink); text-align: left;
}
.theme:hover { border-color: var(--ec-hairline); }
.theme[aria-checked="true"] { border-color: var(--ec-ink); }
.strip { display: grid; grid-template-columns: repeat(12, 1fr); height: 16px; }
.strip i { display: block; background: color-mix(in oklab, var(--fill) var(--t), var(--ec-bg)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .strip i { background: color-mix(in oklab, var(--fill) var(--td), var(--ec-bg)); } }
:root[data-theme="dark"] .strip i { background: color-mix(in oklab, var(--fill) var(--td), var(--ec-bg)); }
.themename { font: 500 12.5px/1.2 var(--ec-sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme[aria-checked="true"] .themename { font-weight: 700; }

.filterbar { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; font: 400 13px/1.4 var(--ec-sans); color: var(--ec-ink-2); }

/* Swatches: the same three looks as in the grid. */
.sw { width: 20px; height: 16px; flex: 0 0 auto; border-radius: 0; display: inline-grid; place-items: center; }
.sw-fill { background: color-mix(in oklab, var(--fill) var(--tint), var(--ec-bg)); }
.sw-edge { background: var(--empty); box-shadow: inset 0 0 0 2.5px var(--edge); }
.sw-sym { background: var(--empty); }
.panel .sw-edge, .panel .sw-sym { background: var(--ec-bg); }
.sw .sym { width: 11px; height: 11px; }

/* Where the family's testing seal sits on the computer: the empty space above the footer. */
.stampspot { position: relative; height: 150px; margin-top: 24px; flex: 0 0 auto; }
@media (min-width: 701px) { .stampspot { height: 170px; } }
@media (min-width: 900px) { .stampspot { margin-top: auto; } .stampspot ~ .foot { margin-top: 0; } }
.stampspot .ec-seal.is-stamp { top: 22px; right: 4px; }

/* Footer: credits, the app, the family's production line, version and feedback. */
.foot { margin-top: 34px; }
@media (min-width: 900px) { .foot { margin-top: auto; padding-top: 34px; } }
.credits, .production { font: 500 12.5px/1.5 var(--ec-sans); color: var(--ec-muted); }
.credits a, .production a { color: var(--ec-ink); text-underline-offset: 3px; }
.production .mono { font-size: 12px; letter-spacing: .02em; }

/* ---------- The day sheet ----------
   Computer: over the panel, full height, while the year stays usable.
   Phone: from the bottom, with a veil over the year. */
.sheet {
  margin: 0; padding: 0; border: 0; color: var(--ec-ink); background: var(--ec-bg);
  position: fixed; inset: auto 0 0 0; width: 100%; max-width: 100%; max-height: 88dvh;
  border-radius: var(--ec-radius) var(--ec-radius) 0 0; overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; }
.sheet::backdrop { background: var(--ec-scrim); }
@media (min-width: 900px) {
  .sheet { inset: 0 0 0 auto; left: auto; width: 340px; height: 100dvh; max-height: none; border-radius: 0; z-index: 50;
           box-shadow: -1px 0 0 var(--ec-hairline); }
}
.sheethead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 16px 6px var(--ec-gutter); }
@media (min-width: 900px) { .sheethead { padding: 22px 14px 6px 26px; } }
.sheettitle { font: 600 26px/1.1 var(--ec-display); letter-spacing: .35px; padding-top: 4px; }
.sheettitle .sub { display: block; margin-top: 7px; font: 500 14px/1.2 var(--ec-sans); letter-spacing: 0; color: var(--ec-muted); }
.sheettitle .mono { font: 400 13px/1 var(--ec-mono); }
.sheetnav { display: flex; gap: 0; margin-right: -4px; }
.sheetbody { flex: 1 1 auto; overflow-y: auto; padding: 14px var(--ec-gutter) calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 22px; }
@media (min-width: 900px) { .sheetbody { padding: 14px 26px 26px; } }
.pick .label { display: block; margin-bottom: 9px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px 0 9px;
  border: 1.5px solid var(--ec-hairline); border-radius: var(--ec-radius); background: var(--ec-bg); color: var(--ec-ink);
  font: 500 14px/1.1 var(--ec-sans);
}
.chip:hover { border-color: var(--ec-ink); }
.chip[aria-checked="true"] { border-color: var(--ec-ink); background: var(--ec-ink); color: var(--ec-on-ink); font-weight: 600; }
.chip[aria-checked="true"] .sw-edge, .chip[aria-checked="true"] .sw-sym { background: var(--ec-bg); }
.chip[aria-checked="true"]:focus-visible { outline-color: var(--ec-ink); }
textarea#note {
  width: 100%; display: block; resize: vertical; min-height: 140px; padding: 10px 12px;
  border: 1.5px solid var(--ec-ink); border-radius: var(--ec-radius); background: var(--ec-bg);
  font: 400 15.5px/1.45 var(--ec-sans);
}
textarea#note:focus { outline: none; border-width: 2.5px; padding: 9px 11px; }
textarea::placeholder, input::placeholder { color: var(--ec-muted); }
#clearDay { align-self: flex-start; margin-top: 2px; }
/* The testing seal sits after the notes while a day is open. */
.sheetstamp { position: relative; flex: 0 0 auto; height: 150px; margin-top: -8px; }
.sheetstamp .ec-seal.is-stamp { top: 8px; right: 0; }

/* ---------- Dialogs: editing a list, signing in ---------- */
.dlg {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 24px 22px 20px;
  border: 1.5px solid var(--ec-ink); border-radius: var(--ec-radius);
  background: var(--ec-bg); color: var(--ec-ink);
}
.dlg::backdrop { background: var(--ec-scrim); }
.dlgform { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.dlgtitle { font: 600 26px/1.1 var(--ec-display); letter-spacing: .35px; }
.dlglead { margin-top: -6px; font: 400 14px/1.4 var(--ec-sans); color: var(--ec-muted); }
.dlgnote { font: 500 14px/1.35 var(--ec-sans); color: var(--ec-danger); }
.dlgnote:empty { display: none; }
.dlgmore { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.dlgactions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field input {
  height: 44px; padding: 0 2px; border: 0; border-bottom: 1.5px solid var(--ec-ink); border-radius: 0;
  background: transparent; font: 500 17px/1 var(--ec-sans);
}
.field input.mono { font: 500 22px/1 var(--ec-mono); letter-spacing: .3em; }
.field input:focus { outline: none; border-bottom-width: 3px; }

.editlist { display: flex; flex-direction: column; max-height: calc(100dvh - 300px); overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.editrow { display: grid; grid-template-columns: 40px 1fr 32px 32px; align-items: center; gap: 6px; padding: 4px 0; }
.editrow + .editrow { border-top: 1px solid var(--ec-hairline); }
.pickbtn { width: 40px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--ec-radius); background: none; }
.pickbtn:hover, .pickbtn[aria-expanded="true"] { background: var(--ec-soft); }
.pickbtn .sw { width: 24px; height: 18px; }
.editname { height: 36px; min-width: 0; padding: 0 4px; border: 0; border-bottom: 1.5px solid transparent; border-radius: 0; background: none; font: 500 15.5px/1 var(--ec-sans); }
.editname:hover { border-bottom-color: var(--ec-hairline); }
.editname:focus { outline: none; border-bottom-color: var(--ec-ink); }
.pickopts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 0 8px; }
.opt { width: 36px; height: 32px; display: grid; place-items: center; padding: 0; border: 1.5px solid transparent; border-radius: var(--ec-radius); background: none; color: var(--ec-ink); }
.opt:hover { border-color: var(--ec-hairline); }
.opt.on { border-color: var(--ec-ink); }
.opt .sym { width: 14px; height: 14px; }
.opt .sw { width: 22px; height: 18px; }
.addbtn { align-self: flex-start; }

/* Segmented control (light or dark): the options touch, so they are square; the corner is on the whole. */
.seg { display: flex; border: 1.5px solid var(--ec-ink); border-radius: var(--ec-radius); overflow: hidden; background: var(--ec-bg); }
.seg button {
  flex: 1 1 0; min-height: 40px; padding: 6px; border: 0; border-radius: 0; background: transparent; color: var(--ec-ink);
  font: 500 14px/1.15 var(--ec-sans);
}
.seg button + button { box-shadow: -1px 0 0 var(--ec-hairline); }
.seg button[aria-checked="true"] { background: var(--ec-ink); color: var(--ec-on-ink); font-weight: 600; box-shadow: none; }
.seg button[aria-checked="true"] + button { box-shadow: none; }
.seg button:focus-visible { outline-offset: -5px; }
.seg button[aria-checked="true"]:focus-visible { outline-color: var(--ec-on-ink); }

/* The colour mixer: a preview, the hex, and three bars (hue, saturation, light); nothing changes until "Use colour". */
.mixer { flex: 1 1 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 8px; padding: 14px; background: var(--ec-soft); border-radius: var(--ec-radius); }
.mixtop { display: flex; align-items: flex-end; gap: 14px; }
.mixprev.sw { width: 56px; height: 40px; }
.mixer .sw-edge { background: var(--ec-bg); box-shadow: inset 0 0 0 3px var(--edge); }
.mixhexlab { display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; }
.mixhex { width: 100%; max-width: 140px; height: 36px; padding: 0 2px; border: 0; border-bottom: 1.5px solid var(--ec-ink); border-radius: 0; background: transparent; font: 500 16px/1 var(--ec-mono); text-transform: uppercase; }
.mixhex:focus { outline: none; border-bottom-width: 3px; }
.mixrow { display: flex; flex-direction: column; gap: 6px; }
.rng { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; margin: 0; border-radius: var(--ec-radius); background: var(--ec-softer); cursor: pointer; touch-action: pan-y; }
.rng::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 32px; border-radius: var(--ec-radius); background: #FFFFFF; border: 2px solid #1A1A1A; box-shadow: 0 0 0 1.5px #FFFFFF; }
.rng::-moz-range-thumb { width: 14px; height: 28px; border-radius: var(--ec-radius); background: #FFFFFF; border: 2px solid #1A1A1A; box-shadow: 0 0 0 1.5px #FFFFFF; }
.rng:focus-visible { outline: 2px solid var(--ec-ink); outline-offset: 3px; }
.mixactions { display: flex; align-items: center; justify-content: flex-end; gap: 18px; }
/* Any colour: a rainbow swatch that opens the mixer. */
.sw-any { background: conic-gradient(from 90deg, #E0453A, #E39B2D, #C9A227, #5A9E2F, #21A38A, #0EA5E9, #4F6BED, #A24FD8, #D9487A, #E0453A); }
.anycolor[aria-expanded="true"] { border-color: var(--ec-ink); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .panel, .sheet, .year .iconbtn { display: none !important; }
  .app { display: block; height: auto; }
  .gridwrap { height: auto; overflow: visible; }
}
