/* =================================================================
   柔道大会管理 — application styles
   --------------------------------------------------------------------
   Design ethos: restrained Japanese dojo administration.
   Washi ivory, sumi ink, aizome indigo and a vermilion seal accent.
   Compact desktop default, responsive down to phone.
   ================================================================= */

/* -- 1. Reset ----------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body,
h1, h2, h3, h4, h5, h6,
p, ul, ol, li, figure, blockquote,
dl, dd, fieldset, legend { margin: 0; padding: 0; }

ul, ol { list-style: none; }

img, picture, svg { max-width: 100%; display: block; }

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

button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

a { color: inherit; text-decoration: none; }

/* -- 2. Tokens ---------------------------------------------------- */
:root {
  /* paper-warm neutrals */
  --bg-page:        #eee9dd;
  --bg-surface:     #fcfaf4;
  --bg-sunken:      #e8e2d5;
  --bg-rail:        #111a24;
  --bg-rail-hover:  #192838;

  /* ink */
  --ink-1:          #171916;
  --ink-2:          #54564f;
  --ink-3:          #7b7a70;
  --ink-on-dark:    #f3efe4;
  --ink-on-dark-2:  #c2c5c0;
  --ink-on-dark-3:  #858d91;

  /* hairlines */
  --rule:           #d1cabb;
  --rule-soft:      #e5dfd2;
  --rule-strong:    #aaa496;
  --rule-on-dark:   #2d3a45;

  /* accent — 藍 (aizome) deep indigo */
  --accent:         #213d5b;
  --accent-hover:   #172f49;
  --accent-press:   #10243a;
  --accent-soft:    #dfe8ef;
  --accent-on:      #ffffff;
  --vermilion:      #a33b2b;
  --vermilion-dark: #7f2c21;
  --vermilion-soft: #f2dfd8;

  /* status */
  --danger:         #8a1d24;
  --danger-soft:    #f3e3e4;
  --success:        #2c5a39;
  --success-soft:   #e3ede5;
  --warning:        #7a5a16;
  --warning-soft:   #f3ead6;
  --info:           #1f3a5f;
  --info-soft:      #e3eaf2;

  /* type */
  --font-jp: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic Medium", "Yu Gothic", "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  /* brand — Copperplate (macOS/iOS); falls back to Copperplate Gothic / Trajan / serif */
  --font-brand: "Copperplate", "Copperplate Gothic Bold", "Copperplate Gothic", "Trajan Pro", "Optima", "Palatino Linotype", Georgia, serif;

  /* dims */
  --sidebar-w: 236px;
  --topbar-h: 54px;
  --content-pad: 32px;
  --content-pad-sm: 18px;

  /* corners — almost-square, institutional */
  --radius:    3px;
  --radius-lg: 5px;
  --shadow-sm: 0 1px 2px rgba(18, 23, 24, .06);
  --shadow-md: 0 10px 30px rgba(18, 23, 24, .08);
}

/* -- 3. Base ------------------------------------------------------ */
html {
  -webkit-text-size-adjust: 100%;
  /* proportional CJK metrics where available */
  font-feature-settings: "palt" 1, "tnum" 0;
  /* Page-wide horizontal-overflow safety belt. `clip` is preferred
     because (unlike `hidden`) it does NOT establish a scroll container,
     so `position: sticky` on the topbar keeps working. Older browsers
     fall back to `hidden` thanks to the earlier declaration. */
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  font-family: var(--font-jp);
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink-1);
  background-color: var(--bg-page);
  background-image:
    linear-gradient(rgba(45, 55, 49, .018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 55, 49, .018) 1px, transparent 1px),
    repeating-linear-gradient(105deg, transparent 0 7px, rgba(88, 78, 56, .012) 7px 8px);
  background-size: 28px 28px, 28px 28px, auto;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Allow long unbroken strings (URLs, kana-less English words) to
     wrap rather than push a phone viewport sideways. Individual
     selectors that need character-level breaking still set
     `word-break: break-all` (e.g. token blocks). */
  overflow-wrap: anywhere;
}

a {
  color: var(--accent);
  transition: color .15s ease;
}
a:hover { color: var(--accent-hover); }

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

:focus-visible {
  outline: 3px solid var(--vermilion);
  outline-offset: 3px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 8px;
  background: var(--ink-1);
  color: var(--ink-on-dark);
  padding: 6px 12px;
  border-radius: var(--radius);
  z-index: 100;
}
.skip-link:focus { top: 8px; }

/* -- 4. Layout shell --------------------------------------------- */
.app-shell {
  min-height: 100vh;
  display: grid;
  /* Keep edge-bleed decoration such as the large 柔 watermark inside the
     application canvas without creating phantom scroll space. Unlike hidden,
     clip does not create a scroll container, so the sticky rail/topbar keep
     using the viewport. */
  overflow: clip;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "rail topbar"
    "rail main";
}

.app-rail {
  grid-area: rail;
  background: var(--bg-rail);
  color: var(--ink-on-dark);
  border-right: 1px solid var(--rule-on-dark);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  background-image:
    linear-gradient(rgba(255,255,255,.012), rgba(255,255,255,.012)),
    repeating-linear-gradient(0deg, transparent 0 5px, rgba(255,255,255,.012) 5px 6px);
  box-shadow: 8px 0 24px rgba(8, 14, 20, .06);
}

.app-topbar {
  grid-area: topbar;
  background: rgba(252, 250, 244, .94);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 var(--content-pad);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

/* Hamburger — hidden on desktop, revealed on mobile in the responsive block. */
.app-hamburger {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  color: var(--ink-1);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.app-hamburger:hover { border-color: var(--ink-1); background: var(--bg-sunken); }
.app-hamburger span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
}

/* Drawer backdrop — hidden on desktop, revealed when the drawer is open on mobile. */
.app-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(12, 11, 10, 0.5);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.app-rail-close { display: none; }

.app-main {
  grid-area: main;
  padding: var(--content-pad);
  min-width: 0; /* prevent overflow on table-heavy pages */
}

/* -- 5. Rail (sidebar) -------------------------------------------- */
.rail-brand {
  padding: 22px 22px 19px;
  border-bottom: 1px solid var(--rule-on-dark);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rail-brand-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-on-dark);
  letter-spacing: 0.12em;
  line-height: 1.35;
}
.rail-brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-on-dark-3);
}

.rail-nav {
  flex: 1;
  overflow-y: auto;
  padding: 18px 0 32px;
}

.rail-section {
  padding: 0 22px;
  margin-top: 22px;
}
.rail-section:first-child { margin-top: 0; }

.rail-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-on-dark-3);
  padding: 0 0 8px;
  display: block;
}

.rail-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  color: var(--ink-on-dark-2);
  font-size: 13px;
  letter-spacing: 0.03em;
  border-left: 3px solid transparent;
  padding-left: 10px;
  margin-left: -12px;
  transition: color .12s ease, border-color .12s ease, background-color .12s ease;
  border-radius: 0;
}

.rail-link:hover {
  color: var(--ink-on-dark);
  background: linear-gradient(90deg, rgba(255,255,255,.055), transparent 86%);
}

.rail-link.is-active {
  color: var(--ink-on-dark);
  border-left-color: #cf5b45;
  font-weight: 500;
  background: linear-gradient(90deg, rgba(207,91,69,.13), transparent 88%);
}

.rail-foot {
  padding: 14px 22px 18px;
  border-top: 1px solid var(--rule-on-dark);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-on-dark-3);
}

.rail-motto {
  display: grid;
  gap: 3px;
  color: var(--ink-on-dark-2);
  font-family: var(--font-jp);
  font-size: 11px;
  letter-spacing: .16em;
}
.rail-motto small {
  color: var(--ink-on-dark-3);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .2em;
}

/* -- 6. Topbar --------------------------------------------------- */
.topbar-crumbs {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-2);
  min-width: 0;
}
.topbar-crumbs .crumb-sep {
  color: var(--ink-3);
  font-size: 10px;
}
.topbar-crumbs .crumb-current {
  color: var(--ink-1);
  font-weight: 500;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--ink-2);
}
.topbar-user .user-name {
  color: var(--ink-1);
  font-weight: 500;
}
.topbar-user .user-role {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 2px 8px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.topbar-user form { margin: 0; }
.topbar-logout {
  font-size: 12px;
  color: var(--ink-2);
  padding: 4px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-surface);
  transition: border-color .15s ease, color .15s ease;
}
.topbar-logout:hover {
  border-color: var(--ink-2);
  color: var(--ink-1);
}

/* -- 7. Page header (inside main) -------------------------------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 14px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.page-head::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 52px;
  height: 3px;
  background: var(--vermilion);
}

.page-head-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.07em;
  line-height: 1.3;
  color: var(--ink-1);
}
.page-head-lede {
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 4px;
  letter-spacing: 0.04em;
}
.tournament-name-en {
  display: block;
  margin-top: 3px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.45;
  letter-spacing: 0.05em;
}
.tournament-name-en--heading {
  margin-top: 2px;
  font-size: 12px;
}
.page-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 28px 0 12px;
  gap: 16px;
}
.section-head h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.section-head .section-head-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* -- 8. Cards / panels ------------------------------------------- */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.panel + .panel { margin-top: 24px; }
.panel-body { padding: 22px 24px; }
.panel-head {
  padding: 14px 24px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background-image: linear-gradient(90deg, rgba(33,61,91,.035), transparent 48%);
}
.panel-head h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-1);
}
.panel-head .panel-head-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.panel-foot {
  padding: 12px 24px;
  border-top: 1px solid var(--rule);
  background: var(--bg-sunken);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

/* -- 9. Buttons -------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--bg-surface);
  color: var(--ink-1);
  cursor: pointer;
  transition:
    background-color .15s ease,
    color .15s ease,
    border-color .15s ease,
    transform .03s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--accent);
  color: var(--accent-on);
  border-color: var(--accent);
}
.btn--primary:focus-visible { outline-color: var(--vermilion); }
.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-on);
}
.btn--primary:active { background: var(--accent-press); }

.btn--secondary {
  background: var(--bg-surface);
  color: var(--ink-1);
  border-color: var(--rule-strong);
}
.btn--secondary:hover {
  border-color: var(--ink-1);
  background: var(--bg-sunken);
}

.btn--ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: transparent;
}
.btn--ghost:hover {
  background: var(--bg-sunken);
  color: var(--ink-1);
}

.btn--danger {
  background: var(--bg-surface);
  color: var(--danger);
  border-color: var(--danger);
}
.btn--danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn--sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn--lg {
  padding: 11px 22px;
  font-size: 14px;
}

.btn[disabled],
.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-group {
  display: inline-flex;
  gap: 6px;
}

/* -- 10. Forms --------------------------------------------------- */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.field-required::after {
  content: "必須";
  margin-left: 6px;
  padding: 1px 5px;
  font-size: 9px;
  letter-spacing: 0.1em;
  background: var(--vermilion-soft);
  color: var(--vermilion-dark);
  border-radius: var(--radius);
}
.field-help {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
}
.field-error {
  font-size: 11px;
  color: var(--danger);
  margin-top: 2px;
}

.settings-logo-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: #fff;
}
.settings-logo-preview img {
  width: min(240px, 45%);
  height: 72px;
  object-fit: contain;
  object-position: left center;
}
.settings-logo-preview .field-help { margin: 0; }
.settings-media-actions {
  justify-content: space-between;
  align-items: center;
}

.input,
.select,
.textarea {
  width: 100%;
  /* Allow these inputs to shrink inside flex containers (the parent
     registration URL row, edit-link row, etc.). Browsers default text
     inputs to a `min-width` matching the intrinsic content size, which
     makes a long readonly URL push the whole layout sideways on phones. */
  min-width: 0;
  max-width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-jp);
  background: var(--bg-surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  color: var(--ink-1);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 1px 3px rgba(18,23,24,.08);
}
.input[readonly],
.input[disabled] {
  background: var(--bg-sunken);
  color: var(--ink-2);
}
.textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.65;
}
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%),
                    linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-1);
  cursor: pointer;
}

.form-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 18px;
  margin-top: 22px;
  border-top: 1px solid var(--rule);
}

/* -- 11. Tables -------------------------------------------------- */
.table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.data-table th,
.data-table td {
  padding: 10px 16px;
  text-align: left;
  vertical-align: middle;
}
.data-table thead th {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  background-color: var(--bg-sunken);
  background-image: repeating-linear-gradient(90deg, transparent 0 31px, rgba(33,61,91,.025) 31px 32px);
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
.data-table tbody tr {
  border-bottom: 1px solid var(--rule-soft);
  transition: background-color .12s ease;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-sunken); }
.data-table td {
  font-size: 13px;
  color: var(--ink-1);
}
.data-table td.col-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.data-table td.col-actions {
  text-align: right;
  white-space: nowrap;
}
.data-table td.col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table .row-empty td {
  text-align: center;
  padding: 36px 16px;
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: 0.06em;
}

/* -- 12. Badges -------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: var(--bg-sunken);
  color: var(--ink-2);
  border-radius: var(--radius);
  border: 1px solid var(--rule);
}
.badge--accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge--danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge--success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge--warn   { background: var(--warning-soft); color: var(--warning); border-color: transparent; }

/* -- 13. Flash messages ----------------------------------------- */
.flash-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 22px;
}

.flash {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--ink-2);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--ink-1);
}
.flash-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-2);
  flex-shrink: 0;
  padding-top: 2px;
}
.flash-message { flex: 1; }
.flash--success { border-left-color: var(--success); background: var(--success-soft); }
.flash--success .flash-label { color: var(--success); }
.flash--error   { border-left-color: var(--danger);  background: var(--danger-soft); }
.flash--error .flash-label   { color: var(--danger); }
.flash--warning { border-left-color: var(--warning); background: var(--warning-soft); }
.flash--warning .flash-label { color: var(--warning); }
.flash--info    { border-left-color: var(--accent);  background: var(--accent-soft); }
.flash--info .flash-label    { color: var(--accent); }

/* -- 14. Definition list (key / value detail) -------------------- */
.kv-list {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px 24px;
  font-size: 13px;
}
.kv-list dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding-top: 2px;
}
.kv-list dd {
  color: var(--ink-1);
}

/* -- 15. Empty state -------------------------------------------- */
.empty-state {
  padding: 56px 24px;
  text-align: center;
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius-lg);
  color: var(--ink-2);
  background: rgba(252, 250, 244, .58);
}
.empty-state h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-1);
  margin-bottom: 6px;
}
.empty-state p {
  font-size: 12px;
  color: var(--ink-3);
  max-width: 360px;
  margin: 0 auto;
}

/* -- 16. Login / auth pages ------------------------------------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  background-color: var(--bg-page);
  padding: 24px;
  background-image:
    linear-gradient(90deg, rgba(33,61,91,.035) 1px, transparent 1px),
    linear-gradient(rgba(33,61,91,.035) 1px, transparent 1px),
    repeating-linear-gradient(105deg, transparent 0 8px, rgba(88,78,56,.016) 8px 9px);
  background-size: 96px 100%, 100% 96px, auto;
}
.auth-shell > .auth-card { align-self: center; }

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 40px 36px 32px;
  position: relative;
  box-shadow: var(--shadow-md);
}
.auth-card::before {
  content: "";
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 3px;
  background: linear-gradient(90deg, var(--vermilion), var(--vermilion) 28%, var(--accent) 28%, var(--accent));
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}
.site-logo {
  display: block;
  object-fit: contain;
}
.site-logo--auth {
  width: min(220px, 100%);
  height: 84px;
  margin: 0 auto 14px;
}
.site-logo--rail {
  width: min(174px, 100%);
  height: 52px;
  object-position: center;
  margin: 0 auto 7px;
  padding: 4px;
  border-radius: var(--radius);
  background: transparent;
}
.auth-brand-mark {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.auth-brand-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink-1);
  letter-spacing: 0.06em;
}
.auth-brand-motto {
  margin-top: 8px;
  color: var(--ink-3);
  font-family: serif;
  font-size: 11px;
  letter-spacing: .16em;
}

.auth-card .form-foot {
  border-top: none;
  padding-top: 8px;
  margin-top: 0;
  justify-content: stretch;
}
.auth-card .form-foot .btn { flex: 1; }

/* -- 17. Error pages -------------------------------------------- */
.error-page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  background-color: var(--bg-page);
  background-image:
    linear-gradient(90deg, rgba(33,61,91,.035) 1px, transparent 1px),
    linear-gradient(rgba(33,61,91,.035) 1px, transparent 1px);
  background-size: 96px 100%, 100% 96px;
  padding: 24px;
}
.error-page > .error-card { align-self: center; }
.error-card {
  text-align: center;
  max-width: 460px;
  background: var(--bg-surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 56px 32px;
  box-shadow: var(--shadow-md);
  position: relative;
}
.error-card::before {
  content: "柔";
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin: -78px auto 22px;
  border: 2px solid var(--vermilion);
  color: var(--vermilion);
  background: var(--bg-surface);
  font-family: serif;
  font-size: 24px;
  transform: rotate(-2deg);
}
.error-code {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 18px;
}
.error-card h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: 0.04em;
}
.error-card p {
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 26px;
}
.error-card .btn {
  background: var(--ink-1);
  color: var(--ink-on-dark);
  border-color: var(--ink-1);
}
.error-card .btn:hover { background: var(--accent); border-color: var(--accent); }

/* -- 18. Utility ------------------------------------------------- */
.u-mono { font-family: var(--font-mono); }
.u-muted { color: var(--ink-3); }
.u-text-right { text-align: right; }
.u-nowrap { white-space: nowrap; }
.u-mt-0 { margin-top: 0; }
.u-mt-2 { margin-top: 8px; }
.u-mt-4 { margin-top: 16px; }
.u-mt-6 { margin-top: 24px; }
.u-mt-8 { margin-top: 32px; }
.u-mb-0 { margin-bottom: 0; }
.u-mb-4 { margin-bottom: 16px; }
.u-flex { display: flex; }
.u-flex-between { display: flex; justify-content: space-between; align-items: center; }
.u-gap-2 { gap: 8px; }
.u-gap-4 { gap: 16px; }

.hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 24px 0;
}

/* Inline copy-token block (used when displaying a one-shot raw token) */
.token-block {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-rail);
  color: var(--ink-on-dark);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  border-radius: var(--radius);
  word-break: break-all;
}

/* -- 19. Responsive --------------------------------------------- */
@media (max-width: 880px) {
  :root {
    --content-pad: var(--content-pad-sm);
  }
  /* Single-column layout: topbar + main. The rail becomes an off-canvas
     drawer overlaid on top so the desktop sidebar look is preserved
     instead of being flattened into a horizontal strip. */
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
    grid-template-areas:
      "topbar"
      "main";
  }
  .app-rail {
    position: fixed;
    top: 0;
    left: 0;
    width: min(280px, 84vw);
    height: 100vh;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .25s ease;
    border-right: 1px solid var(--rule-on-dark);
    box-shadow: 8px 0 24px -8px rgba(0, 0, 0, 0.45);
  }
  .app-shell.is-rail-open .app-rail { transform: translateX(0); }

  .app-backdrop { display: block; }
  .app-shell.is-rail-open .app-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  body.is-rail-open-lock { overflow: hidden; }

  .app-hamburger { display: inline-flex; }

  .app-topbar { padding: 0 var(--content-pad-sm); gap: 10px; }

  .topbar-crumbs {
    font-size: 12px;
    gap: 6px;
    overflow: hidden;
    min-width: 0;
  }
  .topbar-crumbs .crumb-current {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }

  .topbar-user { gap: 8px; }
  .topbar-user .user-role { display: none; }
  .topbar-user .user-name {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .field-row { grid-template-columns: 1fr; }

  .kv-list { grid-template-columns: 1fr; gap: 4px 0; }
  .kv-list dd { padding-bottom: 8px; border-bottom: 1px solid var(--rule-soft); margin-bottom: 8px; }

  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .page-head-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .panel-head { flex-wrap: wrap; gap: 8px; }
  .section-head { flex-wrap: wrap; gap: 8px; }

  /* Coach dashboard tournament cards: minmax(280px,1fr) doesn't fit a
     320px viewport once content-pad eats 36px of width. Drop the floor
     so a single column collapses cleanly. */
  .t-card-grid { grid-template-columns: 1fr; }

  /* Topbar logout area can elbow the breadcrumb on small screens. */
  .topbar-user .topbar-logout { padding: 4px 8px; }
}

@media (max-width: 480px) {
  .panel-body { padding: 16px 14px; }
  .panel-head, .panel-foot { padding: 12px 14px; }
  .data-table th, .data-table td { padding: 8px 10px; font-size: 12px; }
  .settings-logo-preview { align-items: flex-start; flex-direction: column; }
  .settings-logo-preview img { width: 100%; }

  /* Topbar: hide the user's display name to free up the row when
     breadcrumbs are long. The role chip is already hidden at 880px. */
  .topbar-user .user-name { display: none; }
}

/* -- 19b. Tabs (in-page) ---------------------------------------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--rule);
  margin: -8px 0 24px;
  padding: 0;
}
.tab {
  padding: 10px 14px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tab:hover { color: var(--ink-1); }
.tab.is-active {
  color: var(--ink-1);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tab--disabled {
  color: var(--ink-3);
  cursor: not-allowed;
  opacity: .55;
}
.tab-soon {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
}

/* -- 19c. Status pills ------------------------------------------ */
.status-pill {
  display: inline-block;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--bg-sunken);
  color: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: 999px;
}
.status-pill--draft     { background: var(--bg-sunken);    color: var(--ink-2);  border-color: var(--rule); }
.status-pill--open      { background: var(--accent-soft);  color: var(--accent); border-color: transparent; }
.status-pill--closed    { background: var(--warning-soft); color: var(--warning);border-color: transparent; }
.status-pill--live      { background: var(--danger-soft);  color: var(--danger); border-color: transparent; }
.status-pill--published { background: var(--success-soft); color: var(--success);border-color: transparent; }

/* -- 19d. Tournament-show specifics ---------------------------- */
.t-head {
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo-thumb {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: var(--bg-sunken);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 4px;
}
.logo-thumb--xs { width: 28px; height: 28px; padding: 2px; }
.logo-thumb--lg { width: 80px; height: 80px; }

.bare-list { padding: 0; margin: 0; }
.bare-list-row {
  padding: 8px 0;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 13px;
}
.bare-list-row:last-child { border-bottom: none; }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  background: var(--bg-page);
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink-1);
}

/* -- 19e. Venue rows (repeatable) ------------------------------- */
.venue-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-page);
  align-items: end;
}
.venue-row + .venue-row { margin-top: 8px; }
.venue-row-actions { padding-bottom: 4px; }
@media (max-width: 720px) {
  .venue-row { grid-template-columns: 1fr; }
  .venue-row-actions { justify-self: end; }
}

/* -- 19f. Checkbox tile grid (category picker) ------------------ */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.checkbox-tile {
  padding: 12px 14px;
  border: 1px solid var(--rule);
  background: var(--bg-page);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
}
.checkbox-tile:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.checkbox-tile span { display: flex; flex-direction: column; gap: 2px; }
.checkbox-tile small { font-size: 10px; letter-spacing: 0.1em; }

/* -- 19g. Auth-shell register variant --------------------------- */
.auth-card--wide { max-width: 460px; }
.auth-meta-link {
  text-align: center;
  margin-top: 18px;
  font-size: 12px;
  color: var(--ink-3);
}
.auth-meta-link a { color: var(--accent); font-weight: 500; }

/* -- 19h. Tournament card grid (coach dashboard) ---------------- */
.t-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.t-card {
  border: 1px solid var(--rule);
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.t-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 12px;
}
.t-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-1);
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.t-card-head .tournament-name-en { overflow-wrap: anywhere; }
.t-card-meta { font-size: 12px; color: var(--ink-2); }
.t-card-foot {
  margin-top: 6px;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  border-top: 1px solid var(--rule-soft);
  padding-top: 10px;
}

/* -- 19b. Parent-facing pages (token-gated, no app shell) ------ */
.parent-shell {
  min-height: 100vh;
  background: var(--bg-page);
  padding: 24px 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.parent-shell > .brand-footer { margin-top: auto; align-self: stretch; }
.parent-card {
  width: 100%;
  max-width: 680px;
  background: var(--bg-surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  position: relative;
}
.parent-card::before {
  content: "";
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 3px;
  background: var(--accent);
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}
.parent-card-head { margin-bottom: 22px; text-align: left; }
.parent-card-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.parent-card-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-1);
  letter-spacing: 0.02em;
  line-height: 1.3;
}
.parent-card-sub { font-size: 13px; color: var(--ink-2); margin-top: 4px; }

.registration-photo-preview {
  display: block;
  width: auto;
  max-width: min(100%, 360px);
  max-height: 260px;
  object-fit: contain;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-sunken);
}

.athlete-photo-thumb {
  display: block;
  width: 52px;
  height: 52px;
  object-fit: cover;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-sunken);
}

.team-photo-thumb {
  display: block;
  width: 76px;
  height: 56px;
  object-fit: cover;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-sunken);
}

@media (max-width: 640px) {
  .parent-card { padding: 24px 18px; border-radius: 0; border-left: none; border-right: none; }
  .parent-shell { padding: 0; padding-bottom: 32px; }
  .parent-card-title { font-size: 20px; }
}

/* -- 19f. Radio grid (scoring rules form) ------------------------ */
.radio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

/* -- 19a. Callout (publish tab freshly-generated link, etc.) ----- */
.callout {
  display: block;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--bg-surface);
}
.callout--success {
  border-color: #b6cdba;
  background: var(--success-soft);
}
.callout--info { border-color: var(--rule); background: var(--info-soft); }
.callout-title {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .03em;
  margin-bottom: 8px;
}
.callout-body { font-size: 13px; line-height: 1.6; }

/* =================================================================
/* -- 19z. Judo wordmark & shared brand footer -------------------- */
.brand-ga {
  font-family: var(--font-brand);
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  /* Copperplate is naturally small-caps; the explicit transform protects
     the look on systems that fall back to a non-small-caps serif. */
}

/* Wordmark sized for the auth card eyebrow row (login, coach register). */
.brand-ga--auth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  min-width: 62px;
  min-height: 62px;
  padding: 8px 11px;
  margin-bottom: 14px;
  border: 2px solid var(--vermilion);
  color: var(--vermilion);
  font-family: serif;
  font-size: 31px;
  line-height: 1;
  letter-spacing: 0;
  transform: rotate(-1deg);
}
.brand-ga--auth span {
  color: var(--ink-1);
  font-family: var(--font-brand);
  font-size: 11px;
  letter-spacing: .22em;
  writing-mode: vertical-rl;
}

/* Wordmark sized for the sidebar rail brand block. */
.brand-ga--rail {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  letter-spacing: 0.26em;
  color: var(--ink-on-dark-2);
  margin-bottom: 7px;
}
.brand-ga--rail::before {
  content: "柔";
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid #d56550;
  color: #e37660;
  font-family: serif;
  font-size: 17px;
  line-height: 1;
  letter-spacing: 0;
  transform: rotate(-2deg);
}

/* Wordmark for public / parent / judge / error surfaces. */
.brand-ga--footer {
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--accent);
}

/* Shared copyright + brand footer (logged-out & token-gated surfaces). */
.brand-footer {
  text-align: center;
  padding: 28px 16px 24px;
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: 0.04em;
  line-height: 1.6;
}
.brand-footer .brand-ga { display: block; margin-bottom: 4px; }
.site-logo--footer {
  width: min(160px, 100%);
  height: 38px;
  margin: 0 auto 7px;
}
.brand-footer-copy {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

/* Compact, dark-on-light variant tucked under the app-shell main area. */
.app-footer {
  border-top: 1px solid var(--rule-soft);
  margin-top: 32px;
  padding: 14px 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}
.app-footer-mark {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  border: 1px solid var(--vermilion);
  color: var(--vermilion);
  font-family: serif;
  font-size: 12px;
  transform: rotate(-2deg);
}

/* -- 19zz. Tournament team roster dashboard --------------------- */
.roster-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.roster-kpi {
  min-width: 0;
  padding: 14px 16px 13px;
  background: var(--bg-surface);
  border: 1px solid var(--rule);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius-lg);
}
.roster-kpi--attention { border-top-color: var(--warning); }
.roster-kpi-label {
  display: block;
  margin-bottom: 3px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.roster-kpi strong {
  display: inline-block;
  margin-right: 7px;
  color: var(--ink-1);
  font-family: var(--font-mono);
  font-size: 25px;
  line-height: 1.2;
}
.roster-kpi--attention strong { color: var(--warning); }
.roster-kpi > span:last-child { color: var(--ink-3); font-size: 10px; }

.roster-panel-lede {
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 11px;
}
.roster-panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.roster-toolbar {
  display: grid;
  grid-template-columns: minmax(250px, 1.7fr) repeat(3, minmax(130px, .7fr)) auto auto;
  align-items: end;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--rule);
}
.roster-search,
.roster-filter {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}
.roster-search label,
.roster-filter label {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.roster-toolbar .input,
.roster-toolbar .select {
  height: 34px;
  padding-top: 6px;
  padding-bottom: 6px;
  background-color: var(--bg-surface);
  font-size: 12px;
}
.roster-result-count {
  align-self: center;
  justify-self: end;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
}
.roster-table-wrap {
  border: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.roster-table { min-width: 1120px; }
.roster-table th,
.roster-table td { padding: 11px 12px; }
.roster-table tbody .roster-team-row.is-cancelled > td { color: var(--ink-3); }
.roster-table tbody .roster-team-row.is-cancelled { background: color-mix(in srgb, var(--bg-sunken) 55%, transparent); }
.roster-team-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}
.roster-team-identity > div { min-width: 0; }
.roster-logo-placeholder {
  display: inline-flex;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 700;
}
.roster-team-name {
  display: block;
  overflow: hidden;
  color: var(--ink-1);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.roster-team-name:hover { color: var(--accent); text-decoration: underline; }
.roster-team-meta,
.roster-updated {
  margin-top: 3px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .03em;
}
.roster-coach-name {
  display: block;
  font-size: 12px;
  line-height: 1.45;
}
.roster-coach-name:hover { color: var(--accent); text-decoration: underline; }
.roster-contact {
  display: block;
  max-width: 190px;
  overflow: hidden;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.roster-contact:hover { color: var(--accent); text-decoration: underline; }
.roster-missing-text { color: var(--danger); font-size: 11px; font-weight: 600; }
.roster-registration-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.roster-registration-counts > span {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 2px 7px;
  color: var(--ink-2);
  background: var(--bg-sunken);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  font-size: 10px;
}
.roster-registration-counts small { color: var(--ink-3); font-size: 9px; }
.roster-registration-counts strong { color: var(--ink-1); font-family: var(--font-mono); font-size: 13px; }
.roster-category-line {
  max-width: 180px;
  margin-top: 5px;
  overflow: hidden;
  color: var(--ink-3);
  font-size: 9px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.roster-toggle {
  margin-top: 5px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
}
.roster-toggle:hover { text-decoration: underline; }
.roster-toggle span { display: inline-block; transition: transform .15s ease; }
.roster-toggle[aria-expanded="true"] span { transform: rotate(180deg); }

.roster-submissions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 6px;
}
.roster-submission {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding-bottom: 2px;
  color: var(--ink-3);
  border-bottom: 1px dotted var(--rule);
  font-size: 9px;
  white-space: nowrap;
}
.roster-submission strong { color: var(--ink-2); font-family: var(--font-mono); font-size: 9px; }
.roster-submission.is-complete::before,
.roster-submission.is-missing::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  background: var(--success);
  border-radius: 50%;
}
.roster-submission.is-missing { color: var(--warning); }
.roster-submission.is-missing::before { background: var(--warning); }
.roster-state-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.roster-status-attention {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: transparent;
}
.roster-status-ready {
  color: var(--success);
  background: var(--success-soft);
  border-color: transparent;
}
.roster-issues {
  margin-top: 5px;
  color: var(--warning);
  font-size: 9px;
  line-height: 1.45;
}
.roster-issues li::before { content: "・"; }
.roster-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.roster-actions .btn { min-width: 132px; }
.roster-entry-form { display: inline-flex; }
.roster-action-link {
  color: var(--accent);
  font-size: 10px;
  line-height: 1.5;
}
.roster-action-link:hover { text-decoration: underline; }
.roster-action-link--danger { color: var(--danger); }

.roster-detail-row > td {
  padding: 0 !important;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--rule);
}
.roster-detail {
  padding: 14px 16px 16px 48px;
  box-shadow: inset 3px 0 0 var(--accent);
}
.roster-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}
.roster-detail-head strong { font-size: 11px; letter-spacing: .06em; }
.roster-detail-head span { margin-left: 7px; color: var(--ink-3); font-size: 10px; }
.roster-detail-head > a { color: var(--accent); font-size: 10px; font-weight: 600; }
.roster-detail-head > a:hover { text-decoration: underline; }
.roster-detail-empty { color: var(--ink-3); font-size: 11px; }
.roster-athlete-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(245px, 1fr));
  max-height: 340px;
  gap: 6px;
  overflow-y: auto;
  scrollbar-color: var(--rule-strong) transparent;
}
.roster-athlete-card {
  min-width: 0;
  padding: 8px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
}
.roster-athlete-card-head {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.roster-athlete-card-head > div { min-width: 0; }
.roster-athlete-card-head strong {
  display: block;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.roster-athlete-card-head small {
  display: block;
  overflow: hidden;
  color: var(--ink-3);
  font-size: 8px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.roster-athlete-card-head a { flex: 0 0 auto; color: var(--accent); font-size: 9px; }
.roster-athlete-card-head a:hover { text-decoration: underline; }
.roster-athlete-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 5px;
}
.roster-athlete-tags .chip { padding: 1px 5px; font-size: 8px; }
.roster-athlete-assets {
  display: flex;
  gap: 10px;
  margin-top: 5px;
  color: var(--ink-3);
  font-size: 8px;
}
.roster-athlete-assets .is-complete::before,
.roster-athlete-assets .is-missing::before { content: "●"; margin-right: 3px; color: var(--success); font-size: 6px; }
.roster-athlete-assets .is-missing { color: var(--warning); }
.roster-athlete-assets .is-missing::before { color: var(--warning); }

@media (max-width: 1180px) {
  .roster-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .roster-toolbar { grid-template-columns: minmax(230px, 1.5fr) repeat(3, minmax(125px, 1fr)); }
  .roster-toolbar #roster-reset { justify-self: start; }
  .roster-result-count { justify-self: end; }
}
@media (max-width: 720px) {
  .roster-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .roster-kpi { padding: 11px 12px; }
  .roster-kpi strong { font-size: 20px; }
  .roster-panel-actions { width: 100%; }
  .roster-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px 12px; }
  .roster-search { grid-column: 1 / -1; }
  .roster-toolbar #roster-reset { justify-self: start; }
  .roster-result-count { align-self: center; justify-self: end; }
  .roster-detail { padding-left: 16px; }
  .roster-detail-head { align-items: flex-start; flex-direction: column; gap: 4px; }
  .roster-athlete-grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .roster-kpis { grid-template-columns: 1fr; }
  .roster-toolbar { grid-template-columns: 1fr; }
  .roster-search { grid-column: auto; }
  .roster-result-count { justify-self: start; }
}

/* -- 20. Print --------------------------------------------------- */
@media print {
  .app-rail, .app-topbar, .page-head-actions, .form-foot, .btn { display: none !important; }
  .app-shell { display: block; }
  body { background: #fff; color: #000; }
  .panel { border: 1px solid #000; box-shadow: none; }
  .brand-footer, .app-footer { color: #555; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  .page-head::after,
  .auth-card::before { background: CanvasText; }
  .brand-ga--auth,
  .brand-ga--rail::before,
  .app-footer-mark { border-color: CanvasText; color: CanvasText; }
}

/* -- 21. Judo competition desk ---------------------------------- */
.eyebrow {
  color: var(--vermilion);
  font: 700 10px/1.3 var(--font-brand);
  letter-spacing: .18em;
  text-transform: uppercase;
}
.judo-page-head { position: relative; }
.judo-page-head::before {
  content: "試合";
  position: absolute;
  right: 0;
  bottom: -12px;
  color: rgba(33, 61, 91, .045);
  font-size: clamp(72px, 10vw, 132px);
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}
.judo-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 22px;
}
.judo-kpis article {
  position: relative;
  overflow: hidden;
  min-height: 92px;
  padding: 15px 18px;
  color: var(--ink-on-dark);
  background: var(--bg-rail);
  border: 1px solid var(--rule-on-dark);
  border-radius: var(--radius);
}
.judo-kpis article::after {
  content: "";
  position: absolute;
  inset: auto -24px -26px auto;
  width: 72px;
  height: 72px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
}
.judo-kpis span, .judo-kpis small { display: block; color: var(--ink-on-dark-2); font-size: 9px; letter-spacing: .12em; }
.judo-kpis strong { display: block; font: 700 28px/1.2 var(--font-brand); }
.division-switcher {
  display: flex;
  gap: 5px;
  max-width: 100%;
  margin-bottom: 10px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.division-tab {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  min-width: 112px;
  padding: 8px 12px;
  color: var(--ink-2);
  background: rgba(252, 250, 244, .72);
  border: 1px solid var(--rule);
  border-bottom: 3px solid var(--rule);
  border-radius: var(--radius) var(--radius) 0 0;
  font-weight: 700;
}
.division-tab small { color: var(--ink-3); font-size: 9px; font-weight: 500; }
.division-tab.is-active {
  color: var(--accent-on);
  background: var(--accent);
  border-color: var(--accent);
  border-bottom-color: var(--vermilion);
}
.division-tab.is-active small { color: rgba(255,255,255,.72); }
.division-summary { border-top: 3px solid var(--vermilion); }
.division-summary .panel-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background-image: linear-gradient(90deg, transparent 49.8%, rgba(33,61,91,.035) 50%, transparent 50.2%);
  background-size: 36px 100%;
}
.division-summary-main { display: flex; align-items: center; gap: 14px; }
.division-summary-main h2 { margin: 2px 0; font-size: 24px; }
.division-summary-main p:last-child { color: var(--ink-2); font-size: 12px; }
.judo-seal {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 46px;
  height: 46px;
  color: #fff;
  background: var(--vermilion);
  border: 2px double rgba(255,255,255,.7);
  border-radius: 50%;
  font-family: serif;
  font-size: 20px;
  font-weight: 900;
}
.division-facts { display: grid; grid-template-columns: repeat(4, auto); gap: 8px 22px; }
.division-facts div { min-width: 76px; }
.division-facts dt { color: var(--ink-3); font-size: 9px; letter-spacing: .08em; }
.division-facts dd { font-weight: 700; }
.judo-workspace { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 14px; margin-top: 14px; }
.judo-inline-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--rule);
}
.field--grow { flex: 1 1 auto; }
.judo-seed-field { flex: 0 0 90px; }
.judo-entry-table td strong, .judo-entry-table td small { display: block; }
.judo-entry-table td small { color: var(--ink-3); font-size: 9px; }
.judo-entry-table tr.is-muted { opacity: .55; }
.count-badge {
  min-width: 32px;
  padding: 3px 9px;
  color: var(--accent-on);
  background: var(--accent);
  border-radius: 99px;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
}
.weigh-status {
  display: inline-flex;
  margin-left: 5px;
  padding: 1px 6px;
  color: var(--ink-2);
  background: var(--bg-sunken);
  border-radius: 99px;
  font-size: 8px;
  font-weight: 700;
}
.weigh-status--passed { color: var(--success); background: var(--success-soft); }
.weigh-status--failed, .weigh-status--absent { color: var(--danger); background: var(--danger-soft); }
.weigh-grid { display: grid; gap: 7px; max-height: 560px; padding: 10px; overflow-y: auto; }
.weigh-card { padding: 10px; background: var(--bg-surface); border: 1px solid var(--rule-soft); border-left: 3px solid var(--accent); }
.weigh-card-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.weigh-card-head strong, .weigh-card-head small { display: block; }
.weigh-card-head small { color: var(--ink-3); font-size: 9px; }
.weigh-card label { display: block; color: var(--ink-2); font-size: 9px; }
.weigh-input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.weigh-card > label { margin: 6px 0; }
.weigh-card .btn { width: 100%; }
.draw-action { display: flex; align-items: end; gap: 8px; }
.draw-action label { color: var(--ink-3); font-size: 9px; }
.draw-action .input { width: 65px; }
.bracket-scroll { overflow-x: auto; background: var(--bg-sunken); scrollbar-color: var(--accent) var(--bg-sunken); }
.bracket-board { display: flex; align-items: stretch; gap: 20px; min-width: max-content; padding: 18px; }
.bracket-round { display: flex; flex-direction: column; width: 244px; }
.bracket-round > h3 { margin-bottom: 10px; color: var(--ink-2); font-size: 11px; letter-spacing: .08em; text-align: center; }
.bracket-round-matches { display: flex; flex: 1; flex-direction: column; justify-content: space-around; gap: 12px; }
.bracket-match { position: relative; background: var(--bg-surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.bracket-match::after { content: ""; position: absolute; top: 50%; right: -21px; width: 20px; border-top: 1px solid var(--rule-strong); }
.bracket-round:last-child .bracket-match::after { display: none; }
.bracket-match > header, .bracket-match > footer { display: flex; justify-content: space-between; gap: 6px; padding: 4px 8px; color: var(--ink-3); background: rgba(33,61,91,.04); font-size: 8px; }
.bracket-player { display: grid; grid-template-columns: 15px minmax(0, 1fr); align-items: center; gap: 5px; min-height: 42px; padding: 6px 8px; border-top: 1px solid var(--rule-soft); }
.bracket-player + .bracket-player { border-top-color: var(--rule); }
.bracket-player strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.bracket-player small { grid-column: 2; margin-top: -7px; overflow: hidden; color: var(--ink-3); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.bracket-player.is-winner { background: var(--success-soft); }
.bracket-player.is-winner strong::after { content: " 勝"; color: var(--success); font-size: 8px; }
.judogi-dot { grid-row: 1 / span 2; width: 11px; height: 11px; border: 1px solid var(--ink-1); border-radius: 50%; }
.judogi-dot--white { background: #fff; }
.judogi-dot--blue { background: #31588b; }
.bracket-match--in_progress { border-color: var(--vermilion); box-shadow: 0 0 0 2px var(--vermilion-soft); }
.bracket-match--called { border-color: var(--warning); }
.bout-list { display: grid; gap: 7px; padding: 10px; }
.bout-card { background: var(--bg-surface); border: 1px solid var(--rule); border-left: 4px solid var(--accent); border-radius: var(--radius); }
.bout-card.is-complete { border-left-color: var(--success); }
.bout-card > summary { display: grid; grid-template-columns: 62px minmax(140px, 1fr) 26px minmax(140px, 1fr) auto; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; list-style: none; }
.bout-card > summary::-webkit-details-marker { display: none; }
.bout-card > summary::before { content: "＋"; color: var(--accent); font-weight: 800; }
.bout-card[open] > summary::before { content: "−"; }
.bout-number { color: var(--ink-3); font: 700 9px var(--font-mono); }
.bout-player { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.bout-player small { margin-right: 7px; color: var(--ink-3); font-size: 8px; }
.bout-player--blue small { color: #31588b; }
.bout-versus { color: var(--ink-3); font-size: 9px; text-align: center; }
.bout-card-body { padding: 13px; background: var(--bg-sunken); border-top: 1px solid var(--rule); }
.bout-state-form, .bout-result-primary, .bout-notes-row { display: flex; align-items: end; gap: 8px; }
.bout-state-form { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--rule); }
.bout-state-form label, .bout-result-primary label, .bout-notes-row label { flex: 1; color: var(--ink-2); font-size: 9px; }
.bout-result-primary .check { align-self: center; min-width: 150px; }
.bout-score-grid { display: grid; grid-template-columns: 56px repeat(4, minmax(52px, 80px)); gap: 4px; align-items: center; width: fit-content; margin: 12px 0; }
.bout-score-grid > strong { color: var(--ink-3); font-size: 8px; text-align: center; }
.bout-score-grid .score-side { color: var(--ink-1); font-size: 10px; text-align: left; }
.score-side--white::before, .score-side--blue::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 4px; vertical-align: -1px; border: 1px solid var(--ink-1); border-radius: 50%; background: #fff; }
.score-side--blue::before { background: #31588b; }
.public-judo-hero { position: relative; display: flex; align-items: center; gap: 18px; margin: -8px 0 14px; padding: 26px 28px; color: var(--ink-on-dark); background: var(--bg-rail); border-bottom: 4px solid var(--vermilion); overflow: hidden; }
.public-judo-hero::after { content: "道"; position: absolute; right: 10%; color: rgba(255,255,255,.035); font: 900 150px/1 serif; }
.public-judo-hero h1 { font-size: clamp(22px, 4vw, 38px); }
.public-judo-hero p:last-child { color: var(--ink-on-dark-2); }
.public-judo-mon { display: grid; flex: 0 0 auto; place-items: center; width: 70px; height: 70px; color: #fff; background: var(--vermilion); border: 4px double rgba(255,255,255,.65); border-radius: 50%; font: 900 30px serif; }
.live-indicator { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; margin-left: auto; color: inherit; font: 700 10px var(--font-brand); letter-spacing: .12em; }
.live-indicator i { width: 8px; height: 8px; background: #e24b38; border-radius: 50%; box-shadow: 0 0 0 4px rgba(226,75,56,.15); animation: judo-pulse 1.5s infinite; }
@keyframes judo-pulse { 50% { opacity: .45; transform: scale(.8); } }
.public-tournament-nav { display: flex; gap: 5px; margin-bottom: 14px; border-bottom: 1px solid var(--rule); }
.public-tournament-nav a { padding: 7px 13px; color: var(--ink-2); font-weight: 700; }
.public-tournament-nav a.is-active { color: var(--accent); border-bottom: 3px solid var(--vermilion); }
.public-tournament-name-en { margin: 3px 0; color: var(--ink-on-dark-2); font-size: 12px; letter-spacing: .08em; }
.public-overview-heading { margin: 22px 0 14px; }
.public-overview-heading h2 { margin: 2px 0 4px; font-size: 28px; }
.public-overview-heading > p:last-child { color: var(--ink-2); }
.public-entry-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 10px; margin-bottom: 18px; }
.public-entry-summary article { padding: 15px 18px; color: var(--ink-on-dark); background: var(--bg-rail); border-top: 3px solid var(--vermilion); border-radius: var(--radius-lg); }
.public-entry-summary article:only-child { grid-column: 1 / -1; width: min(220px, 100%); }
.public-entry-summary span { display: block; color: var(--ink-on-dark-2); font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.public-entry-summary strong { margin-right: 5px; font: 700 30px/1.25 var(--font-brand); }
.public-entry-summary small { color: var(--ink-on-dark-2); }
.public-overview-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 14px; }
.public-requirements-panel { margin: 0; }
.public-venue-list { display: grid; gap: 10px; }
.public-venue-list article { padding-bottom: 10px; border-bottom: 1px solid var(--rule-soft); }
.public-venue-list article:last-child { padding-bottom: 0; border-bottom: 0; }
.public-venue-list strong { display: block; }
.public-venue-list address { margin-top: 3px; color: var(--ink-2); font-style: normal; }
.public-category-list { display: flex; flex-wrap: wrap; gap: 7px; }
.public-category-list span { padding: 5px 9px; background: var(--bg-sunken); border: 1px solid var(--rule); border-radius: 99px; font-size: 10px; font-weight: 700; }
.public-division-title { display: flex; align-items: flex-end; justify-content: space-between; margin: 22px 0 10px; padding-bottom: 8px; border-bottom: 2px solid var(--ink-1); }
.public-division-title h2 { font-size: 26px; }
.public-division-meta { display: flex; gap: 6px; }
.public-division-meta span { padding: 3px 8px; background: var(--bg-sunken); border: 1px solid var(--rule); font-size: 9px; }
.public-bracket-scroll { border: 1px solid var(--rule); }
.public-live-board { margin-top: 18px; background: var(--bg-surface); border: 1px solid var(--rule); }
.public-live-board .live-indicator { color: var(--vermilion); }
.public-bout-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 12px; }
.public-bout { border: 1px solid var(--rule); border-top: 3px solid var(--accent); }
.public-bout--in_progress { border-top-color: var(--vermilion); box-shadow: 0 0 0 2px var(--vermilion-soft); }
.public-bout header, .public-bout footer { display: flex; justify-content: space-between; padding: 5px 8px; color: var(--ink-3); background: var(--bg-sunken); font-size: 8px; }
.public-bout > div { display: grid; grid-template-columns: 22px 1fr; gap: 5px; padding: 6px 8px; border-top: 1px solid var(--rule-soft); }
.public-bout > div span { color: var(--ink-3); font-size: 8px; }
.public-bout > div strong { font-size: 11px; }
.public-bout > div small { grid-column: 2; color: var(--ink-3); font-size: 8px; }
.rank-medal { display: inline-grid; place-items: center; width: 24px; height: 24px; color: #fff; background: var(--accent); border-radius: 50%; }
.rank-medal--1 { color: #3e3212; background: #d6b44a; }.rank-medal--2 { color: #343434; background: #c6c8cb; }.rank-medal--3 { background: #9b653d; }
.auth-initial-login {
  display: grid;
  gap: 2px;
  margin-top: 16px;
  padding: 10px 12px;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
  border-left: 3px solid var(--warning);
  font-size: 10px;
}
.auth-initial-login code { padding: 1px 4px; color: var(--ink-1); background: rgba(255,255,255,.55); font-family: var(--font-mono); }
.auth-initial-login small { color: var(--ink-2); }
.tab--command { margin-left: auto; color: var(--vermilion); font-weight: 800; }
.tournament-launch-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.launch-card { position: relative; min-height: 126px; padding: 16px; color: var(--ink-1); background: var(--bg-surface); border: 1px solid var(--rule); border-top: 3px solid var(--accent); overflow: hidden; transition: transform .16s ease, box-shadow .16s ease; }
.launch-card:hover { color: var(--ink-1); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.launch-card--accent { color: var(--ink-on-dark); background: var(--accent); border-color: var(--accent); border-top-color: var(--vermilion); }
.launch-card--accent:hover { color: #fff; }
.launch-card > small, .launch-card > strong, .launch-card > p { position: relative; z-index: 1; display: block; }
.launch-card > small { color: var(--vermilion); font: 700 8px var(--font-brand); letter-spacing: .15em; }
.launch-card--accent > small { color: #f0aca0; }
.launch-card > strong { margin: 4px 0; font-size: 16px; }
.launch-card > p { color: var(--ink-3); font-size: 10px; }
.launch-card--accent > p { color: var(--ink-on-dark-2); }
.launch-kanji { position: absolute; right: 6px; bottom: -22px; color: rgba(33,61,91,.07); font: 900 92px serif; }
.launch-card--accent .launch-kanji { color: rgba(255,255,255,.08); }
.overview-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.weight-class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 7px; }
.weight-class-grid article { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 8px; padding: 9px 10px; background: var(--bg-sunken); border: 1px solid var(--rule-soft); }
.weight-class-grid article strong { font-size: 11px; }
.weight-class-grid article small { grid-column: 2; color: var(--ink-3); font-size: 8px; }
.weight-sex { grid-row: 1 / span 2; padding: 2px 5px; color: #fff; background: var(--accent); font-size: 8px; font-weight: 800; }
.weight-sex--female { background: var(--vermilion); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 45%, var(--rule)); }
.danger-zone .panel-head h2 { color: var(--danger); }
.team-entry-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; padding: 12px; }
.team-entry-card { display: grid; gap: 10px; padding: 14px; background: var(--bg-surface); border: 1px solid var(--rule); border-top: 3px solid var(--accent); }
.team-entry-card.is-cancelled { opacity: .58; filter: grayscale(.5); }
.team-entry-identity { display: flex; align-items: center; gap: 10px; }
.team-entry-identity .logo-thumb, .team-entry-identity .roster-logo-placeholder { flex: 0 0 auto; width: 38px; height: 38px; }
.team-entry-identity h3 { font-size: 14px; }
.team-entry-identity p, .team-entry-contact { color: var(--ink-3); font-size: 9px; }
.team-entry-contact { display: flex; flex-wrap: wrap; gap: 5px 12px; }
.team-entry-foot, .button-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.team-sex-section { padding: 14px 16px 18px; border-top: 1px solid var(--rule-soft); }
.team-sex-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.team-sex-section-head h3 { font-size: 14px; }
.team-sex-table-wrap { border-radius: 0; }
.team-sex-table .team-sex-col { width: 64px; }
.team-sex-table tr.is-cancelled { opacity: .58; filter: grayscale(.5); }
.team-sex-mark { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; color: #fff; background: var(--accent); border-radius: 50%; font-weight: 800; }
.team-sex-mark--female { background: var(--vermilion); }
.team-sex-mark--unset { background: var(--ink-3); }
.team-sex-legacy-note { margin-top: 8px; }
.token-block { display: block; margin-top: 8px; padding: 8px; background: var(--bg-sunken); border: 1px solid var(--rule); overflow-wrap: anywhere; }
.division-master-grid { display: grid; gap: 9px; padding: 12px; }
.division-master-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; padding: 12px; background: var(--bg-surface); border: 1px solid var(--rule); border-left: 3px solid var(--accent); }
.division-master-card > form:first-child { min-width: 0; }
.division-master-card header { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; color: var(--ink-3); font-size: 8px; }
.division-master-card header code { color: var(--accent); font-family: var(--font-mono); }
.division-master-card header > span:last-child { margin-left: auto; }
.division-master-card footer { margin-top: 8px; }
.division-range-row { display: grid; grid-template-columns: minmax(75px,1fr) auto minmax(75px,1fr) minmax(95px,1fr) auto minmax(95px,1fr) 78px; align-items: end; gap: 5px; }
.division-range-row > label > span { display: block; color: var(--ink-3); font-size: 8px; }
.division-range-row > span { padding-bottom: 7px; color: var(--ink-3); }

@media (max-width: 980px) {
  .judo-workspace { grid-template-columns: 1fr; }
  .division-summary .panel-body { align-items: flex-start; flex-direction: column; }
  .public-bout-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tournament-launch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .judo-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .division-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .judo-inline-form, .draw-action, .bout-state-form, .bout-result-primary, .bout-notes-row { align-items: stretch; flex-direction: column; }
  .judo-seed-field { flex-basis: auto; }
  .bout-card > summary { grid-template-columns: 48px 1fr 20px 1fr; }
  .bout-card > summary .status-pill { grid-column: 1 / -1; justify-self: start; }
  .bout-score-grid { grid-template-columns: 44px repeat(4, minmax(44px, 1fr)); width: 100%; }
  .public-judo-hero { align-items: flex-start; padding: 18px; }
  .public-judo-mon { width: 48px; height: 48px; font-size: 20px; }
  .public-overview-grid { grid-template-columns: 1fr; }
  .public-division-title { align-items: flex-start; flex-direction: column; gap: 8px; }
  .public-bout-grid { grid-template-columns: 1fr; }
  .overview-columns { grid-template-columns: 1fr; }
  .tab--command { margin-left: 0; }
  .division-master-card { grid-template-columns: 1fr; }
  .division-range-row { grid-template-columns: 1fr 14px 1fr; }
  .division-range-row label:nth-of-type(3) { grid-column: 1; }
}
@media (max-width: 460px) {
  .judo-kpis { gap: 6px; }
  .judo-kpis article { min-height: 76px; padding: 10px 12px; }
  .weigh-input-row { grid-template-columns: 1fr; }
  .public-judo-hero .live-indicator { position: absolute; right: 12px; bottom: 8px; }
  .public-entry-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .public-division-meta { flex-wrap: wrap; }
  .tournament-launch-grid { grid-template-columns: 1fr; }
}

/* =================================================================
   22. Competition-night visual layer
   -----------------------------------------------------------------
   A more energetic judo identity layered over the quiet administrative
   foundation: arena light, tatami geometry, shuiro accents and purposeful
   motion. Kept screen-only so operational print output remains untouched.
   ================================================================= */
@media screen {
  :root {
    --bg-page: #e9e8e1;
    --bg-surface: #fffef9;
    --bg-sunken: #e2e5e4;
    --bg-rail: #07131f;
    --bg-rail-hover: #10263a;
    --accent: #153f68;
    --accent-hover: #0b3156;
    --accent-press: #072642;
    --accent-soft: #dce8f2;
    --vermilion: #d44832;
    --vermilion-dark: #aa2f20;
    --vermilion-soft: #f8ded8;
    --rule: #c9cbc6;
    --rule-soft: #e2e3df;
    --rule-on-dark: #213447;
    --radius: 5px;
    --radius-lg: 10px;
    --shadow-sm: 0 2px 3px rgba(7, 19, 31, .05), 0 8px 22px rgba(7, 19, 31, .035);
    --shadow-md: 0 20px 55px rgba(7, 19, 31, .16);
  }

  body {
    background-color: var(--bg-page);
    background-image:
      radial-gradient(circle at 82% -10%, rgba(21, 63, 104, .13), transparent 32rem),
      radial-gradient(circle at 10% 105%, rgba(212, 72, 50, .07), transparent 30rem),
      linear-gradient(rgba(7, 19, 31, .025) 1px, transparent 1px),
      linear-gradient(90deg, rgba(7, 19, 31, .025) 1px, transparent 1px),
      repeating-linear-gradient(108deg, transparent 0 8px, rgba(88, 78, 56, .014) 8px 9px);
    background-size: auto, auto, 32px 32px, 32px 32px, auto;
  }

  .app-shell {
    position: relative;
    isolation: isolate;
  }

  .app-main {
    position: relative;
    animation: dojo-page-in .48s cubic-bezier(.2, .8, .2, 1) both;
  }

  .app-main::before {
    content: "柔";
    position: fixed;
    right: clamp(12px, 3vw, 54px);
    bottom: -0.13em;
    z-index: -1;
    color: rgba(7, 19, 31, .025);
    font-family: serif;
    font-size: clamp(190px, 27vw, 430px);
    font-weight: 900;
    line-height: 1;
    pointer-events: none;
    user-select: none;
  }

  .app-rail {
    isolation: isolate;
    overflow: hidden;
    border-right-color: rgba(111, 151, 187, .26);
    background-color: var(--bg-rail);
    background-image:
      radial-gradient(circle at 34% 10%, rgba(38, 102, 157, .30), transparent 26%),
      linear-gradient(160deg, transparent 35%, rgba(212, 72, 50, .08) 100%),
      repeating-linear-gradient(0deg, transparent 0 5px, rgba(255,255,255,.014) 5px 6px);
    box-shadow: 12px 0 38px rgba(1, 11, 20, .13);
  }

  .app-rail::after {
    content: "";
    position: absolute;
    inset: -40% auto -40% -60%;
    z-index: -1;
    width: 70%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.045), transparent);
    transform: skewX(-18deg);
    animation: rail-light 9s ease-in-out infinite;
    pointer-events: none;
  }

  .rail-brand {
    position: relative;
    min-height: 142px;
    justify-content: flex-end;
    padding: 28px 24px 21px;
    background:
      radial-gradient(circle at 83% 26%, rgba(212,72,50,.95) 0 4px, rgba(212,72,50,.20) 5px 28px, transparent 29px),
      linear-gradient(180deg, rgba(255,255,255,.035), transparent);
  }

  .rail-brand::after {
    content: "柔道";
    position: absolute;
    top: 5px;
    right: 13px;
    color: rgba(255,255,255,.055);
    font-family: serif;
    font-size: 58px;
    font-weight: 900;
    letter-spacing: -.18em;
    line-height: 1;
    pointer-events: none;
  }

  .rail-brand-title {
    font-size: 15px;
    font-weight: 750;
    letter-spacing: .13em;
  }

  .rail-brand-sub { color: #7f98ad; }

  .rail-section-label {
    color: #71869a;
    font-weight: 700;
  }

  .rail-link {
    position: relative;
    min-height: 38px;
    padding: 8px 9px 8px 43px;
    margin-left: -9px;
    border-left: 0;
    border-radius: 4px;
    color: #b9c7d3;
    font-weight: 600;
    transition: color .18s ease, background-color .18s ease, transform .18s ease;
  }

  .rail-link::before {
    content: "・";
    position: absolute;
    left: 10px;
    display: grid;
    place-items: center;
    width: 23px;
    height: 23px;
    color: #8fa6ba;
    border: 1px solid rgba(143,166,186,.32);
    border-radius: 50%;
    font-family: serif;
    font-size: 12px;
    font-weight: 800;
    transition: color .18s ease, border-color .18s ease, background-color .18s ease, transform .18s ease;
  }

  .rail-link[href="/admin"]::before,
  .rail-link[href="/coach"]::before { content: "大"; }
  .rail-link[href="/admin/tournaments/new"]::before { content: "新"; }
  .rail-link[href="/admin/coaches"]::before { content: "師"; }
  .rail-link[href="/coach/teams"]::before { content: "団"; }
  .rail-link[href="/coach/athletes"]::before { content: "選"; }
  .rail-link[href="/account"]::before { content: "人"; }
  .rail-link[href*="/settings"]::before { content: "設"; }
  .rail-link[href*="/users"]::before { content: "運"; }
  .rail-link[href*="/categories"]::before { content: "級"; }

  .rail-link:hover {
    color: #fff;
    background: linear-gradient(90deg, rgba(41, 88, 127, .52), rgba(41, 88, 127, .08));
    transform: translateX(3px);
  }

  .rail-link.is-active {
    color: #fff;
    background: linear-gradient(90deg, rgba(212,72,50,.28), rgba(212,72,50,.035));
    box-shadow: inset 3px 0 var(--vermilion);
  }

  .rail-link.is-active::before {
    color: #fff;
    border-color: var(--vermilion);
    background: var(--vermilion);
    box-shadow: 0 0 0 4px rgba(212,72,50,.12);
    transform: rotate(-5deg);
  }

  .rail-foot {
    border-top-color: rgba(127,152,173,.18);
    background: rgba(1, 8, 14, .22);
  }

  .rail-motto span { color: #d8e0e5; }

  .app-topbar {
    min-height: var(--topbar-h);
    background: rgba(255, 254, 249, .82);
    border-bottom-color: rgba(7, 19, 31, .13);
    box-shadow: 0 8px 26px rgba(7,19,31,.045);
    backdrop-filter: blur(18px) saturate(1.3);
  }

  .app-topbar::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--vermilion), #ee806d 45%, var(--accent));
    transform: scaleX(0);
    transform-origin: left;
    animation: scroll-progress linear both;
    animation-timeline: scroll(root block);
  }

  .topbar-user .user-role {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: transparent;
    border-radius: 99px;
    font-weight: 800;
  }

  .topbar-logout {
    border-color: transparent;
    background: rgba(7,19,31,.055);
  }

  .page-head {
    min-height: 85px;
    align-items: center;
    padding: 5px 0 18px 18px;
    border-bottom-color: rgba(7, 19, 31, .18);
  }

  .page-head::before {
    content: "";
    position: absolute;
    top: 5px;
    bottom: 20px;
    left: 0;
    width: 5px;
    background: linear-gradient(180deg, var(--vermilion), var(--vermilion-dark));
    box-shadow: 0 0 0 5px rgba(212,72,50,.07);
  }

  .page-head::after {
    width: min(28vw, 280px);
    height: 2px;
    background: linear-gradient(90deg, var(--vermilion), transparent);
  }

  .page-head-title {
    font-size: clamp(24px, 2.4vw, 34px);
    font-weight: 800;
    letter-spacing: .035em;
  }

  .page-head-lede { margin-top: 6px; font-size: 12px; }

  .panel,
  .t-card,
  .team-entry-card,
  .public-live-board {
    border-color: rgba(7, 19, 31, .13);
    box-shadow: var(--shadow-sm);
  }

  .panel,
  .t-card,
  .team-entry-card,
  .launch-card {
    transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s ease, border-color .22s ease;
  }

  .panel:hover,
  .t-card:hover,
  .team-entry-card:hover {
    border-color: rgba(21,63,104,.29);
    box-shadow: 0 14px 36px rgba(7,19,31,.09);
  }

  .panel-head {
    min-height: 51px;
    background:
      linear-gradient(90deg, rgba(21,63,104,.085), transparent 52%),
      linear-gradient(180deg, rgba(255,255,255,.55), transparent);
  }

  .panel-head h2 { font-size: 14px; font-weight: 750; }

  .btn {
    position: relative;
    overflow: hidden;
    min-height: 36px;
    font-weight: 700;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
  }

  .btn::after {
    content: "";
    position: absolute;
    top: -80%;
    bottom: -80%;
    left: -45%;
    width: 24%;
    background: rgba(255,255,255,.20);
    transform: rotate(18deg) translateX(-220%);
    transition: transform .46s ease;
    pointer-events: none;
  }

  .btn:hover::after { transform: rotate(18deg) translateX(720%); }
  .btn:hover { transform: translateY(-1px); }

  .btn--primary {
    background: linear-gradient(135deg, #1c527f, var(--accent));
    border-color: var(--accent);
    box-shadow: 0 7px 18px rgba(21,63,104,.18);
  }

  .btn--primary:hover {
    background: linear-gradient(135deg, var(--vermilion), var(--vermilion-dark));
    border-color: var(--vermilion-dark);
    box-shadow: 0 9px 24px rgba(170,47,32,.22);
  }

  .table-wrap {
    border-color: rgba(7,19,31,.15);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
  }

  .data-table thead th {
    color: #dae3ea;
    background: #0b1d2d;
    border-bottom-color: #294158;
  }

  .data-table tbody tr { transition: background-color .16s ease, box-shadow .16s ease; }
  .data-table tbody tr:hover { background: #f1f6f8; box-shadow: inset 4px 0 var(--vermilion); }

  .status-pill {
    border-radius: 99px;
    font-weight: 800;
    letter-spacing: .04em;
  }

  .status-pill--live {
    color: #fff;
    background: var(--vermilion);
    border-color: var(--vermilion);
    box-shadow: 0 0 0 0 rgba(212,72,50,.35);
    animation: live-status-ring 2s ease-out infinite;
  }

  .t-card {
    position: relative;
    overflow: hidden;
    min-height: 176px;
    padding: 21px;
    border-top: 4px solid var(--accent);
  }

  .t-card::after {
    content: "大会";
    position: absolute;
    right: -9px;
    bottom: -19px;
    color: rgba(21,63,104,.05);
    font-family: serif;
    font-size: 76px;
    font-weight: 900;
    line-height: 1;
    pointer-events: none;
  }

  .t-card-title { font-size: 17px; font-weight: 800; }

  .launch-card {
    min-height: 142px;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
  }

  .launch-card:hover {
    border-top-color: var(--vermilion);
    transform: translateY(-5px);
    box-shadow: 0 18px 40px rgba(7,19,31,.14);
  }

  .launch-card > strong { font-size: 18px; }
  .launch-kanji { transition: transform .4s cubic-bezier(.2,.8,.2,1), color .4s ease; }
  .launch-card:hover .launch-kanji { color: rgba(212,72,50,.13); transform: rotate(-6deg) scale(1.09); }
  .launch-card--accent:hover .launch-kanji { color: rgba(255,255,255,.14); }

  .judo-kpis article {
    border-top: 3px solid #315f86;
    background:
      radial-gradient(circle at 90% 20%, rgba(55,112,159,.28), transparent 44%),
      linear-gradient(145deg, #0d263a, #07131f);
    box-shadow: 0 12px 28px rgba(7,19,31,.13);
    transition: transform .2s ease, border-color .2s ease;
  }

  .judo-kpis article:hover { border-top-color: var(--vermilion); transform: translateY(-3px); }

  .public-judo-hero {
    min-height: 248px;
    margin: 0 0 18px;
    padding: 42px clamp(22px, 4vw, 58px);
    border: 0;
    border-bottom: 5px solid var(--vermilion);
    border-radius: 0 0 12px 12px;
    background-color: #07131f;
    background-image:
      linear-gradient(90deg, rgba(3,12,20,.96) 0%, rgba(3,12,20,.82) 35%, rgba(3,12,20,.30) 72%, rgba(3,12,20,.08) 100%),
      url('/assets/images/judo-arena-hero.webp');
    background-position: center, center;
    background-size: cover;
    box-shadow: 0 18px 42px rgba(7,19,31,.23);
  }

  .public-judo-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 55%, rgba(255,255,255,.12) 55.2%, transparent 55.5%);
    transform: translateX(-100%);
    animation: hero-glint 6s ease-in-out 1s infinite;
    pointer-events: none;
  }

  .public-judo-hero::after { display: none; }

  .public-judo-hero > * { position: relative; z-index: 1; }
  .public-judo-hero h1 { max-width: 700px; font-size: clamp(27px, 4.2vw, 52px); line-height: 1.2; text-shadow: 0 2px 18px rgba(0,0,0,.55); }

  .public-judo-mon {
    width: 78px;
    height: 78px;
    background: rgba(212,72,50,.90);
    border-color: rgba(255,255,255,.78);
    box-shadow: 0 0 0 9px rgba(212,72,50,.16), 0 12px 28px rgba(0,0,0,.24);
    transform: rotate(-4deg);
  }

  .live-indicator {
    padding: 7px 11px;
    border: 1px solid rgba(255,255,255,.26);
    border-radius: 99px;
    background: rgba(7,19,31,.58);
    backdrop-filter: blur(8px);
  }

  .live-indicator i { background: #ff5441; box-shadow: 0 0 0 4px rgba(255,84,65,.17), 0 0 18px #ff5441; }

  .public-bout--in_progress {
    border-color: var(--vermilion);
    box-shadow: 0 0 0 2px var(--vermilion-soft), 0 10px 25px rgba(170,47,32,.15);
    animation: active-bout 2.4s ease-in-out infinite;
  }

  .auth-shell {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(320px, 520px) 1fr;
    grid-template-rows: 1fr auto;
    justify-items: stretch;
    gap: 0;
    padding: clamp(28px, 5vw, 76px);
    overflow: hidden;
    background-color: #07131f;
    background-image:
      linear-gradient(90deg, rgba(2,10,17,.95) 0%, rgba(2,10,17,.79) 35%, rgba(2,10,17,.25) 69%, rgba(2,10,17,.08) 100%),
      linear-gradient(0deg, rgba(2,10,17,.40), transparent 45%),
      url('/assets/images/judo-arena-hero.webp');
    background-position: center, center, center;
    background-size: cover;
  }

  .auth-shell::before {
    content: "柔道";
    position: absolute;
    right: 3vw;
    bottom: -.18em;
    z-index: -1;
    color: rgba(255,255,255,.045);
    font-family: serif;
    font-size: clamp(160px, 27vw, 430px);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -.17em;
    pointer-events: none;
  }

  .auth-shell::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: clamp(18px, 2.5vw, 44px);
    width: 4px;
    z-index: -1;
    background: linear-gradient(180deg, transparent, var(--vermilion) 22% 78%, transparent);
    opacity: .8;
  }

  .auth-shell > .auth-card {
    align-self: center;
    justify-self: start;
    grid-column: 1;
  }

  .auth-card {
    max-width: 430px;
    padding: 42px 39px 34px;
    border-color: rgba(255,255,255,.55);
    background: rgba(255,254,249,.93);
    box-shadow: 0 30px 90px rgba(0,0,0,.36);
    backdrop-filter: blur(18px) saturate(1.18);
    animation: auth-card-in .7s cubic-bezier(.16,.8,.24,1) both;
  }

  .auth-card.auth-card--wide { max-width: 500px; }

  .auth-card::before {
    right: 0;
    left: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--vermilion) 0 35%, #f49a84 35% 45%, var(--accent) 45%);
  }

  .auth-brand-title { font-size: 22px; font-weight: 800; }
  .auth-brand-mark { color: var(--vermilion); font-weight: 800; }

  .auth-shell > .brand-footer {
    grid-column: 1 / -1;
    color: rgba(255,255,255,.56);
  }

  .auth-shell > .brand-footer a { color: rgba(255,255,255,.78); }

  .motion-reveal {
    opacity: 0;
    transform: translateY(16px);
  }

  .motion-reveal.is-revealed {
    animation: content-reveal .48s cubic-bezier(.2,.75,.25,1) calc(var(--reveal-order, 0) * 55ms) forwards;
  }
}

@supports (view-transition-name: root) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: .16s ease both view-out; }
  ::view-transition-new(root) { animation: .34s ease both view-in; }
}

@keyframes dojo-page-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}
@keyframes rail-light {
  0%, 18% { transform: translateX(-45%) skewX(-18deg); opacity: 0; }
  36% { opacity: 1; }
  58%, 100% { transform: translateX(440%) skewX(-18deg); opacity: 0; }
}
@keyframes scroll-progress { to { transform: scaleX(1); } }
@keyframes live-status-ring {
  70%, 100% { box-shadow: 0 0 0 7px rgba(212,72,50,0); }
}
@keyframes hero-glint {
  0%, 28% { transform: translateX(-100%); }
  50%, 100% { transform: translateX(100%); }
}
@keyframes active-bout {
  50% { box-shadow: 0 0 0 3px rgba(212,72,50,.13), 0 12px 30px rgba(170,47,32,.18); }
}
@keyframes auth-card-in {
  from { opacity: 0; transform: translateX(-22px) scale(.985); }
  to { opacity: 1; transform: none; }
}
@keyframes content-reveal {
  to { opacity: 1; transform: none; }
}
@keyframes view-out { to { opacity: 0; transform: translateY(-4px); } }
@keyframes view-in { from { opacity: 0; transform: translateY(7px); } }

@media screen and (max-width: 880px) {
  .app-rail { box-shadow: 18px 0 55px rgba(1,11,20,.28); }
  .app-main::before { position: absolute; }

  .auth-shell {
    grid-template-columns: 1fr;
    padding: 26px 18px;
    background-position: center, center, 66% center;
  }
  .auth-shell::after { left: 10px; }
  .auth-shell > .auth-card { justify-self: center; grid-column: 1; }
  .auth-shell > .brand-footer { grid-column: 1; }

  .public-judo-hero {
    min-height: 220px;
    background-position: center, 65% center;
  }
}

@media screen and (max-width: 560px) {
  .page-head { align-items: flex-start; min-height: 0; padding-left: 14px; }
  .page-head::before { bottom: 17px; width: 4px; }
  .page-head-title { font-size: 25px; }

  .auth-card { padding: 35px 25px 28px; }
  .auth-shell {
    background-image:
      linear-gradient(0deg, rgba(2,10,17,.78), rgba(2,10,17,.60)),
      url('/assets/images/judo-arena-hero.webp');
  }

  .public-judo-hero {
    min-height: 240px;
    align-items: flex-start;
    gap: 13px;
    padding: 26px 18px 42px;
    background-position: center, 63% center;
  }
  .public-judo-hero h1 { font-size: 27px; }
  .public-judo-mon { width: 50px; height: 50px; font-size: 21px; }

}

@media (prefers-reduced-motion: reduce) {
  .app-main,
  .app-rail::after,
  .auth-card,
  .public-judo-hero::before,
  .status-pill--live,
  .public-bout--in_progress,
  .motion-reveal,
  .motion-reveal.is-revealed {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
}

/* -- 23. Smartphone usability pass -------------------------------
   These rules intentionally live after the screen theme so they win the
   cascade on small viewports. Dense administrative data remains available
   through contained horizontal scrollers, while controls and navigation use
   phone-sized touch targets. */
@media screen and (max-width: 880px) {
  :root {
    --topbar-h: calc(54px + env(safe-area-inset-top, 0px));
  }

  /* Content visibility must never depend on IntersectionObserver on phones.
     This also covers a desktop-to-mobile resize after reveal classes exist. */
  .motion-reveal,
  .motion-reveal.is-revealed {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  .app-main { animation: none; }

  .app-rail {
    height: 100vh;
    height: 100dvh;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .app-rail-close {
    position: absolute;
    top: calc(10px + env(safe-area-inset-top, 0px));
    right: 10px;
    z-index: 3;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    color: var(--ink-on-dark-2);
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: var(--radius);
    font-size: 24px;
    line-height: 1;
  }

  .app-rail-close:hover {
    color: var(--ink-on-dark);
    background: rgba(255, 255, 255, .12);
  }

  .app-topbar {
    min-height: var(--topbar-h);
    padding-top: env(safe-area-inset-top, 0px);
    padding-right: max(var(--content-pad-sm), env(safe-area-inset-right, 0px));
    padding-left: max(var(--content-pad-sm), env(safe-area-inset-left, 0px));
  }

  .app-main {
    padding-right: max(var(--content-pad), env(safe-area-inset-right, 0px));
    padding-bottom: calc(var(--content-pad) + env(safe-area-inset-bottom, 0px));
    padding-left: max(var(--content-pad), env(safe-area-inset-left, 0px));
  }

  .auth-shell,
  .error-page {
    padding-top: max(24px, env(safe-area-inset-top, 0px));
    padding-right: max(18px, env(safe-area-inset-right, 0px));
    padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
    padding-left: max(18px, env(safe-area-inset-left, 0px));
  }

  .public-judo-hero {
    padding-right: max(clamp(22px, 4vw, 58px), env(safe-area-inset-right, 0px));
    padding-left: max(clamp(22px, 4vw, 58px), env(safe-area-inset-left, 0px));
  }

  .app-hamburger {
    width: 44px;
    height: 44px;
  }

  .topbar-logout,
  .rail-link,
  .tab,
  .division-tab {
    min-height: 44px;
  }

  .topbar-logout {
    display: inline-flex;
    align-items: center;
    padding-right: 10px;
    padding-left: 10px;
  }

  .btn {
    min-height: 44px;
    touch-action: manipulation;
  }

  .btn--sm { min-height: 40px; }

  .input,
  .select,
  .textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .roster-toolbar .input,
  .roster-toolbar .select {
    min-height: 44px;
    font-size: 16px;
  }

  .field-checkbox {
    min-height: 44px;
    touch-action: manipulation;
  }

  .form-foot,
  .panel-foot,
  .settings-media-actions {
    flex-wrap: wrap;
  }

  .tabs,
  .public-tournament-nav {
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .tab,
  .public-tournament-nav a {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .table-wrap,
  .bracket-scroll,
  .division-switcher {
    max-width: 100%;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  /* Do not squeeze Japanese table content one character per line. Tables
     become self-contained horizontal scrollers instead of widening the page. */
  .data-table {
    width: max-content;
    min-width: 100%;
  }

  .data-table th,
  .data-table td {
    overflow-wrap: normal;
    word-break: keep-all;
    white-space: nowrap;
  }

  .data-table .row-empty td { white-space: normal; }

  .team-entry-card,
  .team-entry-identity > div,
  .public-judo-hero > div {
    min-width: 0;
  }

  .roster-action-link {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    padding: 8px 4px;
    touch-action: manipulation;
  }

}

@media screen and (max-width: 480px) {
  :root { --content-pad: 14px; }

  .topbar-crumbs > * { display: none; }
  .topbar-crumbs > .crumb-current:last-child {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-head {
    gap: 10px;
    margin-bottom: 18px;
  }

  .page-head-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .page-head-actions .btn { width: 100%; white-space: normal; }
  .page-head-actions .btn:only-child { grid-column: 1 / -1; }

  .panel + .panel { margin-top: 18px; }

  .form-foot {
    align-items: stretch;
    flex-direction: column;
  }

  .form-foot .btn,
  .panel-foot .btn {
    flex: 1 1 auto;
  }

  .panel-foot,
  .settings-media-actions {
    align-items: stretch !important;
    flex-direction: column;
  }

  .panel-foot .btn,
  .settings-media-actions .btn { width: 100%; }

  .button-row > .btn,
  .button-row > form {
    flex: 1 1 140px;
  }

  .button-row > form > .btn { width: 100%; }

  .team-entry-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .parent-card {
    padding-right: max(18px, env(safe-area-inset-right, 0px));
    padding-left: max(18px, env(safe-area-inset-left, 0px));
  }

  .division-summary-main { align-items: flex-start; }

  /* The summary becomes a compact two-row scorecard: metadata and status on
     the first row, contestants on the second. */
  .bout-card > summary {
    grid-template-columns: 24px minmax(0, 1fr) 20px minmax(0, 1fr);
    gap: 6px;
  }
  .bout-card > summary::before { grid-column: 1; grid-row: 1; }
  .bout-card > summary .bout-number { grid-column: 2; grid-row: 1; }
  .bout-card > summary .status-pill { grid-column: 3 / -1; grid-row: 1; justify-self: end; }
  .bout-card > summary .bout-player--white { grid-column: 2; grid-row: 2; }
  .bout-card > summary .bout-versus { grid-column: 3; grid-row: 2; }
  .bout-card > summary .bout-player--blue { grid-column: 4; grid-row: 2; }
}

@media screen and (max-width: 360px) {
  .page-head-title { font-size: 23px; }
  .flash { flex-direction: column; gap: 4px; }
  .public-judo-hero h1 { font-size: 24px; }
  .judo-kpis strong { font-size: 24px; }
}
