/* Piste — iOS-style design system.
   System colours, materials and type follow Apple's Human Interface
   Guidelines; every tap target stays at least 56px for use at the piste. */

:root {
  --bg: #000;
  --grouped: #000;
  --cell: #1c1c1e;
  --cell-2: #2c2c2e;
  --cell-3: #3a3a3c;
  --fill: rgba(120, 120, 128, 0.36);
  --fill-2: rgba(120, 120, 128, 0.32);
  --fill-3: rgba(118, 118, 128, 0.24);
  --fill-4: rgba(118, 118, 128, 0.18);
  --label: #fff;
  --label-2: rgba(235, 235, 245, 0.62);
  --label-3: rgba(235, 235, 245, 0.32);
  --sep: rgba(84, 84, 88, 0.6);
  --blue: #0a84ff;
  --red: #ff453a;
  --green: #30d158;
  --orange: #ff9f0a;
  --yellow: #ffd60a;
  --purple: #bf5af2;
  --indigo: #5e5ce6;
  --teal: #40c8e0;
  --gray: #8e8e93;
  --red-tint: rgba(255, 69, 58, 0.2);
  --green-tint: rgba(48, 209, 88, 0.18);
  --red-text: #ff6961;
  --green-text: #4ee07a;
  --material: rgba(28, 28, 30, 0.72);
  --material-thick: rgba(36, 36, 38, 0.86);
  --thumb: #636366;
  --scrim: rgba(0, 0, 0, 0.48);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --tap: 56px;
  --r: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --rounded: ui-rounded, 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #fff;
  --grouped: #f2f2f7;
  --cell: #fff;
  --cell-2: #f2f2f7;
  --cell-3: #e5e5ea;
  --fill: rgba(120, 120, 128, 0.2);
  --fill-2: rgba(120, 120, 128, 0.16);
  --fill-3: rgba(118, 118, 128, 0.12);
  --fill-4: rgba(116, 116, 128, 0.08);
  --label: #000;
  --label-2: rgba(60, 60, 67, 0.62);
  --label-3: rgba(60, 60, 67, 0.3);
  --sep: rgba(60, 60, 67, 0.22);
  --blue: #007aff;
  --red: #ff3b30;
  --green: #34c759;
  --orange: #ff9500;
  --yellow: #ffcc00;
  --purple: #af52de;
  --indigo: #5856d6;
  --teal: #30b0c7;
  --red-tint: rgba(255, 59, 48, 0.12);
  --green-tint: rgba(52, 199, 89, 0.14);
  --red-text: #d70015;
  --green-text: #248a3d;
  --material: rgba(249, 249, 249, 0.78);
  --material-thick: rgba(255, 255, 255, 0.9);
  --thumb: #fff;
  --scrim: rgba(0, 0, 0, 0.3);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--grouped);
  color: var(--label);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
body {
  overflow: hidden;
}
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}
.view {
  flex: 1;
  min-height: 0;
  position: relative;
}
[hidden] {
  display: none !important;
}
h1,
h2,
p {
  margin: 0;
}

.icon {
  width: 24px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon .f {
  fill: currentColor;
  stroke: none;
}
.icon .knock {
  stroke: var(--knock, #fff);
  stroke-width: 2.4;
}

/* ---------- buttons ---------- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 18px;
  border: 0;
  border-radius: var(--r);
  background: var(--fill-3);
  color: var(--blue);
  font: inherit;
  font-weight: 600;
  letter-spacing: -0.02em;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition:
    transform 0.12s var(--ease),
    opacity 0.12s,
    background-color 0.2s;
}
.btn:active:not(:disabled) {
  transform: scale(0.96);
  opacity: 0.7;
}
.btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.btn:focus-visible,
.row.tappable:focus-visible,
.switch:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 60%, transparent);
  outline-offset: 2px;
}
.btn-filled {
  background: var(--blue);
  color: #fff;
}
.btn-tinted {
  background: color-mix(in srgb, var(--blue) 18%, transparent);
  color: var(--blue);
}
.btn-gray {
  background: var(--fill-3);
  color: var(--label);
}
.btn-plain {
  background: transparent;
}
.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-block {
  display: flex;
  width: 100%;
}
.btn-large {
  min-height: 60px;
  font-size: 19px;
  border-radius: 16px;
}
.icon-btn {
  width: var(--tap);
  padding: 0;
  border-radius: 50%;
  background: var(--fill-3);
  color: var(--blue);
}

/* press-and-hold */
.hold {
  position: relative;
  overflow: hidden;
}
.hold-fill {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--red) 35%, transparent);
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}
.hold.holding .hold-fill {
  transform: scaleX(1);
  transition: transform var(--hold-ms, 700ms) linear;
}
.hold-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ---------- tab bar and modes ---------- */

.tab-stack {
  flex: 1;
  min-height: 0;
  position: relative;
}
.tab-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}
.bottom-bar {
  flex: none;
  position: relative;
  z-index: 5;
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  box-shadow: 0 -0.5px 0 var(--sep);
}
.modebar-slot {
  padding: 0 16px;
}
/* A slim switch: most of the screen is for the content. */
.modebar {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  height: 32px;
  margin: 6px 0 0;
  padding: 0 2px;
  border-radius: 10px;
  background: var(--fill-3);
}
.mode-thumb {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc((100% - 4px) / var(--n));
  border-radius: 8px;
  background: var(--thumb);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transform: translateX(calc(var(--i, 0) * 100%));
  transition: transform 0.38s cubic-bezier(0.34, 1.36, 0.64, 1);
}
.modebar button {
  position: relative;
  z-index: 1;
  border: 0;
  background: none;
  color: var(--label-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  touch-action: manipulation;
  transition: color 0.2s ease;
}
.modebar button[aria-selected='true'] {
  color: var(--label);
}
.tabbar {
  position: relative;
  display: flex;
  padding-bottom: var(--safe-bottom);
}
.tab-indicator {
  position: absolute;
  top: 5px;
  left: 0;
  width: calc(100% / 3);
  height: 28px;
  display: flex;
  justify-content: center;
  pointer-events: none;
  transform: translateX(calc(var(--i, 0) * 100%));
  transition: transform 0.45s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.tab-indicator span {
  width: 58px;
  height: 100%;
  border-radius: 14px;
  background: color-mix(in srgb, var(--blue) 18%, transparent);
}
.tabbar button {
  position: relative;
  flex: 1;
  min-height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding-top: 5px;
  background: none;
  border: 0;
  color: var(--gray);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  touch-action: manipulation;
  transition: color 0.25s ease;
}
.tab-icon {
  display: grid;
  place-items: center;
  height: 28px;
}
.tabbar .icon {
  width: 25px;
  height: 25px;
}
.tabbar button[aria-current='true'] {
  color: var(--blue);
}
@media (prefers-reduced-motion: reduce) {
  .mode-thumb,
  .tab-indicator {
    transition: none;
  }
}

/* ---------- about ---------- */

.about {
  padding-top: var(--safe-top);
}
.about-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  margin: 10px 0 16px;
}
.crest {
  display: block;
  width: auto;
  height: 112px;
  filter: drop-shadow(0 8px 18px rgba(75, 42, 140, 0.3));
}
.about-name {
  margin-top: 4px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.about-tagline {
  max-width: 320px;
  color: var(--label-2);
  font-size: 15px;
  line-height: 1.4;
}
.album {
  position: relative;
  aspect-ratio: 4 / 3;
  margin: 0 0 22px;
  border-radius: 22px;
  overflow: hidden;
  background: var(--cell);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.slide {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.slide.on {
  opacity: 1;
}
.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  transition: transform 6s ease-out;
}
.slide.on img {
  transform: scale(1);
}
.slide figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 40px 16px 34px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  color: #fff;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.slide figcaption b {
  font-size: 22px;
  letter-spacing: -0.01em;
}
.slide figcaption span {
  font-size: 14px;
  opacity: 0.85;
  font-weight: 500;
}
.placeholder {
  display: grid;
  place-items: center;
}
.placeholder.tint-a {
  background: linear-gradient(140deg, #5b2bb5, #12082e);
}
.placeholder.tint-b {
  background: linear-gradient(140deg, #0a6cff, #04163a);
}
.placeholder.tint-c {
  background: linear-gradient(140deg, #ff375f, #3a0614);
}
.ph-art {
  color: rgba(255, 255, 255, 0.85);
  transform: scale(1.06);
  transition: transform 6s ease-out;
  margin-bottom: 40px;
}
.slide.on .ph-art {
  transform: scale(1);
}
.ph-art .icon {
  width: 96px;
  height: 96px;
  stroke-width: 1.4;
}
.dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  display: flex;
  justify-content: center;
  gap: 2px;
}
.dot-btn {
  width: 24px;
  height: 20px;
  border: 0;
  padding: 0;
  background: none;
  display: grid;
  place-items: center;
}
.dot-btn::after {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.5);
  transition:
    width 0.3s ease,
    background 0.3s ease;
}
.dot-btn[aria-current='true']::after {
  width: 18px;
  background: #fff;
}
.linktree {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.lt-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 64px;
  padding: 10px 14px;
  border: 0;
  border-radius: 18px;
  background: var(--cell);
  color: var(--label);
  font: inherit;
  text-align: left;
  text-decoration: none;
  transition: transform 0.15s ease;
}
.lt-btn:active {
  transform: scale(0.97);
}
.lt-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: #fff;
}
.lt-icon .icon {
  width: 24px;
  height: 24px;
}
.lt-red {
  background: #d70015;
}
.lt-green {
  background: #25d366;
}
.lt-pink {
  background: linear-gradient(45deg, #f58529, #dd2a7b 50%, #8134af);
}
.lt-black {
  background: #111;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.lt-blue {
  background: var(--blue);
}
.lt-orange {
  background: #ff9500;
}
.lt-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.lt-text b {
  font-size: 17px;
  font-weight: 600;
}
.lt-text small {
  font-size: 13px;
  color: var(--label-2);
}
.lt-go {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--label-3);
}
.thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
}

/* ---------- grouped lists ---------- */

.group-wrap {
  margin: 0 0 28px;
}
.group-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  padding: 0 16px 7px;
  min-height: 24px;
  font-size: 13px;
  color: var(--label-2);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.group-header .btn {
  min-height: 44px;
  margin: -10px -4px -8px 0;
  min-width: 0;
  padding: 0 4px;
  background: none;
  text-transform: none;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.group {
  background: var(--cell);
  border-radius: 12px;
  overflow: hidden;
}
.group-footer {
  padding: 7px 16px 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--label-2);
}
.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--tap);
  padding: 8px 16px;
  background: transparent;
  border: 0;
  color: var(--label);
  font: inherit;
  text-align: left;
  -webkit-user-select: none;
  user-select: none;
}
.row + .row::before,
.row + .row-like::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: var(--sep-inset, 16px);
  border-top: 0.5px solid var(--sep);
}
.row:has(.row-lead) + .row::before {
  --sep-inset: 60px;
}
.row.tappable {
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.25s;
}
.row.tappable:active {
  background: var(--cell-3);
  transition: none;
}
.row-lead {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
}
.row-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.row-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-sub {
  font-size: 14px;
  color: var(--label-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-detail {
  color: var(--label-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.row-chev {
  width: 14px;
  height: 14px;
  color: var(--label-3);
  stroke-width: 3;
  margin-left: -4px;
}
.tone-accent,
.tone-accent .row-title {
  color: var(--blue);
}
.tone-danger,
.tone-danger .row-title {
  color: var(--red);
}
.row .switch {
  margin-right: -4px;
}
.row-inline {
  padding-top: 0;
  padding-bottom: 0;
}
.row .input {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: 0;
  background: transparent;
  border: 0;
}

.tile {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}
.tile .icon {
  width: 20px;
  height: 20px;
}
.tile-blue {
  background: var(--blue);
}
.tile-green {
  background: var(--green);
}
.tile-orange {
  background: var(--orange);
}
.tile-purple {
  background: var(--purple);
}
.tile-indigo {
  background: var(--indigo);
}
.tile-red {
  background: var(--red);
}
.tile-gray {
  background: var(--gray);
}
.tile-teal {
  background: var(--teal);
}

/* Buttons that render as list rows (e.g. press-and-hold rows). */
.btn.row {
  justify-content: flex-start;
  border-radius: 0;
  background: transparent;
  color: var(--label);
  font-weight: 400;
  letter-spacing: -0.01em;
  padding: 8px 16px;
}
.btn.row:active:not(:disabled) {
  transform: none;
  opacity: 1;
  background: var(--cell-3);
}
.btn.row.tone-danger {
  color: var(--red);
}
.btn.row .hold-label {
  gap: 12px;
}

/* switch */
.switch {
  position: relative;
  flex: none;
  width: 64px;
  height: var(--tap);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}
.switch::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 12.5px;
  width: 51px;
  height: 31px;
  border-radius: 16px;
  background: var(--fill);
  transition: background-color 0.25s;
}
.switch[aria-checked='true']::before {
  background: var(--green);
}
.switch-thumb {
  position: absolute;
  left: 8px;
  top: 14.5px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.15),
    0 3px 1px rgba(0, 0, 0, 0.06);
  transition: transform 0.25s var(--ease);
}
.switch[aria-checked='true'] .switch-thumb {
  transform: translateX(20px);
}

/* segmented control */
.segmented {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  padding: 3px;
  border-radius: 12px;
  background: var(--fill-3);
  min-height: var(--tap);
}
.seg-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / var(--n));
  transform: translateX(calc(100% * var(--i)));
  border-radius: 9px;
  background: var(--thumb);
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.12),
    0 3px 1px rgba(0, 0, 0, 0.04);
  transition: transform 0.25s var(--ease);
}
.seg-thumb.none {
  opacity: 0;
}
.segmented button {
  position: relative;
  min-height: 50px;
  padding: 0 6px;
  border: 0;
  background: none;
  color: var(--label);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  touch-action: manipulation;
  cursor: pointer;
}
.segmented button.on {
  font-weight: 600;
}
.group .segmented {
  margin: 10px 12px;
}

/* ---------- bout screen ---------- */

.bout {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 12px 10px;
  padding-top: calc(8px + var(--safe-top));
  background: var(--bg);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.arena {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    'top top'
    'left right'
    'center center';
}
.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 8px;
}
.format {
  flex: 1;
  min-width: 0;
  justify-content: flex-start;
  padding: 0 14px 0 16px;
  border-radius: 28px;
  background: var(--fill-3);
  color: var(--label);
  gap: 6px;
}
.fmt-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  line-height: 1.15;
}
.fmt-main,
.fmt-sub {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fmt-main {
  font-weight: 600;
}
.fmt-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--label-2);
}
.fmt-sub.accent {
  color: var(--blue);
  font-weight: 600;
}
.format .icon {
  width: 14px;
  height: 14px;
  stroke-width: 3;
  color: var(--label-2);
  margin-left: auto;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  min-width: 0;
}
.side.left {
  grid-area: left;
  --lamp: var(--red);
  --lamp-tint: var(--red-tint);
  --lamp-text: var(--red-text);
}
.side.right {
  grid-area: right;
  --lamp: var(--green);
  --lamp-tint: var(--green-tint);
  --lamp-text: var(--green-text);
}
.name {
  justify-content: flex-start;
  gap: 6px;
  padding: 0 4px;
  background: none;
  color: var(--lamp-text);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.side.right .name {
  flex-direction: row-reverse;
}
.name .nm {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.name .icon {
  width: 16px;
  height: 16px;
  opacity: 0.55;
}
.score {
  flex: 1;
  min-height: 0;
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: var(--lamp-tint);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--lamp) 55%, transparent);
  color: var(--label);
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  overflow: hidden;
  container-type: size;
  transition: transform 0.12s var(--ease);
}
.score:active:not(:disabled) {
  transform: scale(0.98);
}
.score:disabled {
  cursor: default;
}
.score .num {
  font-family: var(--rounded);
  font-size: 30vw;
  font-size: min(80cqh, 62cqw);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.score.flash {
  animation: lamp 0.75s ease-out;
}
@keyframes lamp {
  0%,
  30% {
    background: var(--lamp);
    color: #fff;
  }
}
.score.winner {
  background: var(--lamp);
  color: #fff;
  box-shadow: none;
}
.card-chips {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 4px;
}
.card-chips i {
  width: 15px;
  height: 21px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.c-yellow {
  background: var(--yellow);
}
.c-red {
  background: #ff3b30;
}
.c-black {
  background: #000;
  outline: 1px solid rgba(255, 255, 255, 0.5);
}
.prio-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  height: 30px;
  padding: 0 10px;
  border-radius: 15px;
  background: #fff;
  color: #000;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.side-ctl {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.minus,
.card-btn {
  background: var(--fill-3);
  color: var(--label);
  padding: 0 8px;
}
.minus {
  font-family: var(--rounded);
  font-size: 20px;
  font-weight: 700;
}
.card-btn {
  font-size: 16px;
}
.card-icon {
  width: 13px;
  height: 18px;
  border-radius: 2.5px;
  background: linear-gradient(90deg, var(--yellow) 50%, #ff3b30 50%);
}

.center {
  grid-area: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.clock-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}
.round {
  width: 68px;
  height: 68px;
  min-width: 68px;
  padding: 0;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 600;
}
.round .hold-label {
  flex-direction: column;
  gap: 0;
  font-size: 12px;
}
.round .icon {
  width: 22px;
  height: 22px;
}
.reset {
  background: var(--fill-3);
  color: var(--label);
}
.startstop {
  background: color-mix(in srgb, var(--green) 24%, transparent);
  color: var(--green);
}
.startstop .icon {
  width: 26px;
  height: 26px;
}
.startstop.running {
  background: color-mix(in srgb, var(--red) 24%, transparent);
  color: var(--red);
}
.clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 76px;
  padding: 0 4px;
  border-radius: 20px;
  background: none;
  color: var(--label);
}
.clock:disabled {
  opacity: 1;
}
.clock .time {
  font-family: var(--rounded);
  font-size: 62px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.clock-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--label-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  min-height: 1.2em;
  margin-top: 2px;
}
.clock.running .time {
  color: var(--orange);
}
.clock.low .time {
  color: var(--yellow);
}
.clock.zero .time {
  color: var(--red);
}
.clock.break .time {
  color: var(--blue);
}
.clock-ctl,
.extra {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
}
.preset {
  background: var(--fill-3);
  color: var(--label);
  font-family: var(--rounded);
  font-variant-numeric: tabular-nums;
  padding: 0 4px;
}
.preset.set {
  font-family: var(--font);
}
.double {
  background: linear-gradient(90deg, var(--red-tint), var(--green-tint));
  color: var(--label);
  font-weight: 700;
}
.period {
  background: var(--fill-3);
  color: var(--label);
}
.no-timer .clock-row,
.no-timer .clock-ctl {
  display: none;
}

/* Tap anywhere to stop */
.run-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  box-shadow: inset 0 0 0 4px var(--orange);
  border-radius: 0;
  touch-action: none;
  cursor: pointer;
}
.run-hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--material-thick);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow);
  font-weight: 700;
  font-size: 17px;
  white-space: nowrap;
}
.run-hint::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orange);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

/* Flash at 0:00 */
.time-flash {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}
.time-flash.go {
  animation: timeup 2s steps(1, end);
}
@keyframes timeup {
  0%,
  20%,
  40%,
  60% {
    background: color-mix(in srgb, var(--red) 55%, transparent);
  }
  10%,
  30%,
  50%,
  70%,
  100% {
    background: transparent;
  }
}

/* Priority draw */
.drawing .score {
  transition: none;
}
.drawing[data-draw='left'] .side.left .score,
.drawing[data-draw='right'] .side.right .score {
  background: var(--lamp);
  color: #fff;
  box-shadow: 0 0 0 4px #fff inset;
}

/* Contextual card: bout over / time / period end */
.banner {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 28px;
  background: var(--material-thick);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  box-shadow: var(--shadow);
  animation: rise 0.35s var(--ease);
}
.banner-kicker {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--label-2);
}
.banner-result {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.banner-result .who.left {
  color: var(--red-text);
}
.banner-result .who.right {
  color: var(--green-text);
}
.banner-result .sc {
  font-family: var(--rounded);
  font-variant-numeric: tabular-nums;
}
.banner-result .icon {
  align-self: center;
  width: 28px;
  height: 28px;
  color: var(--green);
  --knock: var(--material-thick);
}
.banner-note {
  font-size: 15px;
  color: var(--label-2);
}
.banner .actions {
  display: flex;
  gap: 8px;
}
.banner .actions .btn {
  flex: 1;
  white-space: nowrap;
}
.banner .actions .btn-gray {
  flex: 0 0 auto;
}
@keyframes rise {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}

/* Landscape: scores either side, clock and controls in the middle. */
@media (orientation: landscape) {
  .arena {
    grid-template-columns: 1fr minmax(270px, 44%) 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      'left top right'
      'left center right';
  }
  .topbar .format {
    padding: 0 8px 0 12px;
    font-size: 16px;
  }
  .format > .icon {
    display: none;
  }
  .center {
    min-height: 0;
    justify-content: center;
  }
  .clock .time {
    font-size: min(60px, 16vh);
  }
  .round {
    width: 60px;
    height: 60px;
    min-width: 60px;
  }
  .score .num {
    font-size: 40vh;
    font-size: min(100cqh, 74cqw);
    line-height: 0.8;
  }
  .banner {
    left: 22%;
    right: 22%;
    padding: 16px;
  }
  .banner-result {
    font-size: 24px;
  }
}

@media (orientation: portrait) and (max-height: 620px) {
  .clock {
    min-height: 64px;
  }
  .clock .time {
    font-size: 50px;
  }
  .round {
    width: 60px;
    height: 60px;
    min-width: 60px;
  }
}

/* ---------- pages ---------- */

.page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--grouped);
}
.navbar {
  position: relative;
  z-index: 4;
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 4px;
  min-height: calc(var(--tap) + 8px);
  padding: calc(4px + var(--safe-top)) 8px 4px;
  background: var(--grouped);
  transition: background-color 0.2s;
}
.navbar.scrolled {
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  box-shadow: 0 0.5px 0 var(--sep);
}
.navbar .nav-l,
.navbar .nav-r {
  display: flex;
  align-items: center;
  gap: 4px;
}
.navbar .nav-r {
  justify-content: flex-end;
}
.nav-title {
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52vw;
  transition: opacity 0.2s;
}
.navbar.large .nav-title {
  opacity: 0;
}
.navbar.large.scrolled .nav-title {
  opacity: 1;
}
.nav-text {
  background: none;
  padding: 0 8px;
  min-width: 0;
  font-weight: 400;
}
.nav-text.bold {
  font-weight: 600;
}
.nav-back {
  background: none;
  padding: 0 8px 0 0;
  min-width: 0;
  gap: 2px;
  font-weight: 400;
}
.nav-back .icon {
  width: 24px;
  height: 24px;
  stroke-width: 2.6;
}
.navbar .icon-btn {
  background: none;
}
.navbar .icon-btn .icon {
  width: 26px;
  height: 26px;
}
.page-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 16px calc(28px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.large-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.03em;
  padding: 2px 4px 10px;
}
.page-foot {
  flex: none;
  padding: 10px 16px calc(10px + var(--safe-bottom));
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  box-shadow: 0 -0.5px 0 var(--sep);
}
.summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 2px 4px 20px;
}
.summary-line {
  font-size: 15px;
  color: var(--label-2);
}
.progress {
  height: 6px;
  border-radius: 3px;
  background: var(--fill-3);
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--blue);
  transition: width 0.4s var(--ease);
}
.progress.done span {
  background: var(--green);
}

.searchbar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 12px;
  margin: 0 0 20px;
  border-radius: 12px;
  background: var(--fill-3);
  color: var(--label-2);
}
.searchbar .icon {
  width: 18px;
  height: 18px;
}
.searchbar input {
  flex: 1;
  min-width: 0;
  height: 48px;
  border: 0;
  background: none;
  color: var(--label);
  font: inherit;
  outline: none;
}
.searchbar input::placeholder {
  color: var(--label-2);
}

.input {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--cell);
  color: var(--label);
  font: inherit;
  outline: none;
}
.input::placeholder {
  color: var(--label-3);
}
input[type='date'].input {
  width: auto;
  text-align: right;
  color: var(--blue);
  min-height: 40px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--fill-3);
}

/* poule list */
.poule-row {
  display: flex;
  align-items: center;
}
.poule-row > .row {
  flex: 1;
  min-width: 0;
  padding-right: 4px;
}
.poule-row + .poule-row::before {
  content: '';
  position: absolute;
  left: 60px;
  right: 0;
  border-top: 0.5px solid var(--sep);
}
.poule-row {
  position: relative;
}
.poule-row .icon-btn {
  background: none;
  color: var(--label-3);
  flex: none;
}
.ring {
  --p: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: conic-gradient(var(--blue) calc(var(--p) * 1turn), var(--fill-3) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4.5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4.5px), #000 calc(100% - 4px));
}
.status-done {
  color: var(--green);
  display: inline-flex;
  --knock: var(--cell);
}
.status-done .icon {
  width: 26px;
  height: 26px;
}
.inline-icon {
  display: inline-block;
  vertical-align: -2px;
  width: 14px;
  height: 14px;
  margin-right: 2px;
}
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 56px 24px 24px;
}
.empty > .icon {
  width: 64px;
  height: 64px;
  stroke-width: 1.4;
  color: var(--label-3);
  margin-bottom: 6px;
}
.empty h2 {
  font-size: 22px;
  font-weight: 700;
}
.empty p {
  color: var(--label-2);
  max-width: 300px;
  margin-bottom: 14px;
}
.empty .btn {
  width: min(100%, 300px);
}

/* create form */
.num-badge {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--fill-3);
  font-family: var(--rounded);
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.row .mini {
  min-width: var(--tap);
  width: var(--tap);
  min-height: var(--tap);
  margin: -8px -10px -8px 0;
  background: none;
  padding: 0;
}
.row .mini.del {
  color: var(--red);
  --knock: var(--cell);
}
.add-lead {
  display: flex;
  color: var(--green);
  --knock: var(--cell);
}
.add-lead .icon {
  width: 26px;
  height: 26px;
}
.row .mini .icon {
  width: 24px;
  height: 24px;
}
.add-fencer {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0;
  align-items: center;
  padding: 0 6px 0 16px;
  position: relative;
}
.add-fencer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 16px;
  right: 0;
  border-top: 0.5px solid var(--sep);
}
.group > .add-fencer:first-child::before {
  display: none;
}
.add-fencer .input {
  background: none;
  padding: 0;
  border-radius: 0;
}
.add-fencer .input + .input {
  border-left: 0.5px solid var(--sep);
  padding-left: 12px;
}
.add-fencer .btn {
  min-width: 0;
  padding: 0 12px;
  background: none;
}

/* up-next card */
.next-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  margin: 0 0 28px;
  border-radius: 20px;
  background: var(--cell);
}
.nc-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--label-2);
}
.next-card.live .nc-label {
  color: var(--orange);
}
.next-card.done .nc-label {
  color: var(--green);
}
.nc-match {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.nc-match .l {
  color: var(--red-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nc-match .r {
  color: var(--green-text);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nc-v {
  font-size: 15px;
  font-weight: 600;
  color: var(--label-3);
}
.nc-score {
  font-family: var(--rounded);
  font-variant-numeric: tabular-nums;
}
.nc-deck {
  font-size: 15px;
  color: var(--label-2);
}
.nc-winner {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 700;
}
.nc-winner .icon {
  width: 30px;
  height: 30px;
  color: var(--yellow);
}

/* the poule sheet grid */
.sheet-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--cell);
  border-radius: 12px;
}
table.sheet {
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
  min-width: 100%;
}
.sheet th,
.sheet td {
  padding: 0;
  text-align: center;
  background: var(--cell);
  border-bottom: 0.5px solid var(--sep);
  border-right: 0.5px solid var(--sep);
}
.sheet tr:last-child > * {
  border-bottom: 0;
}
.sheet thead th {
  height: 36px;
  font-size: 13px;
  font-weight: 600;
  color: var(--label-2);
}
.sheet .name-col {
  position: sticky;
  left: 0;
  z-index: 2;
  text-align: left;
  padding: 0 10px;
  min-width: 112px;
  max-width: 132px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sheet tbody .name-col {
  font-weight: 600;
  font-size: 15px;
}
.sheet .num-badge {
  width: 24px;
  height: 24px;
  font-size: 13px;
  margin-right: 8px;
}
.sheet .num-col {
  min-width: var(--tap);
}
.sheet td.diag {
  background: var(--fill-3);
}
.sheet .cell {
  display: flex;
  width: 100%;
  min-width: var(--tap);
  height: var(--tap);
  border-radius: 0;
  background: transparent;
  color: var(--label);
  font-family: var(--rounded);
  font-size: 17px;
  font-weight: 500;
  padding: 0;
}
.sheet .cell:active:not(:disabled) {
  transform: none;
  background: var(--cell-3);
}
.sheet .cell.v {
  color: var(--green-text);
  font-weight: 700;
}
.sheet .cell.d {
  color: var(--red-text);
}
.sheet .cell.next {
  box-shadow: inset 0 0 0 2.5px var(--blue);
  color: var(--blue);
}
.sheet .res {
  min-width: 46px;
  padding: 0 8px;
  font-family: var(--rounded);
  font-weight: 600;
  background: var(--cell-2);
}
.sheet thead .res {
  font-family: var(--font);
}
.sheet .rank {
  font-weight: 800;
  color: var(--blue);
}

.rank-badge {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border-radius: 15px;
  background: var(--fill-3);
  font-family: var(--rounded);
  font-weight: 700;
  font-size: 15px;
}
.rank-badge.gold {
  background: var(--yellow);
  color: #000;
}
.bout-n {
  display: inline-block;
  min-width: 24px;
  color: var(--label-2);
  font-family: var(--rounded);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.bout-names .w {
  font-weight: 700;
}
.bout-names .l {
  color: var(--label-2);
}
.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.tag-next {
  background: color-mix(in srgb, var(--blue) 18%, transparent);
  color: var(--blue);
}
.tag-live {
  background: color-mix(in srgb, var(--orange) 20%, transparent);
  color: var(--orange);
}
.score-detail {
  font-family: var(--rounded);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--label);
}

/* team matches */
.team-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin: 0 10px;
}
.team-dot.red {
  background: var(--red);
}
.team-dot.green {
  background: var(--green);
}
.num-badge.muted {
  color: var(--label-2);
}
.num-badge.red {
  background: var(--red-tint);
  color: var(--red-text);
}
.num-badge.green {
  background: var(--green-tint);
  color: var(--green-text);
}
/* three-weapon fixtures */
.fixture-tile {
  font-family: var(--rounded);
  font-size: 17px;
}
.sb-caption {
  margin-top: 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--label-2);
}
.weapon-switch {
  margin: 0 0 18px;
}
.weapon-row .row-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.red-text {
  color: var(--red-text);
  font-weight: 600;
}
.green-text {
  color: var(--green-text);
  font-weight: 600;
}
.nc-label.live {
  color: var(--orange);
}
.sb {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.sb-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 8px 10px;
  border-radius: 16px;
  min-width: 0;
}
.sb-team.red {
  background: var(--red-tint);
  color: var(--red-text);
}
.sb-team.green {
  background: var(--green-tint);
  color: var(--green-text);
}
.sb-name {
  max-width: 100%;
  font-weight: 700;
  font-size: 17px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sb-score {
  font-family: var(--rounded);
  font-size: 56px;
  font-weight: 700;
  line-height: 1.05;
  color: var(--label);
  font-variant-numeric: tabular-nums;
}
.st-sub {
  font-size: 13px;
  color: var(--label-2);
  margin-top: -4px;
}
.team-label {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lamp-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.score.winner .team-label,
.score.flash .team-label {
  color: inherit;
}

/* sharing */
.dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gray);
}
.dot.live {
  background: var(--green);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 25%, transparent);
}
.dot.connecting {
  background: var(--orange);
}
.share-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 8px 4px 4px;
}
.share-hero .tile {
  width: 56px;
  height: 56px;
  border-radius: 14px;
}
.share-hero .tile .icon {
  width: 30px;
  height: 30px;
}
.share-hero p {
  color: var(--label-2);
  font-size: 15px;
}
.share-code {
  font-family: var(--rounded);
  font-size: 46px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding: 12px 0;
  margin: 0 0 14px;
  border-radius: 16px;
  background: var(--fill-4);
  user-select: all;
  -webkit-user-select: all;
}

/* ---------- modals ---------- */

#modal-root {
  position: relative;
  z-index: 50;
}
.modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--scrim);
  opacity: 0;
  transition: opacity 0.25s;
}
.modal-wrap.alert {
  align-items: center;
}
.modal-wrap.open {
  opacity: 1;
}
.modal-panel {
  color: var(--label);
  max-height: 92vh;
  max-height: 92dvh;
  overflow: auto;
  overscroll-behavior: contain;
}
.modal-panel.sheet {
  position: relative;
  width: 100%;
  max-width: 560px;
  border-radius: 22px 22px 0 0;
  padding: 0 16px calc(18px + var(--safe-bottom));
  background: var(--grouped);
  box-shadow: var(--shadow);
  transform: translateY(100%);
  transition: transform 0.4s var(--ease);
}
:root:not([data-theme='light']) .modal-panel.sheet {
  background: var(--cell);
}
:root:not([data-theme='light']) .modal-panel.sheet .group {
  background: var(--cell-2);
}
:root:not([data-theme='light']) .modal-panel.sheet .row.tappable:active {
  background: var(--cell-3);
}
.open .modal-panel.sheet {
  transform: none;
}
.grabber {
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: var(--label-3);
  margin: 6px auto 0;
}
.sheet-nav {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: var(--tap);
  margin: 0 -8px 10px;
  background: inherit;
}
.modal-panel.sheet .sheet-nav {
  background: transparent;
}
.sheet-nav .r {
  justify-self: end;
}
.sheet-nav .l {
  justify-self: start;
}
.sheet-title {
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60vw;
}
.sheet-body > .group-wrap:last-child {
  margin-bottom: 8px;
}

/* alert */
.modal-panel.alert {
  width: min(86vw, 320px);
  border-radius: 16px;
  background: var(--material-thick);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  box-shadow: var(--shadow);
  transform: scale(1.12);
  opacity: 0;
  transition:
    transform 0.3s var(--ease),
    opacity 0.2s;
}
.open .modal-panel.alert {
  transform: none;
  opacity: 1;
}
.alert-body {
  padding: 20px 18px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.alert-body h2 {
  font-size: 17px;
  font-weight: 600;
}
.alert-body p {
  font-size: 14px;
  line-height: 1.35;
  color: var(--label);
  opacity: 0.85;
}
.alert-input {
  margin-top: 10px;
  min-height: 44px;
  padding: 0 10px;
  border: 0.5px solid var(--sep);
  border-radius: 8px;
  background: var(--cell);
  color: var(--label);
  font: inherit;
  font-size: 17px;
  outline: none;
}
.alert-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  border-top: 0.5px solid var(--sep);
}
.alert-actions.stacked {
  grid-auto-flow: row;
}
.alert-btn {
  min-height: var(--tap);
  border-radius: 0;
  background: none;
  color: var(--blue);
  font-weight: 400;
  font-size: 17px;
}
.alert-btn + .alert-btn {
  border-left: 0.5px solid var(--sep);
}
.alert-actions.stacked .alert-btn + .alert-btn {
  border-left: 0;
  border-top: 0.5px solid var(--sep);
}
.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 4px 0 18px;
}
.qr {
  width: min(58vw, 220px);
  height: auto;
  border-radius: 14px;
  background: #fff;
}
.qr-caption {
  font-size: 13px;
  color: var(--label-2);
  text-align: center;
}
.alert-btn.bold {
  font-weight: 600;
}
.alert-btn.danger {
  color: var(--red);
}
.alert-btn:active:not(:disabled) {
  transform: none;
  opacity: 1;
  background: var(--fill-4);
}

/* action sheet */
.modal-panel.action {
  width: 100%;
  max-width: 480px;
  padding: 0 10px calc(10px + var(--safe-bottom));
  transform: translateY(110%);
  transition: transform 0.4s var(--ease);
}
.open .modal-panel.action {
  transform: none;
}
.action-sheet {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.action-group {
  border-radius: 14px;
  overflow: hidden;
  background: var(--material-thick);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
}
.action-head {
  padding: 14px 16px;
  text-align: center;
  border-bottom: 0.5px solid var(--sep);
}
.action-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--label-2);
}
.action-sub {
  font-size: 13px;
  color: var(--label-2);
  margin-top: 2px;
}
.action-btn {
  width: 100%;
  min-height: 58px;
  border-radius: 0;
  background: none;
  color: var(--blue);
  font-size: 19px;
  font-weight: 400;
}
.action-btn + .action-btn {
  border-top: 0.5px solid var(--sep);
}
.action-btn:active:not(:disabled) {
  transform: none;
  opacity: 1;
  background: var(--fill-4);
}
.action-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.action-btn.tone-danger {
  color: var(--red);
}
.action-btn.card-y .icon {
  color: var(--yellow);
}
.action-btn.card-r .icon {
  color: #ff3b30;
}
.action-btn.card-b .icon {
  color: var(--gray);
}
.action-cancel {
  border-radius: 14px;
  background: var(--cell);
  font-weight: 600;
}
:root:not([data-theme='light']) .action-cancel {
  background: var(--cell-2);
}

/* keypad */
.keypad-hint {
  text-align: center;
  font-size: 14px;
  color: var(--label-2);
}
.keypad-display {
  font-family: var(--rounded);
  font-size: 64px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding: 6px 0 14px;
}
.keypad-display.placeholder {
  color: var(--label-3);
}
.keys {
  display: grid;
  grid-template-columns: repeat(3, 76px);
  justify-content: center;
  gap: 14px 26px;
  margin-bottom: 18px;
}
.key {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  padding: 0;
  background: var(--fill-3);
  color: var(--label);
  font-family: var(--rounded);
  font-size: 32px;
  font-weight: 500;
}
.key-del {
  background: none;
}
.key-del .icon {
  width: 30px;
  height: 30px;
  stroke-width: 1.8;
}

/* manual result entry */
.steppers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 22px;
}
.stepper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 10px 10px;
  border-radius: 18px;
  background: var(--cell);
  min-width: 0;
}
:root:not([data-theme='light']) .modal-panel .stepper {
  background: var(--cell-2);
}
.st-name {
  max-width: 100%;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stepper:first-child .st-name {
  color: var(--red-text);
}
.stepper:last-child .st-name {
  color: var(--green-text);
}
.st-val {
  font-family: var(--rounded);
  font-size: 52px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.st-row {
  display: flex;
  gap: 8px;
}
.st-btn {
  width: var(--tap);
  border-radius: 50%;
  padding: 0;
  background: var(--fill-3);
  color: var(--label);
}
.st-target {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 20px;
  font-size: 15px;
  background: none;
}
.field-label {
  display: block;
  padding: 0 16px 7px;
  font-size: 13px;
  color: var(--label-2);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.field {
  margin: 0 0 22px;
}

/* ---------- toast (HUD pill) ---------- */

#toast-root {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(var(--safe-top) + 10px);
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 60;
}
[data-tab='bout'] #toast-root {
  top: calc(var(--safe-top) + 74px);
}
body:has(.modal-wrap.open) #toast-root {
  top: calc(var(--safe-top) + 8px);
}
.toast {
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  min-height: 48px;
  padding: 0 20px;
  border-radius: 24px;
  background: var(--material-thick);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  box-shadow: var(--shadow);
  font-size: 15px;
  font-weight: 600;
  animation: drop 0.35s var(--ease);
  transition:
    opacity 0.2s,
    transform 0.2s;
}
.toast.out {
  opacity: 0;
  transform: translateY(-10px);
}
.toast.has-action {
  padding-right: 4px;
}
.toast-action {
  pointer-events: auto;
  min-height: 48px;
  padding: 0 14px;
  background: none;
  color: var(--blue);
  font-size: 15px;
}
@keyframes drop {
  from {
    transform: translateY(-16px) scale(0.96);
    opacity: 0;
  }
}

/* ---------- print ---------- */

#print-root {
  display: none;
}
@media print {
  @page {
    size: A4 landscape;
    margin: 12mm;
  }
  html,
  body {
    background: #fff !important;
    color: #000 !important;
    height: auto;
    overflow: visible;
  }
  body > *:not(#print-root) {
    display: none !important;
  }
  #print-root {
    display: block;
    font-family: -apple-system, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  #print-root h1 {
    font-size: 22pt;
    margin: 0;
  }
  #print-root .sub {
    color: #6e6e73;
    margin: 2pt 0 12pt;
  }
  #print-root .hero {
    display: flex;
    gap: 10pt;
    margin-bottom: 6pt;
  }
  #print-root .hero div {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 8pt 14pt;
    border-radius: 10pt;
    background: #f2f2f7;
    font-weight: 700;
    font-size: 14pt;
  }
  #print-root .hero b {
    font-size: 26pt;
    color: #000;
  }
  #print-root .hero .red {
    color: #d70015;
  }
  #print-root .hero .green {
    color: #248a3d;
  }
  #print-root .note {
    font-weight: 600;
  }
  #print-root section {
    break-inside: avoid;
    margin-top: 12pt;
  }
  #print-root h2 {
    font-size: 9pt;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6e6e73;
    margin: 0 0 4pt;
  }
  #print-root table {
    border-collapse: collapse;
    font-size: 10.5pt;
  }
  #print-root th,
  #print-root td {
    border: 0.75pt solid #c7c7cc;
    padding: 3pt 8pt;
    min-width: 22pt;
    height: 18pt;
    text-align: center;
  }
  #print-root th {
    background: #f2f2f7;
    color: #6e6e73;
    font-weight: 600;
  }
  #print-root .left {
    text-align: left;
  }
  #print-root .b {
    font-weight: 700;
  }
  #print-root .t-win,
  #print-root .t-green {
    color: #248a3d;
  }
  #print-root .t-loss,
  #print-root .t-red {
    color: #d70015;
  }
  #print-root .t-muted {
    color: #6e6e73;
  }
  #print-root .f-diag {
    background: #d1d1d6;
  }
  #print-root .f-gold {
    background: #ffcc00;
  }
  #print-root .foot {
    margin-top: 14pt;
    font-size: 8pt;
    color: #8e8e93;
  }
}

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

/* elimination tableau */
.intro {
  margin: 0 4px 20px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--label-2);
}
.tableau-tile .icon {
  width: 18px;
  height: 18px;
}
.round-tabs {
  margin: 0 0 18px;
}
.de-bout {
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.de-lines {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.de-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  min-width: 0;
}
.de-seed {
  min-width: 22px;
  font-family: var(--rounded);
  font-size: 13px;
  font-weight: 600;
  color: var(--label-3);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.de-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.de-score {
  font-family: var(--rounded);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 26px;
  text-align: right;
}
.de-line.w .de-name {
  font-weight: 700;
}
.de-line.l {
  color: var(--label-2);
}
.de-line.tbd .de-name {
  color: var(--label-3);
  font-style: italic;
}
.de-bout.bye .de-score {
  color: var(--label-3);
  font-weight: 600;
  font-size: 14px;
}
.podium {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pod {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  border-radius: 14px;
  background: var(--fill-3);
  text-align: center;
  min-width: 0;
}
.pod b {
  font-family: var(--rounded);
  font-size: 20px;
}
.pod span {
  max-width: 100%;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pod.p1 {
  background: color-mix(in srgb, var(--yellow, #ffcc00) 28%, transparent);
}
