* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --orange-primary: #e65100;
  --orange-light: #ff9800;
  --purple-primary: #9c27b0;
  --purple-light: #ba68c8;
  --gradient: linear-gradient(135deg, #ff6d00 0%, #ff9800 50%, #ab47bc 100%);
  --bg-light: #ffffff;
  --bg-gray: #f5f5f7;
  --bg-card: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-gray);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}

header {
  text-align: center;
  padding: 24px 0 32px;
  margin-bottom: 32px;
}

.logo {
  max-width: 260px;
  width: 100%;
  height: auto;
  margin-bottom: 12px;
}

header h1 {
  font-size: 1.8rem;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 6px;
}

header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

h2 {
  margin-bottom: 20px;
  color: var(--text-primary);
  font-size: 1.3rem;
  font-weight: 600;
}

h3 {
  margin-bottom: 12px;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
}

h4 {
  margin-bottom: 10px;
  color: #555;
  font-size: 1rem;
  font-weight: 600;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.form-row {
  display: flex;
  gap: 15px;
}

.form-grow {
    flex: 1;
}

.event-details {
    margin-top: 8px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-light);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--orange-primary);
  box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.1);
}

.form-group small {
  display: inline-block;
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.choice-fields {
  margin-top: 8px;
  border-top: 1px solid #eee;
  padding-top: 16px;
}

.choice-fields p {
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.btn {
  display: inline-block;
  padding: 14px 32px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  text-align: center;
}

.btn-primary {
  background: var(--gradient);
  color: #fff;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(230, 81, 0, 0.3);
}

.btn-primary:disabled {
  background: #ccc;
  color: #888;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 1;
}

.btn-secondary {
  background: var(--bg-gray);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: #eee;
}

.btn-danger {
  background: #e53935;
  color: #fff;
}

.btn-danger:hover {
  background: #c62828;
}

.btn-sm {
  padding: 10px 18px;
  font-size: 0.85rem;
}

.btn-quiet {
  padding: 6px 12px;
  font-size: 0.75rem;
  opacity: 0.85;
}

.btn-quiet:hover {
  transform: none;
  box-shadow: none;
  opacity: 1;
}

.form-submit {
  width: 100%;
}

.card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.event-info-box {
  margin-bottom: 20px;
  padding: 15px;
  background: #f5f5f7;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.session-info-block {
  margin: 6px 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #f1e2b8;
  background: #fff8e8;
}

.session-info-block p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.session-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.session-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #efd8a2;
  border-radius: 8px;
  background: #fffef8;
}

.session-item-main {
  min-width: 0;
}

.session-item-title {
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-item-meta {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.session-item.active {
  border-color: #ffb74d;
  background: #fff8ea;
}

.session-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.session-actions.dual-actions {
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.session-actions.dual-actions .btn {
  flex: 1 1 170px;
}

.timer-display {
  text-align: center;
  padding: 40px 20px;
}

.timer-time {
  font-size: 4.5rem;
  font-family: "Courier New", monospace;
  font-weight: bold;
  color: var(--orange-primary);
  margin-bottom: 8px;
  line-height: 1.05;
}

.event-page .timer-time {
  font-size: clamp(1.5rem, 8.5vw, 4.5rem);
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.status-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.timer-status,
.timer-display .status-badge {
  font-size: 0.95rem;
  margin-top: 20px;
  padding: 8px 20px;
  border-radius: 20px;
  letter-spacing: 1px;
}

.timer-meta {
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.status-created,
.status-badge.waiting {
  background: #f5f5f5;
  color: #888;
  border: 1px solid #ddd;
}

.status-badge.countdown {
  background: #fff3e0;
  color: var(--orange-primary);
  border: 1px solid #ffe0b2;
}

.status-running,
.status-badge.running {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.status-paused,
.status-badge.paused {
  background: #fff3e0;
  color: var(--orange-primary);
  border: 1px solid #ffe0b2;
}

.status-ended,
.status-badge.ended {
  background: #f3e5f5;
  color: #7b1fa2;
  border: 1px solid #e1bee7;
}

.finish-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  padding: 0;
  line-height: 1;
  font-size: 1.3rem;
  font-weight: bold;
  margin-top: 30px;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.finish-btn:not(:disabled):hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(230, 81, 0, 0.35);
}
.leaderboard {
  margin-top: 20px;
}

.table-wrap {
  overflow-x: auto;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.leaderboard-table th {
  background: var(--bg-gray);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.leaderboard-table tbody tr:hover {
  background: #fafafa;
}

.empty-results {
  color: #888;
  text-align: center;
}

.leaderboard .leaderboard-table th:nth-child(1) {
  width: 72px;
}

.leaderboard .leaderboard-table th:nth-child(3) {
  width: 180px;
}

.leaderboard .leaderboard-table th:nth-child(4) {
  width: 130px;
}

.leaderboard-name {
  font-weight: 500;
  color: var(--text-primary);
}

.leaderboard-finish-time {
  white-space: nowrap;
  color: #1f7a36;
  font-size: 1.05rem;
}
.leaderboard-table .status-badge {
  margin-top: 0;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  letter-spacing: 0.3px;
}

.badge-verified {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.badge-pending {
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffe0b2;
}

.badge-active {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #bbdefb;
}

.badge-dnf {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ffcdd2;
}

.mono {
  font-family: "Courier New", monospace;
}

.own-row {
  background: #fff8e1;
  border-left: 3px solid var(--orange-light);
}

.event-card {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 12px;
  padding: 18px;
  background: var(--bg-light);
  transition: all 0.2s;
}

.event-card:hover {
  border-color: var(--orange-light);
  box-shadow: var(--shadow-hover);
}

.event-card h3 {
  margin-bottom: 4px;
  font-size: 1.05rem;
  font-weight: 600;
}

.event-meta {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.event-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.event-duration-editor {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #ececec;
}

.event-duration-editor label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
}

.event-duration-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.event-duration-controls input {
  width: 140px;
}

.event-actions .btn {
  padding: 10px 16px;
  font-size: 0.85rem;
}

.participants-head h2 {
  margin-bottom: 0;
}

.subtle-box {
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-weight: 500;
  background: #fff3e0;
  border: 1px solid #ffe0b2;
  color: var(--orange-primary);
}

.msg {
  min-height: 22px;
}

.msg:not(:empty) {
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-weight: 500;
}

.msg-success {
  background: #e8f5e9;
  border: 1px solid #c8e6c9;
  color: #2e7d32;
}

.msg-error {
  background: #ffebee;
  border: 1px solid #ffcdd2;
  color: #c62828;
}

.msg-info {
  background: #fff3e0;
  border: 1px solid #ffe0b2;
  color: var(--orange-primary);
}

.message {
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-weight: 500;
}

.message-success {
  background: #e8f5e9;
  border: 1px solid #c8e6c9;
  color: #2e7d32;
}

.message-error {
  background: #ffebee;
  border: 1px solid #ffcdd2;
  color: #c62828;
}

.message-info {
  background: #fff3e0;
  border: 1px solid #ffe0b2;
  color: var(--orange-primary);
}

.login-container {
  max-width: 400px;
  margin: 60px auto;
}

.logo-wrap {
  text-align: center;
  margin-bottom: 20px;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
  background: var(--bg-light);
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}

.tab,
.tab-btn {
  padding: 14px 28px;
  cursor: pointer;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  transition: all 0.2s;
  font-weight: 500;
  background: transparent;
  font-size: 1rem;
}

.tab:hover,
.tab-btn:hover {
  color: var(--text-primary);
  background: #fafafa;
}

.tab.active,
.tab-btn.active {
  color: var(--orange-primary);
  border-bottom-color: var(--orange-primary);
  background: var(--bg-light);
}

.tab-content {
  display: block;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: all 0.2s;
  padding: 20px;
}

.modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-overlay:not(.hidden),
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.modal h3 {
  margin-bottom: 12px;
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 600;
}

.modal p {
  margin-bottom: 24px;
  color: var(--text-secondary);
}

.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.box-choice-options,
.choice-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.box-choice-options .btn,
.choice-grid .btn {
  width: 100%;
}

.countdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.countdown-number {
  font-size: 12rem;
  font-weight: bold;
  color: #fff;
  animation: pulse 1s ease-in-out;
  text-shadow: 0 0 60px rgba(255, 152, 0, 0.8);
}

@keyframes pulse {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.centered-actions {
  text-align: center;
  margin-top: 20px;
}

.hidden {
  display: none !important;
}

@media (max-width: 768px) {
  .container {
    padding: 16px;
  }

  header {
    padding: 16px 0 24px;
  }

  .event-page header {
    padding: 8px 0 16px;
    margin-bottom: 18px;
  }

  .logo {
    max-width: 200px;
  }

  .event-page .logo {
    max-width: 140px;
    margin-bottom: 8px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .event-page header h1 {
    font-size: 1.2rem;
    line-height: 1.2;
    margin-bottom: 4px;
  }

  .event-page header p {
    font-size: 0.9rem;
  }

  .card {
    padding: 20px;
    border-radius: 12px;
  }

  .event-page .timer-display {
    padding: 28px 12px;
  }

  .timer-time {
    font-size: 3rem;
  }

  .finish-btn {
    width: 140px;
    height: 140px;
    font-size: 1.1rem;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .session-actions.dual-actions .btn {
    flex-basis: 100%;
  }

  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0;
  }

  .tab,
  .tab-btn {
    padding: 12px 20px;
    white-space: nowrap;
  }

  .modal {
    padding: 24px;
    margin: 16px;
  }

  .modal-buttons {
    flex-direction: column;
  }

  .modal-buttons .btn {
    width: 100%;
  }

  .leaderboard-table th,
  .leaderboard-table td {
    padding: 10px 8px;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .event-page header {
    padding: 6px 0 14px;
    margin-bottom: 14px;
  }

  .event-page .logo {
    max-width: 120px;
  }

  .event-page header h1 {
    font-size: 1.05rem;
  }

  .event-page header p {
    font-size: 0.85rem;
  }

  .event-page .timer-display {
    padding: 24px 8px;
  }

  .timer-time {
    font-size: 2.4rem;
  }

  .finish-btn {
    width: 120px;
    height: 120px;
    font-size: 1rem;
  }

  .btn {
    padding: 12px 24px;
  }

  .form-group input,
  .form-group select {
    padding: 12px 14px;
  }
}

.language-switch {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text-secondary);
  box-shadow: var(--shadow);
}

.language-switch button {
  padding: 2px 4px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.language-switch button[aria-pressed="true"] {
  color: var(--orange-primary);
}

.language-switch button:focus-visible {
  outline: 2px solid var(--purple-primary);
  outline-offset: 2px;
}

/* Editorial Event */
:root {
  --gradient: linear-gradient(135deg, #ff6d00 0%, #ff9800 48%, #ab47bc 100%);
  --bg-gray: #f4f3f6;
  --bg-card: rgba(255, 255, 255, 0.92);
  --text-primary: #17151b;
  --text-secondary: #625d68;
  --text-muted: #8f8995;
  --border-color: rgba(45, 35, 52, 0.12);
  --shadow: 0 18px 50px rgba(48, 35, 55, 0.08);
  --shadow-hover: 0 24px 60px rgba(48, 35, 55, 0.13);
  --radius-lg: 24px;
  --radius-md: 16px;
  --focus-ring: 0 0 0 4px rgba(230, 81, 0, 0.14);
}

html {
  background: var(--bg-gray);
}

body {
  overflow-x: hidden;
  font-family: "Cabinet Grotesk", Aptos, "Segoe UI Variable", "Segoe UI", sans-serif;
  letter-spacing: -0.01em;
  background:
    radial-gradient(circle at 8% -5%, rgba(255, 109, 0, 0.13), transparent 31rem),
    radial-gradient(circle at 94% 6%, rgba(171, 71, 188, 0.11), transparent 34rem),
    linear-gradient(180deg, #fbfafc 0%, var(--bg-gray) 56%, #f0edf2 100%);
}

.container {
  width: 100%;
  max-width: 1120px;
  padding: clamp(18px, 3vw, 36px);
}

header {
  position: relative;
  margin-bottom: 24px;
  padding: 12px 0 26px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  max-width: 190px;
  margin-bottom: 18px;
}

header h1 {
  max-width: 24ch;
  margin-bottom: 6px;
  font-size: clamp(1.65rem, 3vw, 2.6rem);
  font-weight: 750;
  line-height: 1.04;
  letter-spacing: -0.045em;
}

header p {
  max-width: 62ch;
  color: var(--text-secondary);
}

h2 {
  margin-bottom: 24px;
  font-size: clamp(1.35rem, 2vw, 1.7rem);
  font-weight: 720;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

h3 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.card {
  padding: clamp(24px, 4vw, 36px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  animation: editorial-in 0.5s ease both;
}

.form-group {
  margin-bottom: 22px;
}

.form-group label {
  margin-bottom: 9px;
  color: var(--text-primary);
  font-size: 0.83rem;
  font-weight: 700;
  letter-spacing: 0.025em;
}

.form-group input,
.form-group select,
.event-duration-controls input {
  min-height: 52px;
  padding: 13px 16px;
  border-color: var(--border-color);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.form-group input:hover,
.form-group select:hover,
.event-duration-controls input:hover {
  border-color: rgba(230, 81, 0, 0.34);
}

.form-group input:focus,
.form-group select:focus,
.event-duration-controls input:focus {
  border-color: var(--orange-primary);
  background: #fff;
  box-shadow: var(--focus-ring);
}

.form-group small {
  margin-top: 8px;
  color: var(--text-muted);
  line-height: 1.4;
}

.btn {
  min-height: 48px;
  padding: 13px 24px;
  border-radius: 14px;
  font-weight: 720;
  letter-spacing: -0.01em;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
  background: var(--gradient);
  box-shadow: 0 12px 28px rgba(230, 81, 0, 0.2);
}

.btn-primary:hover {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(190, 58, 38, 0.27);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  border-color: var(--border-color);
  background: rgba(255, 255, 255, 0.7);
}

.btn-secondary:hover {
  border-color: rgba(45, 35, 52, 0.22);
  background: #fff;
}

.btn-sm {
  min-height: 44px;
  padding: 10px 18px;
}

.btn-quiet {
  min-height: 40px;
}

.event-info-box,
.session-info-block,
.subtle-box {
  border-radius: var(--radius-md);
}

.event-info-box {
  padding: 18px;
  border-color: rgba(230, 81, 0, 0.16);
  background: linear-gradient(135deg, rgba(255, 243, 224, 0.82), rgba(243, 229, 245, 0.66));
}

.session-info-block {
  padding: 16px;
  border-color: rgba(230, 81, 0, 0.18);
  background: rgba(255, 248, 232, 0.76);
}

.session-item {
  min-height: 58px;
  padding: 10px 12px;
  border-color: var(--border-color);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
}

.session-item.active {
  border-color: rgba(255, 109, 0, 0.48);
  background: rgba(255, 248, 234, 0.9);
  box-shadow: inset 3px 0 var(--orange-light);
}

.msg:not(:empty),
.message {
  border-radius: 14px;
  font-size: 0.92rem;
}

.msg-info,
.message-info {
  border-color: rgba(230, 81, 0, 0.18);
  background: rgba(255, 243, 224, 0.84);
}

.msg-error,
.message-error {
  border-color: rgba(198, 40, 40, 0.18);
  background: rgba(255, 235, 238, 0.9);
}

.msg-success,
.message-success {
  border-color: rgba(46, 125, 50, 0.18);
  background: rgba(232, 245, 233, 0.9);
}

.table-wrap {
  margin: 0 -8px;
  padding: 0 8px;
  border-radius: 12px;
  scrollbar-width: thin;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 16px 14px;
  border-bottom-color: rgba(45, 35, 52, 0.09);
}

.leaderboard-table th {
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.leaderboard-table tbody tr {
  transition: background 0.18s ease;
}

.leaderboard-table tbody tr:hover {
  background: rgba(255, 109, 0, 0.035);
}

.own-row {
  border-left: 3px solid var(--orange-light);
  background: linear-gradient(90deg, rgba(255, 152, 0, 0.1), rgba(171, 71, 188, 0.035));
}

.event-card {
  padding: 20px;
  border-color: var(--border-color);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
}

.event-card:hover {
  transform: translateY(-2px);
}

.event-actions .btn {
  min-height: 44px;
}

.tabs {
  position: sticky;
  top: 16px;
  z-index: 10;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 30px rgba(48, 35, 55, 0.07);
  backdrop-filter: blur(18px);
}

.tab,
.tab-btn {
  min-height: 44px;
  padding: 11px 22px;
  border: 0;
  border-radius: 11px;
}

.tab:hover,
.tab-btn:hover {
  border: 0;
  background: rgba(45, 35, 52, 0.045);
}

.tab.active,
.tab-btn.active {
  border: 0;
  color: #fff;
  background: var(--gradient);
  box-shadow: 0 8px 22px rgba(230, 81, 0, 0.2);
}

.modal-overlay {
  background: rgba(23, 21, 27, 0.58);
  backdrop-filter: blur(12px);
}

.modal {
  max-width: 460px;
  padding: clamp(26px, 5vw, 40px);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: var(--radius-lg);
  box-shadow: 0 32px 90px rgba(23, 21, 27, 0.25);
}

.language-switch {
  top: 18px;
  right: 22px;
  min-height: 44px;
  padding: 5px 10px;
  border-color: rgba(45, 35, 52, 0.1);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 30px rgba(48, 35, 55, 0.09);
  backdrop-filter: blur(16px);
}

.language-switch button {
  min-width: 30px;
  min-height: 32px;
}

:where(a, button, input, select):focus-visible {
  outline: 3px solid var(--purple-primary);
  outline-offset: 3px;
}

.form-group input:focus-visible,
.form-group select:focus-visible,
.btn:focus-visible,
.tab-btn:focus-visible,
.language-switch button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--purple-primary);
  outline-offset: 3px;
}

body[data-page="index"] .container {
  max-width: 760px;
}

body[data-page="index"] header {
  margin-bottom: 18px;
  padding-top: 16px;
  text-align: center;
  border-bottom: 0;
}

body[data-page="index"] header .logo {
  max-width: 240px;
  margin-bottom: 14px;
}

body[data-page="index"] header p {
  margin: 0 auto;
}

body[data-page="index"] #joinCard {
  padding: clamp(26px, 5vw, 44px);
}

body[data-page="index"] #joinMessage:not(:empty) {
  max-width: 680px;
  margin: 0 auto 24px;
  padding: 22px;
  text-align: center;
  box-shadow: var(--shadow);
}

.event-page .container {
  max-width: 1180px;
}

.event-page header {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 28px;
  align-items: end;
}

.event-page header .logo {
  grid-row: 1 / -1;
  align-self: center;
  max-width: 150px;
  margin: 0;
}

.event-page header h1 {
  max-width: 100%;
}

.event-page #timerSection {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-flow: dense;
  padding: 0;
  overflow: hidden;
}

.event-page .timer-display {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(180px, 4fr);
  grid-template-areas:
    "time action"
    "status action"
    "meta action";
  gap: 14px 34px;
  align-items: center;
  padding: clamp(34px, 6vw, 68px);
  text-align: left;
}

.event-page .timer-time {
  grid-area: time;
  margin: 0;
  font-size: clamp(3.6rem, 9.4vw, 7.4rem);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.075em;
  color: var(--text-primary);
}

.event-page .timer-display .status-badge {
  grid-area: status;
  justify-self: start;
  margin: 0;
}

.event-page .timer-meta {
  grid-area: meta;
  margin: 0;
}

.event-page .finish-btn {
  grid-area: action;
  justify-self: end;
  width: clamp(140px, 15vw, 176px);
  height: clamp(140px, 15vw, 176px);
  margin: 0;
  border: 6px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  box-shadow: 0 18px 48px rgba(190, 58, 38, 0.26);
}

.event-page .finish-btn:disabled {
  border-color: rgba(255, 255, 255, 0.48);
  box-shadow: none;
}
.event-page .leaderboard {
  margin-top: 0;
}

.event-page .centered-actions {
  margin: 28px 0 8px;
}

body[data-page="admin"] .container {
  max-width: 1240px;
}

body[data-page="admin"] .login-container {
  max-width: 460px;
  margin: clamp(36px, 8vh, 84px) auto;
}

body[data-page="admin"] .login-container .logo-wrap {
  margin-bottom: 26px;
}

body[data-page="admin"] .login-container .logo {
  max-width: 230px;
  margin-bottom: 0;
}

body[data-page="admin"] #dashboardView header {
  padding-right: 150px;
}

body[data-page="admin"] #logoutBtn {
  position: absolute;
  top: 18px;
  right: 0;
}

body[data-page="admin"] .form-row {
  flex-wrap: wrap;
}

body[data-page="admin"] .form-grow {
  min-width: 220px;
}

.contest-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  align-items: end;
}

.contest-type-grid .checkbox-control {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
}

.contest-type-grid .checkbox-control input {
  width: auto;
}

.generated-preview {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid var(--line, #d8d0c4);
  border-radius: 12px;
  background: var(--surface-soft, #f8f5ef);
  overflow-wrap: anywhere;
}

.contest-types-list {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.contest-type-item {
  display: grid;
  gap: 9px;
  padding: 18px;
  border: 1px solid var(--line, #d8d0c4);
  border-radius: 14px;
  background: var(--surface, #fffdf9);
}

.contest-type-id {
  color: var(--muted, #6d655a);
  overflow-wrap: anywhere;
}

.lock-reason {
  margin: 0;
  color: var(--muted, #6d655a);
}

.lock-reason ul {
  margin: 7px 0 0;
  padding-left: 22px;
}

@media (max-width: 480px) {
  .contest-type-grid {
    grid-template-columns: 1fr;
  }
}
@keyframes editorial-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 18px;
  }

  header {
    padding-top: 8px;
  }

  .card {
    border-radius: 20px;
  }

  .language-switch {
    top: 10px;
    right: 10px;
  }

  .event-page header {
    grid-template-columns: 112px minmax(0, 1fr);
    column-gap: 18px;
  }

  .event-page header .logo {
    max-width: 108px;
  }

  .event-page .timer-display {
    grid-template-columns: 1fr;
    grid-template-areas:
      "time"
      "status"
      "meta"
      "action";
    justify-items: center;
    padding: 36px 22px;
    text-align: center;
  }

  .event-page .timer-time {
    font-size: clamp(3rem, 16vw, 5.4rem);
  }

  .event-page .timer-display .status-badge,
  .event-page .finish-btn {
    justify-self: center;
  }

  .event-page .finish-btn {
    width: 138px;
    height: 138px;
    margin-top: 18px;
  }
  body[data-page="admin"] #dashboardView header {
    padding-right: 0;
  }

  body[data-page="admin"] #logoutBtn {
    position: static;
    margin-top: 18px;
  }

  .tabs {
    top: 8px;
    border-radius: 14px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 14px;
  }

  .card {
    padding: 22px 20px;
  }

  body[data-page="index"] header .logo {
    max-width: 190px;
  }

  .event-page header {
    display: block;
    padding-top: 48px;
    text-align: center;
  }

  .event-page header .logo {
    max-width: 122px;
    margin-bottom: 12px;
  }

  .event-page header h1,
  .event-page header p {
    margin-right: auto;
    margin-left: auto;
  }

  .event-page .timer-display {
    padding: 32px 16px;
  }

  .event-page .timer-time {
    font-size: clamp(2.65rem, 15vw, 4rem);
  }

  .event-page .finish-btn {
    width: 124px;
    height: 124px;
  }

  .tab,
  .tab-btn {
    padding: 10px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


.event-definition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  align-items: end;
}

.events-module #eventDefinitionForm {
  display: grid;
  gap: 18px;
}

.events-list {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.event-management-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line, #d8d0c4);
  border-radius: 14px;
  background: var(--surface, #fffdf9);
}

.event-management-card h3 {
  margin: 0;
}

.event-details {
  display: grid;
  grid-template-columns: minmax(130px, max-content) 1fr;
  gap: 6px 14px;
  margin: 0;
}

.event-details dt {
  color: var(--muted, #6d655a);
  font-weight: 600;
}

.event-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.event-actions {
  flex-wrap: wrap;
}

.puzzle-drafts {
  display: grid;
  gap: 16px;
}

.puzzle-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line, #d8d0c4);
  border-radius: 12px;
  background: var(--surface-soft, #f8f5ef);
}

.puzzle-card h3 {
  margin: 0;
}

.puzzle-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.puzzle-preview {
  display: block;
  width: min(240px, 100%);
  max-height: 160px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--surface, #fffdf9);
}

.puzzle-file-input {
  max-width: 100%;
}

@media (max-width: 700px) {
  .puzzle-fields {
    grid-template-columns: 1fr;
  }

  .event-details {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .event-details dd {
    margin-bottom: 8px;
  }
}

.results-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.results-toolbar .form-group {
  min-width: min(320px, 100%);
  margin: 0;
}

.results-toolbar .form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.results-module a.disabled {
  pointer-events: none;
  opacity: 0.55;
}

#resultsMessage {
  margin-top: 14px;
}

.results-table {
  width: 100%;
  margin-top: 18px;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.results-table th,
.results-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line, #d8d0c4);
  text-align: left;
  vertical-align: top;
}

.results-table th {
  color: var(--muted, #6d655a);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.result-details {
  min-width: 220px;
  margin: 0;
  padding-left: 20px;
}

.result-details li + li {
  margin-top: 5px;
}

.result-remaining {
  color: var(--muted, #6d655a);
}

.result-status,
.verification-state {
  display: inline-flex;
  align-items: center;
  min-height: 1.7em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-soft, #f8f5ef);
  color: var(--ink, #2c2823);
  white-space: nowrap;
}

.verification-state {
  border: 1px solid var(--line, #d8d0c4);
}

@media (max-width: 700px) {
  .results-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .results-table th,
  .results-table td {
    min-width: 120px;
  }

  .result-details {
    white-space: normal;
  }
}
.registration-event-details {
  display: grid;
  gap: 4px;
}

#teamNameGroup,
#eventPasswordGroup {
  margin-bottom: 18px;
}

.registration-member-row {
  align-items: flex-start;
  margin-bottom: 4px;
}

.registration-member-row .form-group {
  margin-bottom: 14px;
}

.field-requirement {
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 400;
  white-space: nowrap;
}

.field-requirement.required {
  color: var(--orange-primary);
}

#teamMembersFields.hidden,
#teamNameGroup.hidden,
#eventPasswordGroup.hidden {
  display: none;
}

@media (max-width: 700px) {
  .registration-member-row {
    gap: 0;
  }

  .field-requirement {
    display: inline-block;
  }
}

/* Participant result flow */
.puzzles-container,
.result-segments {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border, #d9dee8);
    padding-top: 1rem;
}

.puzzle-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.puzzle-card {
    display: grid;
    gap: 0.4rem;
    min-width: 0;
    padding: 0.85rem;
    border: 1px solid var(--border, #d9dee8);
    border-radius: 0.6rem;
    background: var(--surface-muted, #f7f8fb);
}

.puzzle-card h4,
.puzzle-card p {
    margin: 0;
}

.puzzle-card img {
    width: 100%;
    max-height: 180px;
    object-fit: contain;
    border-radius: 0.4rem;
}

.puzzle-piece-count,
.result-segment-value {
    color: var(--muted, #5e6878);
    font-size: 0.9rem;
}

#resultSegmentsList {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.result-segment {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.4rem;
    background: var(--surface-muted, #f7f8fb);
}

.result-segment.dnf-segment {
    border-left: 3px solid var(--danger, #b42318);
}

@media (max-width: 480px) {
    .puzzle-cards {
        grid-template-columns: 1fr;
    }

    .result-segment {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.25rem;
    }
}