/* ELSEWISE uses the site visual system. Tokens come from style.css :root. */

.ew {
  color: var(--ink);
  font: 16px/1.6 var(--body);
  max-width: 780px;
  margin: 0 auto;
}
.ew,
.ew * { box-sizing: border-box; }
.ew h1,
.ew h2,
.ew h3 {
  font-family: var(--head);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  margin: 0;
}
.ew a { color: var(--acc); }
.ew a:hover { color: var(--pri-d); }
.ew p { margin: 0 0 12px; }
.ew button,
.ew input { font: inherit; }
.ew ::selection { background: var(--acc); color: #fff; }

.ew-home,
.ew-play,
.ew-keep,
.ew-how { width: 100%; padding: 0 0 8px; }

.ew-kicker {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--acc);
  letter-spacing: .02em;
  text-transform: none;
}

.ew-mark {
  margin: 0;
  font: 700 48px/1.15 var(--head);
  letter-spacing: 0;
  font-style: normal;
  color: var(--ink);
}

.ew-hook,
.ew-aside {
  max-width: 70ch;
  color: var(--ink2);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.6;
}
.ew-aside { margin: 8px 0 0; font-size: 16px; }

.ew-boards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0 8px;
}
.ew-boards.compact {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  gap: 8px;
}

.ew-board {
  appearance: none;
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--sh1);
  padding: 16px 12px 14px;
  font: 600 15px/1.3 var(--body);
  text-align: left;
  cursor: pointer;
}
.ew-boards.compact .ew-board {
  padding: 8px 12px;
  font-size: 13px;
  letter-spacing: .04em;
  box-shadow: none;
}
.ew-board[aria-checked="true"] {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc-soft);
}
.ew-pin-dot {
  display: block;
  width: 8px;
  height: 8px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--line);
}
.ew-boards.compact .ew-pin-dot { display: none; }
.ew-board[aria-checked="true"] .ew-pin-dot { background: var(--pri); }

.ew-menu {
  display: grid;
  gap: 12px;
  margin: 24px 0 0;
}
.ew-menu a {
  display: grid;
  gap: 4px;
  padding: 20px 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--acc);
  border-radius: var(--r);
  box-shadow: var(--sh1);
  text-decoration: none;
  color: var(--ink);
}
.ew-menu a:nth-child(2) { border-top-color: var(--pri); }
.ew-menu a:nth-child(3) { border-top-color: var(--ink); }
.ew-menu a:nth-child(4) { border-top-color: var(--acc-d); }
.ew-menu a:hover { border-color: var(--acc); color: var(--ink); }
.ew-menu a:nth-child(2):hover { border-top-color: var(--pri); }
.ew-menu a:nth-child(3):hover { border-top-color: var(--ink); }
.ew-menu a:nth-child(4):hover { border-top-color: var(--acc-d); }
.ew-menu strong {
  font: 700 22px/1.2 var(--head);
  color: var(--ink);
}
.ew-menu small,
.ew-hint,
.ew-held small,
.ew-rounds small,
.ew-keep-card p {
  color: var(--ink2);
  font-size: 14px;
  font-weight: 400;
}

.ew-back {
  display: inline-block;
  margin: 0 0 16px;
  font-weight: 600;
  text-decoration: none;
}
.ew-brand {
  color: var(--ink);
  font: 700 22px/1 var(--head);
  letter-spacing: 0;
  font-style: normal;
  text-decoration: none;
}
.ew-brand:hover { color: var(--pri-d); }

.ew-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px 16px;
  align-items: center;
  margin: 0 0 16px;
}
.ew-status,
.ew-tools,
.ew-actions,
.ew-dock form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.ew-tools { margin: 0 0 16px; justify-content: space-between; }
.ew-count,
.ew-run,
.ew-misses {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink2);
}
.ew-run.hot { color: var(--pri); }

.ew-misses {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ew-misses i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--acc-soft);
  border: 1px solid var(--line);
}
.ew-misses i.used {
  background: var(--pri);
  border-color: var(--pri-d);
}

.ew-timer { text-align: right; min-width: 64px; }
.ew-timer-num {
  font: 700 28px/1 var(--head);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ew-timer-track {
  width: 72px;
  height: 6px;
  margin: 6px 0 0 auto;
  border-radius: 999px;
  background: var(--acc-soft);
  overflow: hidden;
}
.ew-timer-fill {
  height: 100%;
  background: var(--acc);
  border-radius: 999px;
}
.ew-timer.urgent .ew-timer-num { color: var(--pri); }
.ew-timer.urgent .ew-timer-fill { background: var(--pri); }

.ew-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--r);
  font: 600 16px/1 var(--body);
  cursor: pointer;
  text-decoration: none;
  border: 2px solid transparent;
  background: var(--card);
  color: var(--ink);
  border-color: var(--line);
  transition: background .15s, color .15s, border-color .15s;
}
.ew-btn:hover { border-color: var(--acc); color: var(--ink); }
.ew-btn.primary {
  background: var(--pri);
  color: #fff;
  border-color: transparent;
}
.ew-btn.primary:hover { background: var(--pri-d); color: #fff; }
.ew-btn.ghost {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line);
}
.ew-btn.ghost:hover { border-color: var(--acc); }
.ew-btn[disabled] { opacity: .55; cursor: default; }

.ew-card,
.ew-results,
.ew-held,
.ew-token,
.ew-keep-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh1);
}

.ew-card { padding: 24px 28px; margin: 0 0 16px; position: relative; }
.ew-card.how { padding: 32px; }
.ew-card h1,
.ew-keep h1,
.ew-results h1 {
  font: 700 36px/1.15 var(--head);
  margin: 0 0 12px;
}
.ew-token strong { font: 700 32px/1.15 var(--head); }

.ew-pin { display: none; }

.ew-street {
  margin: 16px 0 0;
  padding: 16px;
  background: var(--acc-soft);
  border-radius: 8px;
}
.ew-street h2 {
  margin: 0 0 8px;
  font: 700 16px/1.2 var(--head);
}
.ew-slip-name {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 4px;
  font-weight: 600;
}
.ew-slip-name small {
  color: var(--ink2);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.ew-feedback {
  min-height: 1.5em;
  margin: 0 0 12px;
  color: var(--acc-d);
  font-weight: 600;
}

.ew-held {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  padding: 16px 20px;
  margin: 0 0 16px;
  border-top: 4px solid var(--ew-tier, var(--acc));
}
.ew-held strong { font: 700 22px/1.2 var(--head); }
.ew-points {
  font: 700 28px/1 var(--head);
  color: var(--pri);
}
.ew-held small { grid-column: 1 / -1; }

.ew-dock { margin: 0 0 8px; }
.ew-dock form { width: 100%; }
.ew-input {
  flex: 1;
  min-width: 0;
  font: 16px/1.6 var(--body);
  color: var(--ink);
  background: var(--foam);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.ew-input:focus {
  outline: 3px solid var(--acc-soft);
  border-color: var(--acc);
}

.ew-reveal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6, 26, 39, .55);
}
.ew-token {
  padding: 32px 28px;
  text-align: center;
  min-width: min(360px, 100%);
  border-top: 4px solid var(--ew-tier, var(--acc));
}
.ew-token.quiet { border-top-color: var(--ink2); }
.ew-token span {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ew-tier, var(--acc-d));
}
.ew-token .ew-points { display: block; margin: 8px 0; }
.ew-token p { margin: 8px 0 0; color: var(--ink2); }
.ew-reveal .ew-btn { margin-top: 16px; }

.ew-results { padding: 32px 28px; }
.ew-results .ew-kicker { margin-bottom: 4px; }
.ew-rounds {
  list-style: none;
  margin: 16px 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.ew-rounds li {
  display: grid;
  gap: 2px;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.ew-share {
  margin: 16px 0;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 13px/1.5 var(--body);
  white-space: pre-wrap;
  color: var(--ink2);
  overflow: auto;
}

.ew-keep > h1,
.ew-how > h1 { font: 700 36px/1.15 var(--head); margin: 0 0 8px; }
.ew-keep > .ew-hook { margin-bottom: 8px; }

.ew-shelf { margin: 24px 0 0; }
.ew-shelf header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 12px;
}
.ew-shelf h2 { font: 700 22px/1.2 var(--head); }
.ew-shelf span {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink2);
}
.ew-shelf-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.ew-keep-card {
  padding: 16px;
  border-top: 4px solid var(--ew-tier, var(--acc));
}
.ew-keep-card b {
  display: block;
  margin: 6px 0 4px;
  font: 700 18px/1.2 var(--head);
}
.ew-keep-card span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ew-tier, var(--acc-d));
}

.ew [data-tier="Heard"] { --ew-tier: #4d6a7c; }
.ew [data-tier="Familiar"] { --ew-tier: #1b86b8; }
.ew [data-tier="Sideways"] { --ew-tier: #0e5d84; }
.ew [data-tier="Unlisted"] { --ew-tier: #d6345a; }
.ew [data-tier="Elsewise"] { --ew-tier: #b02446; }
.ew [data-tier="One-off"] { --ew-tier: #0b2a3c; }
.ew-token[data-tier="One-off"] {
  background: var(--deep);
  color: #fff;
  border-color: var(--deep);
}
.ew-token[data-tier="One-off"] span,
.ew-token[data-tier="One-off"] p { color: var(--acc-soft); }
.ew-token[data-tier="One-off"] .ew-points { color: #fff; }

.ew-card.how h2 {
  margin: 28px 0 8px;
  font: 700 22px/1.2 var(--head);
}
.ew-card.how p,
.ew-card.how li { color: var(--ink); line-height: 1.6; max-width: 70ch; }
.ew-card.how table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  margin: 8px 0 16px;
}
.ew-card.how th,
.ew-card.how td {
  text-align: left;
  padding: 12px;
  vertical-align: top;
}
.ew-card.how thead th {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink2);
  padding: 0 12px;
  background: transparent;
}
.ew-card.how tbody th,
.ew-card.how tbody td {
  background: var(--bg);
  border: 0;
}
.ew-card.how tbody th { font-weight: 600; border-radius: var(--r) 0 0 var(--r); }
.ew-card.how tbody td:last-child { border-radius: 0 var(--r) var(--r) 0; }
.ew-card.how tbody td:nth-child(2) {
  font: 700 18px/1 var(--head);
  color: var(--pri);
}

.ew-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 640px) {
  .ew-mark { font-size: 32px; }
  .ew-hook { font-size: 16px; }
  .ew-card h1,
  .ew-keep h1,
  .ew-results h1,
  .ew-keep > h1,
  .ew-how > h1 { font-size: 28px; }
  .ew-top { grid-template-columns: 1fr auto; }
  .ew-status { grid-column: 1 / -1; }
  .ew-boards { grid-template-columns: 1fr; }
  .ew-shelf-grid { grid-template-columns: 1fr; }
  .ew-card,
  .ew-card.how,
  .ew-results { padding: 16px; }
  .ew-dock form { flex-direction: column; align-items: stretch; }
  .ew-dock .ew-btn,
  .ew-actions .ew-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .ew-board[aria-checked="true"] { box-shadow: 0 0 0 3px var(--acc-soft); }
}
