:root {
  color-scheme: light;
  --bg: #eef2f7;
  --ink: #0c1b2a;
  --muted: #5b6b80;
  --accent: #1f6feb;
  --accent-2: #4d8dff;
  --brand-freestyle: #1f6feb;
  --brand-score: #0c1b2a;
  --card: rgba(255, 255, 255, 0.78);
  --topbar: rgba(31, 111, 235, 0.95);
  --topbar-ink: #ffffff;
  --status: #e5ecf6;
  --border: #cfd9e6;
  --shadow: 0 20px 40px rgba(12, 27, 42, 0.12);
  --radius: 2px;
  --topbar-height: 96px;
  --status-height: 34px;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(160deg, #f7f9fd 0%, #eef2f7 55%, #e6edf6 100%);
  color: var(--ink);
  min-height: 100vh;
}

html,
body {
  height: 100%;
}

h1,
h2,
h3 {
  margin: 0 0 12px;
  font-weight: 600;
}

.muted {
  color: var(--muted);
}

.page-center {
  display: grid;
  place-items: center;
  padding: 32px;
}

.center-card {
  background: var(--card);
  padding: 32px;
  border-radius: var(--radius);
  min-width: 320px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--brand-score);
  padding: 32px 16px;
}

.login-card {
  width: min(420px, 92vw);
  background: #ffffff;
  border: 1px solid #e4ecf8;
  box-shadow: 0 18px 40px rgba(10, 28, 60, 0.12);
  padding: 36px 32px 30px;
  text-align: center;
  border-radius: var(--radius);
}

.brand,
.brand-title {
  font-style: italic;
  font-weight: 700;
  font-size: clamp(2.6rem, 7vw, 3.4rem);
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.brand-freestyle {
  color: var(--brand-freestyle);
}

.brand-score {
  color: var(--brand-score);
}

.center-stack {
  text-align: center;
}

.login-subtitle {
  color: #5f6b85;
  margin: 0 0 16px;
}

.form-stack {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.field {
  display: grid;
  gap: 6px;
  text-align: left;
  font-size: 0.95rem;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
}

input {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 1rem;
}

input::placeholder {
  color: #8a96ab;
}

.inline-form {
  margin: 12px 0 16px;
  padding: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
}

.checkbox-grid {
  border: 1px solid var(--border);
  padding: 10px 12px 12px;
}

.checkbox-grid legend {
  font-weight: 600;
  padding: 0 6px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

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

.login-card input {
  border: 1px solid #d4dfef;
  padding: 12px 14px;
}

.login-card input:focus {
  outline: none;
  border-color: var(--brand-freestyle);
  box-shadow: 0 0 0 3px rgba(90, 167, 255, 0.25);
}

button {
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(30, 26, 22, 0.12);
}

.primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary {
  width: 100%;
  background: var(--brand-freestyle);
  color: #ffffff;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  transition: background 0.2s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-score);
}

.btn-primary:disabled {
  background: #a7c7f7;
  opacity: 0.7;
}

.ghost {
  background: transparent;
  color: inherit;
  border-color: var(--border);
}

.continue-wrap.hidden {
  display: none;
}

.status-text {
  margin-top: 16px;
  min-height: 20px;
  color: #55657f;
}

.dashboard-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--brand-score);
  padding: 32px 16px;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
}

.dashboard-card {
  width: min(520px, 92vw);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px 30px;
  text-align: center;
  display: grid;
  gap: 14px;
  backdrop-filter: blur(16px);
}

.dashboard-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
}

.dashboard-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 20px 32px 12px;
}

.header-meta {
  display: grid;
  gap: 6px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-status {
  padding: 8px 32px;
  background: rgba(255, 255, 255, 0.7);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr) minmax(220px, 300px);
  gap: 20px;
  padding: 20px 32px 32px;
  flex: 1;
}

.dashboard-grid .dashboard-card {
  width: auto;
  text-align: left;
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--card);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
}

.nav-card {
  display: grid;
  gap: 12px;
}

.nav-links {
  display: grid;
  gap: 10px;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

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

.nav-link-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.nav-note {
  font-size: 0.9rem;
}

.perm-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.perm-chip--allow {
  background: rgba(31, 111, 235, 0.12);
  color: #12418c;
  border: 1px solid rgba(31, 111, 235, 0.35);
}

.perm-chip--deny {
  background: rgba(31, 111, 235, 0.08);
  color: #274b86;
  border: 1px solid rgba(31, 111, 235, 0.2);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.stat {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 6px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.paddler-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.paddler-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: rgba(31, 111, 235, 0.06);
}

.perm-list {
  display: grid;
  gap: 10px;
}

.perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
}

.brand.brand-sm {
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  margin-bottom: 4px;
}

.dashboard-title {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2rem);
}

.dashboard-subtitle {
  color: #5f6b85;
  margin: 0;
}

.dashboard-actions {
  display: grid;
  gap: 12px;
}

.dashboard-actions .ghost {
  text-decoration: none;
  display: inline-block;
}

.heat-list {
  display: grid;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}

.heat-list-header {
  font-size: 0.9rem;
}

.heat-list-grid {
  display: grid;
  gap: 8px;
}

.heat-select {
  display: grid;
  gap: 8px;
}

.heat-select-input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: #ffffff;
}

.heat-card {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  text-decoration: none;
  color: inherit;
  font-weight: 600;
}

.heat-card:hover {
  border-color: var(--accent);
}

.heat-card-title {
  font-size: 1rem;
}

.heat-card-status {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.heat-card--disabled {
  opacity: 0.5;
  pointer-events: none;
}

.heat-empty {
  font-size: 0.9rem;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
  background: var(--bg);
  color: var(--ink);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 20px;
  background: rgba(255, 255, 255, 0.7);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.auth-card {
  margin-top: auto;
}

.brand-left {
  text-align: left;
  margin-bottom: 6px;
}

.side-nav {
  display: grid;
  gap: 10px;
}

.side-link {
  text-decoration: none;
  color: var(--ink);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.8);
  font-weight: 600;
}

.side-link.active,
.side-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.content {
  display: grid;
  gap: 16px;
  padding: 24px 32px 32px;
}

.page-header {
  display: grid;
  gap: 8px;
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.page-header--actions {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.page-header-actions {
  display: flex;
  gap: 8px;
  justify-self: end;
}

.date-time {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-weight: 600;
}

.auth-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.8);
}

.auth-label {
  font-weight: 600;
  color: var(--ink);
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.admin-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid;
  gap: 12px;
  backdrop-filter: blur(16px);
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.file-input {
  display: none;
}

.admin-list {
  min-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.85);
  max-height: 420px;
  overflow-y: auto;
}

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

.admin-list li {
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(31, 111, 235, 0.06);
}
.lineup-slots {
  display: grid;
  gap: 10px;
}
.lineup-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #ffffffd9;
}
.lineup-label {
  font-weight: 600;
}
.lineup-row select {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 1rem;
}

.judge-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
  overflow-x: hidden;
  height: 100vh;
  width: 100%;
  max-width: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
  padding: 16px 24px;
  background: var(--topbar);
  color: var(--topbar-ink);
  min-height: var(--topbar-height);
  backdrop-filter: blur(16px);
  flex: 0 0 auto;
}

.topbar-left,
.topbar-center,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.topbar-center {
  flex-direction: column;
  justify-content: center;
}

.topbar-right {
  justify-content: flex-end;
}

.scores-toggle {
  display: none;
  width: 36px;
  height: 36px;
  padding: 0;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex-direction: column;
}

.scores-toggle-line {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
}

.heat-meta {
  display: grid;
  gap: 4px;
}

.heat-name {
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  font-weight: 700;
}

.paddler-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.16);
  padding: 10px 14px;
  border-radius: var(--radius);
}

.paddler-name {
  min-width: 160px;
  text-align: center;
  font-weight: 600;
  font-size: clamp(1.2rem, 2.8vw, 1.6rem);
  line-height: 1.2;
}

#prevPaddler,
#nextPaddler {
  min-width: 44px;
  min-height: 44px;
  font-size: 1.1rem;
  padding: 8px 12px;
}

.score-value {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: 1px;
}

.run-label {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.judge-label {
  font-weight: 600;
}

.status-bar {
  background: var(--status);
  border-bottom: 1px solid var(--border);
  padding: 6px 24px;
  min-height: var(--status-height);
  font-size: 0.95rem;
  flex: 0 0 auto;
}

.judge-main {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) clamp(220px, 25vw, 320px);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "bonus tricks scores";
  gap: 18px;
  padding: 18px 24px 28px;
  height: calc(100vh - var(--topbar-height) - var(--status-height));
  overflow: hidden;
  min-height: 0;
  flex: 1 1 auto;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
}

.side-panels {
  display: contents;
  min-width: 0;
}

.bonus-panel {
  grid-area: bonus;
  position: sticky;
  top: 0;
  align-self: flex-start;
  background: transparent;
  border-radius: 12px;
  padding: 12px 8px;
  border: none;
  box-shadow: none;
  max-height: calc(100vh - var(--topbar-height) - var(--status-height) - 28px);
  width: 96px;
  min-width: 0;
}

.bonus-buttons {
  display: grid;
  gap: 8px;
}

.bonus-buttons button.active {
  background: var(--accent);
  color: #ffffff;
}

.bonus-panel h3 {
  text-align: center;
  font-size: 0.85rem;
}

.bonus-buttons button {
  width: clamp(44px, 5vw, 64px);
  height: clamp(44px, 5vw, 64px);
  border-radius: 10px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.05;
  white-space: normal;
  word-break: break-word;
}

.tricks-panel,
.scores-panel {
  background: transparent;
  border-radius: var(--radius);
  padding: 16px;
  border: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  backdrop-filter: none;
  min-width: 0;
}

.tricks-panel {
  grid-area: tricks;
  overflow: hidden;
  height: 100%;
  min-height: 0;
}

.scores-panel {
  grid-area: scores;
  overflow: hidden;
  min-height: 0;
}

.scores-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(12, 27, 42, 0.4);
  z-index: 30;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.trick-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
  overflow-y: auto;
  padding-right: 6px;
  flex: 1;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  min-width: 0;
}

.trick-buttons button {
  padding: 8px 10px;
  line-height: 1.15;
  white-space: normal;
  word-break: break-word;
  text-align: center;
}

.trick-buttons button.selected {
  border-color: var(--accent);
}

.trick-buttons button.active {
  background: var(--accent);
  color: #ffffff;
}

.scores-list {
  overflow-y: auto;
  display: grid;
  gap: 10px;
  padding-right: 6px;
  flex: 1;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  min-width: 0;
}

.score-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(31, 111, 235, 0.08);
}

.score-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.score-delete {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  padding: 0;
  line-height: 1;
  border: 1px solid var(--border);
  background: #ffffff;
}

.score-delete:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(12, 27, 42, 0.55);
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-card {
  background: var(--card);
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  min-width: 280px;
  text-align: center;
  backdrop-filter: blur(16px);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  padding: 0;
  background: #ffffff;
  border: 1px solid var(--border);
  line-height: 1;
}

.modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.modal-actions button {
  font-size: 1.1rem;
  padding: 14px 16px;
}

.modal-actions button:active {
  transform: translateY(1px) scale(0.98);
}

.results-editor-card {
  width: min(640px, 92vw);
  text-align: left;
}

.editor-list {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.editor-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
}

.editor-row-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.editor-input {
  width: 100px;
  text-align: right;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

@media (max-width: 720px) {
  .modal-actions {
    grid-template-columns: 1fr;
  }

  .modal-actions button {
    width: 100%;
  }
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .content {
    padding: 20px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-header {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .header-actions {
    justify-content: center;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 481px) and (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
    text-align: center;
  }

  .topbar-left,
  .topbar-right {
    justify-content: center;
    flex-wrap: wrap;
  }

  .judge-main {
    grid-template-columns: 1fr;
    height: auto;
    padding: 14px 16px 18px;
  }

  .side-panels {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
  }

  .bonus-panel,
  .scores-panel {
    position: relative;
    top: auto;
    width: auto;
    padding: 12px;
  }

}

@media (max-width: 480px) {
  .judge-page {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 8px;
    text-align: center;
    padding: 10px 12px;
    min-height: unset;
  }

  .topbar-left,
  .topbar-right,
  .topbar-center {
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .heat-meta {
    width: 100%;
    text-align: center;
  }

  .heat-name {
    width: 100%;
  }

  .paddler-name {
    min-width: 0;
    max-width: 100%;
    font-size: 0.95rem;
  }

  .score-value {
    font-size: clamp(2rem, 9vw, 2.6rem);
  }

  .run-label {
    font-size: 0.8rem;
  }

  .status-bar {
    padding: 6px 12px;
  }

  .judge-main {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px 8px 12px;
    height: auto;
    overflow: visible;
  }

  .side-panels {
    display: block;
    width: 100%;
    max-width: 100%;
  }

  .bonus-panel,
  .scores-panel {
    position: relative;
    top: auto;
    width: 100%;
    max-width: 100%;
    padding: 8px;
  }

  .bonus-panel h3,
  .scores-panel h3,
  .tricks-panel h3 {
    font-size: 0.85rem;
    margin-bottom: 6px;
  }

  .bonus-buttons {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }

  .bonus-buttons button {
    width: 100%;
    min-height: 44px;
    border-radius: 4px;
    font-size: 0.8rem;
  }

  .tricks-panel {
    padding: 6px;
  }

  .trick-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding-right: 0;
  }

  .trick-buttons button {
    min-height: 44px;
    padding: 6px 4px;
    font-size: 0.85rem;
    border-radius: 4px;
  }

  .scores-list {
    padding-right: 0;
  }

  .scores-toggle {
    display: inline-flex;
  }

  .scores-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(84vw, 320px);
    max-width: 100%;
    background: #ffffff;
    border-left: 1px solid var(--border);
    box-shadow: -10px 0 24px rgba(12, 27, 42, 0.18);
    transform: translateX(100%);
    transition: transform 0.2s ease;
    z-index: 40;
    padding: 12px;
    pointer-events: none;
  }

  .scores-panel h3 {
    margin-bottom: 8px;
  }

  .scores-overlay {
    display: block;
  }

  body.scores-open .scores-panel {
    transform: translateX(0);
    pointer-events: auto;
  }

  body.scores-open .scores-overlay {
    opacity: 1;
    pointer-events: auto;
  }
}

/* Head portal stacked modules and drawer */
.brand,
.brand-title {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 100%;
  line-height: 1.1;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
}

.brand.brand-sm {
  font-size: clamp(1.4rem, 3.6vw, 2.2rem);
}

.sidebar {
  min-width: 0;
}

.admin-stack {
  display: grid;
  gap: 18px;
}

.module-card {
  background: #ffffff;
  border: 1px solid rgba(207, 217, 230, 0.9);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(12, 27, 42, 0.08);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.module-search input {
  background: #fbfbfd;
}

.module-status {
  font-size: 0.9rem;
  color: #4a5a73;
  min-height: 18px;
}

.module-status.status-error {
  color: #b42318;
}

.table-wrap {
  border: 1px solid rgba(207, 217, 230, 0.9);
  border-radius: 10px;
  overflow: hidden;
  background: #ffffff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table thead th {
  position: sticky;
  top: 0;
  background: #f5f7fb;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(207, 217, 230, 0.9);
  font-weight: 600;
  z-index: 1;
}

.data-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(231, 236, 244, 0.8);
}

.data-table tbody tr:hover {
  background: rgba(31, 111, 235, 0.05);
}

.breakdown {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  line-height: 1.2;
}

.breakdown-judge strong {
  font-weight: 600;
}

.event-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff4e6;
  border: 1px solid #ffd1a6;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(12, 27, 42, 0.08);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 27, 42, 0.35);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 30;
}

.drawer-backdrop.active {
  opacity: 1;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 92vw);
  height: 100vh;
  background: #ffffff;
  box-shadow: -20px 0 40px rgba(12, 27, 42, 0.18);
  transform: translateX(100%);
  transition: transform 0.2s ease, opacity 0.2s ease;
  opacity: 0;
  z-index: 40;
  display: grid;
  grid-template-rows: auto 1fr;
}

.drawer.open {
  transform: translateX(0);
  opacity: 1;
}

.drawer-backdrop[hidden] {
  display: none;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid rgba(207, 217, 230, 0.9);
}

.drawer-body {
  padding: 16px;
  overflow-y: auto;
}

.drawer-form {
  display: grid;
  gap: 12px;
}

.drawer-open {
  overflow: hidden;
}

@media (max-width: 960px) {
  .module-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
