:root {
  --bg: #f4f4f7;
  --surface: #ffffff;
  --surface-2: #eeeef3;
  --surface-sunken: #e7e7ee;
  --ink: #15151c;
  --ink-soft: #5d5e6c;
  --ink-faint: #737482;
  --rule: #e6e6ec;
  --accent: #5b4fe0;
  --accent-strong: #4a3fcc;
  --accent-soft: #ecebfd;
  --on-accent: #ffffff;
  --credit: #0b7a53;
  --credit-soft: #e3f4ec;
  --debit: #c8323a;
  --debit-soft: #fbe8e9;
  --focus: #5b4fe0;
  --chrome: rgb(244 244 247 / 82%);
  --shadow-1: 0 1px 2px rgb(20 20 40 / 5%), 0 2px 10px rgb(20 20 40 / 4%);
  --shadow-2: 0 2px 6px rgb(20 20 40 / 6%), 0 12px 32px rgb(20 20 40 / 10%);

  --sans:
    'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --gutter: 16px;
  --tap: 44px;
  --bar: 56px;
  --tabbar: 64px;
  --measure: 34rem;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e13;
    --surface: #17171f;
    --surface-2: #20202a;
    --surface-sunken: #262632;
    --ink: #ededf3;
    --ink-soft: #a6a6b5;
    --ink-faint: #868696;
    --rule: #2a2a36;
    --accent: #8f86ff;
    --accent-strong: #a69fff;
    --accent-soft: #25233f;
    --on-accent: #0e0e13;
    --credit: #4fd39a;
    --credit-soft: #10291f;
    --debit: #ff7b7f;
    --debit-soft: #331618;
    --focus: #8f86ff;
    --chrome: rgb(14 14 19 / 80%);
    --shadow-1: none;
    --shadow-2: 0 12px 40px rgb(0 0 0 / 50%);

    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:where(a) {
  color: inherit;
}

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.icon {
  display: block;
  flex: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentcolor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--sm {
  width: 18px;
  height: 18px;
}

/* Shell */

.shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid transparent;
}

.masthead::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--chrome);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--rule);
}

.masthead__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--bar);
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0
    max(var(--gutter), env(safe-area-inset-left));
  max-width: 64rem;
  margin: 0 auto;
  width: 100%;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: var(--tap);
  margin-right: auto;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.wordmark::before {
  content: 'k';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  padding-bottom: 2px;
}

.masthead__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.masthead__actions form {
  margin: 0;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.15s var(--ease),
    color 0.15s var(--ease);
}

.icon-button:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.icon-button.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.icon-button .avatar {
  width: 32px;
  height: 32px;
  font-size: 12px;
}

.icon-button.active .avatar {
  box-shadow: 0 0 0 2px var(--accent);
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  padding: 6px max(8px, env(safe-area-inset-right))
    calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: var(--chrome);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--rule);
}

.tabbar__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s var(--ease);
}

.tabbar__glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 30px;
  border-radius: 999px;
  transition: background-color 0.2s var(--ease);
}

.tabbar__link:hover {
  color: var(--ink);
}

.tabbar__link.active {
  color: var(--accent);
}

.tabbar__link.active .tabbar__glyph {
  background: var(--accent-soft);
}

.tabbar__link:active .tabbar__glyph {
  transform: scale(0.94);
}

.page {
  flex: 1;
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 20px max(var(--gutter), env(safe-area-inset-right))
    calc(40px + env(safe-area-inset-bottom))
    max(var(--gutter), env(safe-area-inset-left));
}

.shell--nav .page {
  padding-bottom: calc(var(--tabbar) + 32px + env(safe-area-inset-bottom));
}

.stack {
  display: flex;
  flex-direction: column;
}

/* Type */

.display {
  margin: 0 0 6px;
  font-size: clamp(28px, 7.5vw, 40px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.section {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.heading {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.heading--minor {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  font-size: 15px;
}

.lede {
  margin: 0;
  max-width: var(--measure);
  color: var(--ink-soft);
  font-size: 16px;
}

.quiet {
  margin: 0 0 14px;
  max-width: var(--measure);
  color: var(--ink-soft);
}

.hint {
  margin: 12px 0 0;
  max-width: var(--measure);
  color: var(--ink-faint);
  font-size: 13px;
  line-height: 1.5;
}

.waiting {
  margin: 0;
  color: var(--ink-faint);
}

.waiting::after {
  content: '…';
}

.tab-head {
  padding: 8px 0 20px;
}

.tab-head--portrait,
.tab-head--person {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Sheets */

.sheet {
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: 20px var(--gutter);
  margin-bottom: 14px;
}

.sheet--last {
  margin-bottom: 0;
}

.sheet--narrow {
  width: 100%;
  max-width: 26rem;
  margin-inline: auto;
}

@media (prefers-color-scheme: dark) {
  .sheet,
  .statement {
    border-color: var(--rule);
  }
}

/* The statement: the one loud thing */

.statement {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 14px;
  padding: 22px var(--gutter) 24px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}

.statement--credit {
  background: var(--credit-soft);
  box-shadow: none;
}

.statement--debit {
  background: var(--debit-soft);
  box-shadow: none;
}

.statement__words {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
}

.statement__figure {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: clamp(40px, 12vw, 60px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.statement--credit .statement__figure {
  color: var(--credit);
}

.statement--debit .statement__figure {
  color: var(--debit);
}

.statement__currency {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--ink-soft);
}

.statement--even {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.statement--even::before {
  content: '';
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.statement--even .statement__words {
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
}

/* Ledger: name-to-amount rows */

.ledger {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ledger__row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 0;
}

.ledger__row + .ledger__row {
  border-top: 1px solid var(--rule);
}

.ledger__label {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 0 1 auto;
}

.ledger__note {
  color: var(--ink-faint);
  font-size: 13px;
}

.ledger__leader {
  flex: 1 1 auto;
  min-width: 12px;
}

/* Prize preview on the tournament form */

.preview {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 0;
}

.preview__title {
  margin: 0 0 6px;
  color: var(--ink-faint);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.preview__line {
  margin: 0;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.preview .ledger {
  margin-top: 6px;
}

/* Figures and handles */

.figure {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex: none;
}

.figure--credit {
  color: var(--credit);
}

.figure--debit {
  color: var(--debit);
}

.figure--even {
  color: var(--ink-faint);
  font-weight: 600;
}

.handle {
  font-weight: 700;
  text-decoration: none;
}

a.handle:hover {
  color: var(--accent);
}

.handle--muted {
  color: var(--ink-faint);
  font-weight: 600;
}

.handle--display {
  font-weight: 800;
}

/* Entries */

.entries {
  list-style: none;
  margin: 0;
  padding: 0;
}

.entry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 14px 0;
}

.entry + .entry {
  border-top: 1px solid var(--rule);
}

.entry--tight {
  padding: 10px 0;
}

.entry--editing {
  display: block;
  padding: 16px 0;
}

.entry__body {
  flex: 1 1 12rem;
  min-width: 0;
}

.entry__full {
  display: grid;
  gap: 8px;
  flex: 1 1 100%;
  min-width: 0;
}

.entry__what {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.entry__who {
  margin: 2px 0 0;
  color: var(--ink-faint);
  font-size: 13px;
}

.entry__actions {
  display: flex;
  align-items: center;
  gap: 4px 14px;
  flex: none;
  flex-wrap: wrap;
}

.entry__actions form {
  margin: 0;
}

.entry__lead {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.action {
  display: inline-flex;
  margin: 0;
}

/* Tabs list: rows that open something */

.tabs {
  list-style: none;
  margin: 0 calc(var(--gutter) * -1);
  padding: 0;
}

.tab {
  display: grid;
  grid-template-columns: 1fr auto 16px;
  align-items: center;
  gap: 2px 12px;
  min-height: 64px;
  padding: 12px var(--gutter);
  text-decoration: none;
  transition: background-color 0.15s var(--ease);
}

.tab::after {
  content: '';
  grid-column: 3;
  grid-row: 1 / span 2;
  width: 8px;
  height: 8px;
  margin-left: 2px;
  border-top: 2px solid var(--ink-faint);
  border-right: 2px solid var(--ink-faint);
  transform: rotate(45deg);
}

.tab:hover {
  background: var(--surface-2);
}

.tab:active {
  background: var(--surface-sunken);
}

.tabs li + li .tab {
  box-shadow: inset 0 1px 0 var(--rule);
}

.tab__name {
  grid-column: 1;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tab__who {
  grid-column: 1;
  color: var(--ink-faint);
  font-size: 13px;
}

.tab .figure {
  grid-row: 1 / span 2;
  grid-column: 2;
  font-size: 17px;
}

/* Tiles: the home grid */

.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 132px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  text-decoration: none;
  transition:
    transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}

.tile:hover {
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}

.tile:active {
  transform: scale(0.98);
}

.tile__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
}

.tile__name {
  margin-top: auto;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tile__who {
  margin-top: -10px;
  color: var(--ink-faint);
  font-size: 13px;
  line-height: 1.4;
}

@media (prefers-color-scheme: dark) {
  .tile {
    border-color: var(--rule);
  }
}

.greeting {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0 20px;
}

.greeting .display {
  margin: 0;
}

.greeting .lede {
  margin-top: 2px;
}

/* Controls */

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 22px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.15s var(--ease),
    color 0.15s var(--ease),
    transform 0.1s var(--ease);
}

.button:hover {
  background: var(--accent-strong);
}

.button:active {
  transform: scale(0.97);
}

.button:disabled {
  opacity: 0.5;
  cursor: default;
}

.button:disabled:hover {
  background: var(--accent);
}

.button:disabled:active {
  transform: none;
}

.button--quiet {
  background: var(--surface-2);
  color: var(--ink);
}

.button--quiet:hover {
  background: var(--surface-sunken);
}

.button--quiet:disabled:hover {
  background: var(--surface-2);
}

.third-party {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.third-party__button {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  transition: transform 0.1s var(--ease);
}

.third-party__button:active {
  transform: scale(0.97);
}

.third-party__button img {
  display: block;
  width: 100%;
  height: auto;
}

.button--tiny {
  min-height: 38px;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 14px;
}

.button--tiny::after {
  content: '';
  position: absolute;
  inset: -3px 0;
}

.button--risk {
  background: var(--debit-soft);
  color: var(--debit);
}

.button--risk:hover {
  background: var(--debit);
  color: var(--surface);
}

.button--risk:disabled:hover {
  background: var(--debit-soft);
  color: var(--debit);
}

.strike {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.strike:hover {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.strike:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Forms */

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form--row,
.pair {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field__label {
  padding: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
}

.field__input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  transition:
    border-color 0.15s var(--ease),
    background-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease);
}

.field__input:hover {
  border-color: var(--rule);
}

.field__input:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.field__input::placeholder {
  color: var(--ink-faint);
  font-weight: 500;
}

.field__input--figure {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.field__input--area {
  min-height: calc(var(--tap) * 1.6);
  resize: vertical;
  line-height: 1.5;
}

select.field__input {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) calc(50% + 1px),
    calc(100% - 15px) calc(50% + 1px);
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

.fieldset {
  margin: 0;
  padding: 0;
  border: none;
  min-width: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: var(--tap);
  padding: 6px 16px 6px 12px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 0.15s var(--ease),
    border-color 0.15s var(--ease),
    color 0.15s var(--ease);
}

.chip input {
  appearance: none;
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 2px solid var(--ink-faint);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition:
    background-color 0.15s var(--ease),
    border-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease);
}

.chip input:checked {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--accent-soft);
}

.chip:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.chip:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Messages */

.alert,
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.alert::before,
.notice::before {
  content: '';
  flex: none;
  width: 4px;
  align-self: stretch;
  border-radius: 2px;
  background: var(--ink);
}

.notice::before {
  background: var(--accent);
}

.stack > .alert {
  margin: 0 0 14px;
}

/* Details */

.details {
  margin: 0;
}

.detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 0;
}

.detail + .detail {
  border-top: 1px solid var(--rule);
}

.detail__label {
  color: var(--ink-faint);
  font-size: 13px;
  font-weight: 600;
}

.detail__slot {
  margin: 0;
  min-width: 0;
}

.detail__value--link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.detail__value--link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Hero */

.hero {
  padding: 28px 0 24px;
  max-width: 34rem;
}

.hero__line {
  margin: 0 0 18px;
  font-size: clamp(32px, 9vw, 52px);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.04;
}

.hero__line em {
  font-style: normal;
  color: var(--accent);
}

.hero__lede {
  margin-bottom: 26px;
  font-size: 17px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.features {
  display: grid;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.feature {
  display: flex;
  gap: 14px;
  padding: 18px var(--gutter);
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}

.feature__title {
  margin: 0 0 2px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.feature__body {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
}

@media (prefers-color-scheme: dark) {
  .feature {
    border-color: var(--rule);
  }
}

/* Wider screens */

@media (min-width: 640px) {
  :root {
    --gutter: 24px;
  }

  .masthead__bar {
    gap: 20px;
    min-height: 64px;
  }

  .wordmark {
    margin-right: 0;
  }

  .tabbar {
    position: static;
    display: flex;
    flex: 1;
    gap: 2px;
    padding: 0;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-top: none;
  }

  .tabbar__link {
    flex-direction: row;
    gap: 7px;
    min-height: 40px;
    padding: 0 14px 0 10px;
    border-radius: 999px;
    color: var(--ink-soft);
    font-size: 15px;
    transition:
      background-color 0.15s var(--ease),
      color 0.15s var(--ease);
  }

  .tabbar__link:hover {
    background: var(--surface-2);
  }

  .tabbar__link.active {
    background: var(--accent-soft);
  }

  .tabbar__glyph,
  .tabbar__link.active .tabbar__glyph {
    width: auto;
    height: auto;
    background: none;
  }

  .tabbar__glyph .icon {
    width: 19px;
    height: 19px;
  }

  .shell--nav .page,
  .page {
    padding-top: 36px;
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  .sheet,
  .statement {
    padding: 26px 28px;
  }

  .statement {
    padding-block: 28px 30px;
  }

  .tabs {
    margin-inline: -28px;
  }

  .tab {
    padding-inline: 28px;
  }

  .tab-head {
    padding: 4px 0 28px;
  }

  .form--row {
    flex-direction: row;
    align-items: flex-end;
    flex-wrap: wrap;
  }

  .form--row .field {
    flex: 1 1 14rem;
  }

  .form--row .field--narrow {
    flex: 0 1 8rem;
  }

  .pair {
    flex-direction: row;
  }

  .pair .field {
    flex: 1 1 14rem;
  }

  .detail {
    flex-direction: row;
    gap: 20px;
  }

  .detail__label {
    flex: 0 0 9rem;
    font-size: inherit;
  }

  .tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .tile {
    padding: 20px;
    min-height: 150px;
  }

  .features {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .feature {
    flex-direction: column;
    padding: 22px;
  }
}

/* Profile modal */

.modal {
  width: 100%;
  max-width: none;
  margin: auto auto 0;
  padding: 0;
  border: none;
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-2);
}

.modal::backdrop {
  background: rgb(10 10 20 / 50%);
  backdrop-filter: blur(4px);
}

.modal__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 80dvh;
  overflow-y: auto;
  padding: 22px var(--gutter) calc(22px + env(safe-area-inset-bottom));
}

.modal__close {
  align-self: flex-start;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.card-head .display {
  margin: 0;
  font-size: 24px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

@media (min-width: 640px) {
  .modal {
    max-width: 26rem;
    margin: auto;
    border: none;
    border-radius: var(--radius-lg);
  }
}

/* Avatars */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-sunken);
  color: var(--ink-soft);
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow: hidden;
  user-select: none;
}

.avatar--sm {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.avatar--md {
  width: 40px;
  height: 40px;
  font-size: 14px;
}

.avatar--lg {
  width: 96px;
  height: 96px;
  font-size: 32px;
}

.avatar--tone-0 {
  background: var(--surface-sunken);
}

.avatar--tone-1 {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-sunken));
}

.avatar--tone-2 {
  background: color-mix(in srgb, var(--accent) 20%, var(--surface-sunken));
}

.avatar--tone-3 {
  background: color-mix(in srgb, var(--accent) 28%, var(--surface-sunken));
  color: var(--ink);
}

.avatar--tone-4 {
  background: color-mix(in srgb, var(--accent) 36%, var(--surface-sunken));
  color: var(--ink);
}

.avatar--tone-5 {
  background: color-mix(in srgb, var(--accent) 44%, var(--surface-sunken));
  color: var(--ink);
}

.picker {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.picker__controls {
  flex: 1 1 auto;
  min-width: 0;
}

.field__input--file {
  padding: 9px 10px;
  font-size: 15px;
}

.field__input--file::file-selector-button {
  margin-right: 10px;
  padding: 7px 14px;
  border: none;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

@media (min-width: 640px) {
  .picker {
    flex-direction: row;
    align-items: flex-start;
  }
}

/* Polls */

.poll-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}

.poll + .poll {
  border-top: 1px solid var(--rule);
  margin-top: 18px;
  padding-top: 18px;
}

.poll--closed .poll__question,
.poll--closed .poll__label {
  color: var(--ink-soft);
}

.poll__head {
  margin-bottom: 12px;
}

.poll__question {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.poll__form {
  margin-bottom: 10px;
}

.poll__options {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.poll__option {
  position: relative;
  padding: 8px 0 9px 10px;
  border-left: 2px solid transparent;
}

.poll__option--yours {
  border-left-color: var(--accent);
}

.poll__option--yours .poll__label {
  font-weight: 700;
}

.poll__pick {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 32px;
  cursor: pointer;
}

.poll__pick input {
  width: 17px;
  height: 17px;
  flex: none;
  accent-color: var(--accent);
  align-self: center;
}

.poll__label {
  flex: 1 1 auto;
  min-width: 0;
}

.poll__count {
  flex: none;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink-soft);
}

.poll__bar {
  display: block;
  height: 6px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--surface-sunken);
  transition: width 0.2s var(--ease);
}

.poll__option--yours .poll__bar {
  background: var(--accent);
}

.poll__voters {
  margin: 4px 0 0;
  color: var(--ink-faint);
  font-size: 13px;
}

.poll__inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

/* Debt graph */

.graph {
  display: block;
  width: 100%;
  max-width: 340px;
  height: auto;
  margin: 0 auto 18px;
}

.graph__edge {
  fill: none;
  stroke: var(--ink-faint);
  stroke-width: 1.5;
}

.graph__edge--credit {
  stroke: var(--credit);
  stroke-width: 2;
}

.graph__edge--debit {
  stroke: var(--debit);
  stroke-width: 2;
}

.graph__head {
  fill: var(--ink-faint);
}

.graph__head--credit {
  fill: var(--credit);
}

.graph__head--debit {
  fill: var(--debit);
}

.graph__node {
  fill: var(--surface);
  stroke: var(--ink-soft);
  stroke-width: 1.5;
}

.graph__node--you {
  fill: var(--accent);
  stroke: var(--accent);
}

.graph__name {
  fill: var(--ink-soft);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
}

.graph__amount {
  fill: var(--ink-soft);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  stroke: var(--surface);
  stroke-width: 4;
  paint-order: stroke fill;
}

.graph__amount--credit {
  fill: var(--credit);
}

.graph__amount--debit {
  fill: var(--debit);
}

/* Error pages */

.void {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 28rem;
  margin: 0 auto;
  padding: 40px 0 24px;
  text-align: center;
}

.void__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
  border-radius: 24px;
  background: var(--accent-soft);
  color: var(--accent);
}

.void__icon .icon {
  width: 32px;
  height: 32px;
}

.void__code {
  margin: 0 0 6px;
  color: var(--ink-faint);
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.void .lede {
  margin-bottom: 28px;
}

.void__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.role {
  color: var(--ink-faint);
}

.role--admin {
  display: inline-flex;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}

/* Admin table */

.table-scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.table th,
.table td {
  padding: 10px 14px 10px 0;
  text-align: left;
  border-bottom: 1px solid var(--rule);
}

.table th {
  color: var(--ink-faint);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 639px) {
  .table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .table tr {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--rule);
  }

  .table tr:last-child {
    border-bottom: none;
  }

  .table td {
    display: flex;
    gap: 14px;
    justify-content: space-between;
    align-items: baseline;
    padding: 2px 0;
    border: none;
  }

  .table td::before {
    content: attr(data-label);
    flex: none;
    color: var(--ink-faint);
    font-size: 13px;
  }
}

/* Wishlists */

.wish-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: grid;
  gap: 0;
}

.wish {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 16px 0;
}

.wish + .wish {
  border-top: 1px solid var(--rule);
}

.wish--taken .wish__title,
.wish--taken .wish__note {
  color: var(--ink-faint);
}

.wish--taken .wish__image {
  opacity: 0.55;
}

.wish__image {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: none;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.wish__body {
  min-width: 0;
}

.wish__title {
  display: block;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}

.wish__title--link {
  color: var(--ink);
  text-decoration: none;
}

.wish__title--link:hover {
  color: var(--accent);
}

.wish__priority {
  display: inline-flex;
  margin: 8px 0 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.wish__priority--high {
  background: var(--accent-soft);
  color: var(--accent);
}

.wish__priority--low {
  color: var(--ink-faint);
}

.wish__note {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.wish__claim {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--ink-soft);
}

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

.wish__edit {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.picker--inline {
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}

@media (min-width: 640px) {
  .wish {
    grid-template-columns: 160px 1fr;
    align-items: start;
    column-gap: 20px;
  }

  .wish__image {
    grid-row: span 2;
  }

  .wish:not(:has(.wish__image)) .wish__body,
  .wish:not(:has(.wish__image)) .wish__actions {
    grid-column: 1 / -1;
  }

  .wish__actions {
    grid-column: 2;
  }
}

/* Poker */

:root {
  --suit-red: #c62828;
}

@media (prefers-color-scheme: dark) {
  :root {
    --suit-red: #ff6b6b;
  }
}

.poker__toggles {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.poker__toggle {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  transition:
    background-color 0.15s var(--ease),
    color 0.15s var(--ease);
}

.poker__toggle:hover {
  color: var(--ink);
}

.poker__toggle--active {
  background: var(--accent-soft);
  color: var(--accent);
}

.poker__subhead {
  margin: 16px 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

.poker__slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.poker__slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 12px;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
}

.poker__slot--empty {
  background: none;
  border: 1.5px dashed var(--rule);
}

.poker__grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 2px;
}

.poker__cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  background: var(--surface-2);
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.poker__cell--used {
  opacity: 0.3;
}

.poker__card {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.poker__stepper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.poker__stepper-value {
  min-width: 20px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: center;
}

.poker__odds {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 8px;
}

.poker__odds-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.poker__odds-row dt {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.poker__odds-row dd {
  margin: 0;
}

.poker__hand-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-weight: 700;
}

.poker__playing {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.poker__outs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 12px 0 0;
}

.card--h,
.card--d {
  color: var(--suit-red);
}

@media (min-width: 640px) {
  .poker__odds {
    flex-direction: row;
    gap: 28px;
  }

  .poker__odds-row {
    flex-direction: column;
    gap: 2px;
  }

  .poker__cell {
    font-size: 13px;
  }
}

/* Desktop: sidebar and the at-a-glance panel */

.masthead__label,
.glance {
  display: none;
}

.glance__placeholder {
  height: 140px;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  animation: glance-pulse 1.4s var(--ease) infinite alternate;
}

@keyframes glance-pulse {
  from {
    opacity: 1;
  }

  to {
    opacity: 0.5;
  }
}

.glance__groups {
  list-style: none;
  margin: 0 -10px;
  padding: 0;
}

.glance__group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--tap);
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.15s var(--ease);
}

.glance__group:hover {
  background: var(--surface-2);
}

.glance__group-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 1024px) {
  .shell--nav {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    align-items: start;
  }

  .shell--nav .masthead {
    height: 100vh;
    height: 100dvh;
    padding-top: 0;
    border-bottom: none;
  }

  .shell--nav .masthead::before {
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    border-right: 1px solid var(--rule);
  }

  .shell--nav .masthead__bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    height: 100%;
    min-height: 0;
    max-width: none;
    padding: 22px 14px calc(18px + env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .shell--nav .wordmark {
    margin: 0 0 22px;
    padding: 0 8px;
  }

  .shell--nav .tabbar {
    flex: 0 0 auto;
    flex-direction: column;
    gap: 4px;
  }

  .shell--nav .tabbar__link {
    justify-content: flex-start;
    gap: 12px;
    min-height: var(--tap);
    padding: 0 12px;
    border-radius: var(--radius);
  }

  .shell--nav .masthead__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--rule);
  }

  .shell--nav .masthead__actions form {
    display: flex;
  }

  .shell--nav .icon-button {
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    padding: 0 12px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
  }

  .shell--nav .icon-button .avatar {
    width: 28px;
    height: 28px;
    margin: 0 -3px;
    font-size: 12px;
  }

  .shell--nav .icon-button.active .avatar {
    box-shadow: none;
  }

  .shell--nav .masthead__label {
    display: inline;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .shell--nav .page {
    max-width: 48rem;
    padding: 40px 32px calc(64px + env(safe-area-inset-bottom));
  }
}

@media (min-width: 1280px) {
  .shell--nav {
    grid-template-columns: 248px minmax(0, 1fr) 328px;
  }

  .glance {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 100vh;
    max-height: 100dvh;
    padding: 40px 28px 40px 0;
    overflow-y: auto;
  }

  .glance .sheet {
    margin: 0;
    padding: 20px 22px;
  }

  .glance .section {
    font-size: 15px;
  }

  .compact-only {
    display: none;
  }
}

.sign-in-link__url {
  margin: 10px 0;
  font-weight: 600;
}

/* Tournaments */

.tournament-back {
  margin: 0 0 6px;
}

.tournament-start {
  margin: 16px 0 0;
}

.bracket {
  display: flex;
  gap: 14px;
  margin: 0 calc(var(--gutter) * -1);
  padding: 2px var(--gutter) 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}

.bracket__round {
  display: flex;
  flex: 0 0 15.5rem;
  flex-direction: column;
  scroll-snap-align: start;
}

.bracket__title {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.bracket__matches,
.match-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-around;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.match {
  padding: 4px 12px 8px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
}

.match--decided {
  background: var(--surface-2);
  border-color: transparent;
}

.match__side {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--tap);
}

.match__side + .match__side {
  border-top: 1px solid var(--rule);
}

.match__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.match__name--empty {
  color: var(--ink-faint);
  font-weight: 500;
}

.match__side--won .match__name {
  font-weight: 800;
}

.match__side--lost .match__name {
  color: var(--ink-faint);
}

.match__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
}

.match__note {
  margin: 6px 0 0;
  color: var(--ink-faint);
  font-size: 13px;
}

@media (min-width: 640px) {
  .bracket {
    margin: 0;
    padding-inline: 0;
  }

  .match-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Games */

.pill-row {
  display: flex;
  gap: 6px;
  margin: 0 calc(var(--gutter) * -1);
  padding: 0 var(--gutter) 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.pill-row::-webkit-scrollbar {
  display: none;
}

.pill {
  display: inline-flex;
  flex: none;
  align-items: center;
  min-height: var(--tap);
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.15s var(--ease),
    color 0.15s var(--ease);
}

.pill:hover {
  color: var(--ink);
}

.pill.active,
.pill--active {
  background: var(--accent-soft);
  color: var(--accent);
}

.minebar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.minebar__stat {
  min-width: 48px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.minebar .pill:first-of-type {
  margin-left: auto;
}

.minefield {
  --cols: 7;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: 2px;
  width: 100%;
  max-width: calc(var(--cols) * 48px);
  margin: 0 auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.minefield--medium {
  --cols: 8;
}

.minefield--hard {
  --cols: 9;
}

.mine {
  min-width: 0;
  aspect-ratio: 1;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  touch-action: manipulation;
  cursor: pointer;
}

.mine:disabled {
  color: var(--ink);
  opacity: 1;
  cursor: default;
}

.mine--open {
  background: var(--surface-2);
}

.mine--flag {
  color: var(--accent);
}

.mine--boom {
  background: var(--debit-soft);
  color: var(--debit);
}

:root {
  --wordle-on: #ffffff;
  --wordle-hit: #3d8b4f;
  --wordle-present: #b58f1a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --wordle-on: #0e0e13;
    --wordle-hit: #4f9e5f;
    --wordle-present: #c9a227;
  }
}

.wordle {
  display: grid;
  gap: 6px;
  max-width: 300px;
  margin: 0 auto 16px;
  padding: 0;
  list-style: none;
}

.wordle__row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.wordle__tile {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 2px solid var(--rule);
  border-radius: 6px;
  font-size: 26px;
  font-weight: 800;
  text-transform: uppercase;
}

.wordle__tile--hit {
  border-color: var(--wordle-hit);
  background: var(--wordle-hit);
  color: var(--wordle-on);
}

.wordle__tile--present {
  border-color: var(--wordle-present);
  background: var(--wordle-present);
  color: var(--wordle-on);
}

.wordle__tile--miss {
  border-color: var(--surface-sunken);
  background: var(--surface-sunken);
  color: var(--ink-soft);
}

.wordle__input {
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.keyboard {
  display: grid;
  gap: 6px;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.keyboard__row {
  display: flex;
  gap: 4px;
}

.keyboard__row:nth-child(2) {
  padding: 0 5%;
}

.keyboard__key {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 52px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
}

.keyboard__key--wide {
  flex-grow: 1.5;
  font-size: 13px;
}

.keyboard__key--hit {
  background: var(--wordle-hit);
  color: var(--wordle-on);
}

.keyboard__key--present {
  background: var(--wordle-present);
  color: var(--wordle-on);
}

.keyboard__key--miss {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--rule);
  color: var(--ink-faint);
}

.keyboard__key:disabled {
  cursor: default;
  opacity: 0.6;
}

.games-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.games-board > .sheet {
  margin-bottom: 0;
}

.board__levels {
  margin-top: 8px;
  margin-bottom: 8px;
}

.scores {
  margin: 0;
  padding: 0;
  list-style: none;
}

.score {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 6px 0;
}

.score + .score {
  box-shadow: inset 0 1px 0 var(--rule);
}

.score__rank {
  flex: none;
  white-space: nowrap;
  width: 20px;
  color: var(--ink-faint);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.score__who {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score__note {
  flex: none;
  white-space: nowrap;
  color: var(--ink-faint);
  font-size: 13px;
}

.score__value {
  flex: none;
  white-space: nowrap;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.minipattern {
  display: grid;
  flex: none;
  gap: 1px;
}

.minipattern__row {
  display: flex;
  gap: 1px;
}

.minipattern__cell {
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--surface-sunken);
}

.minipattern__cell--hit {
  background: var(--wordle-hit);
}

.minipattern__cell--present {
  background: var(--wordle-present);
}

@media (min-width: 640px) {
  .games-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

.aliases {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.alias {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  padding-left: 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.alias form {
  margin: 0;
}

.alias__remove {
  min-width: var(--tap);
  min-height: var(--tap);
  border: 0;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 18px;
  cursor: pointer;
}

.alias-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 0;
}

.alias-form input {
  box-sizing: border-box;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 12px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 16px;
}

.alias-form .button {
  min-height: var(--tap);
}

@media (min-width: 640px) {
  .alias-form {
    max-width: 22rem;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
