* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f2f4f8;
  color: #1a1f2d;
}

.hero {
  background: linear-gradient(90deg, #17a2dc, #0f88c3);
  color: #fff;
}

.hero-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 20px;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hero-brand {
  min-width: 0;
}

.hero-brand .hero-tagline {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.hero-title-link {
  color: inherit;
  text-decoration: none;
  display: block;
  position: relative;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
}

.hero-title-link:hover h1 {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hero-title-link h1 {
  margin: 0;
}

.menu-open-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
}

.menu-open-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

.menu-open-btn-icon {
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
}

.menu-open-btn-icon .menu-open-icon {
  font-size: 20px;
  line-height: 1;
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(16, 24, 40, 0.42);
}

body.menu-open {
  overflow: hidden;
}

.side-menu {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 201;
  width: min(320px, 88vw);
  height: 100%;
  background: #fff;
  box-shadow: -8px 0 24px rgba(16, 24, 40, 0.14);
  transform: translateX(100%);
  transition: transform 0.24s ease;
  display: flex;
  flex-direction: column;
}

.side-menu.is-open {
  transform: translateX(0);
}

.side-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #e4e9f2;
  font-size: 15px;
}

.menu-close-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: #eef2f8;
  color: #3a4255;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.menu-close-btn:hover {
  background: #dfe6f2;
}

.side-menu-body {
  flex: 1;
  padding: 12px 0 18px;
  overflow-y: auto;
}

.side-menu-foot {
  flex-shrink: 0;
  padding: 14px 18px 18px;
  border-top: 1px solid #e4e9f2;
}

.side-menu-foot-link {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #24304a;
  text-decoration: none;
}

.side-menu-foot-link:hover {
  color: #2968ff;
  text-decoration: underline;
}

.menu-status {
  margin: 0;
  padding: 0 18px;
  color: #687089;
  font-size: 13px;
}

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

.side-menu-event-list {
  display: grid;
}

.side-menu-archive-link {
  display: block;
  margin-top: 8px;
  padding: 14px 18px;
  border-top: 1px solid #eef2f8;
  font-size: 13px;
  font-weight: 700;
  color: #5d6475;
  text-decoration: none;
}

.side-menu-archive-link:hover {
  background: #f6f8fc;
  color: #24304a;
}

.side-menu-event {
  display: grid;
  gap: 4px;
  padding: 14px 18px;
  border-bottom: 1px solid #eef2f8;
  color: inherit;
  text-decoration: none;
}

.side-menu-event:hover {
  background: #f6f8fc;
}

.side-menu-event.is-current {
  background: #eef4ff;
  border-left: 3px solid #2968ff;
  padding-left: 15px;
}

.side-menu-event-name {
  font-size: 15px;
  font-weight: 600;
  color: #1a1f2d;
}

.side-menu-event-meta {
  font-size: 12px;
  color: #687089;
}

.side-menu-event-badge {
  display: inline-block;
  width: fit-content;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.side-menu-event-badge-live {
  background: #e8f2ff;
  color: #1f57da;
}

.side-menu-event-badge-idle {
  background: #fde8e8;
  color: #b91c1c;
}

.side-menu-event-badge-provisional {
  background: #e6f7f5;
  color: #0f766e;
}

.side-menu-event-badge-mixed {
  background: #fff2df;
  color: #9a5b00;
}

.side-menu-event-badge-final {
  background: #fde8ea;
  color: #b42318;
}

.side-menu-event-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.side-menu-event-link {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 8px;
  background: #eef2f8;
  color: #24304a;
  text-decoration: none;
}

.side-menu-event-link.is-active,
.side-menu-event-link:hover {
  background: #2968ff;
  color: #fff;
}

.final-event-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.final-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.final-mode-note {
  margin: 0 0 12px;
  font-size: 13px;
  color: #5a6a85;
  line-height: 1.45;
}

.final-class-links {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #dbe2ef;
  border-radius: 10px;
  background: #f8fafd;
}

.final-class-links-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.final-class-links-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.final-class-link-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.final-class-link-name {
  min-width: 3.5em;
  font-weight: 700;
  color: #1f2733;
}

.final-class-links-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: #5a6a85;
  line-height: 1.45;
}

.home-btn-small {
  padding: 6px 12px;
  font-size: 13px;
}

.mfj-embed-frame {
  display: block;
  width: 100%;
  min-height: 80vh;
  border: 1px solid #dbe2ef;
  border-radius: 10px;
  background: #c8c8c4;
}

button.home-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
}

.live-resume-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.38);
}

.live-resume-overlay[hidden] {
  display: none !important;
}

.live-resume-button {
  padding: 14px 22px;
  border: none;
  border-radius: 999px;
  background: #1f9d55;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(31, 157, 85, 0.35);
  cursor: pointer;
}

.live-resume-button:disabled {
  opacity: 0.7;
  cursor: default;
}

.back-to-top {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 120;
  padding: 12px 16px;
  border: none;
  border-radius: 999px;
  background: #2968ff;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(41, 104, 255, 0.35);
  cursor: pointer;
}

.back-to-top:hover {
  background: #1f57da;
}

.hero h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.6px;
}

.hero p {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 20px 22px;
}

.live-content-column {
  width: 100%;
  min-width: 0;
}

.event-head h2 {
  margin: 0;
  font-size: 25px;
}

.event-head-lead {
  margin: 8px 0 0;
  color: #5d6475;
  font-size: 14px;
}

.home-link-btn {
  text-decoration: none;
}

.notice-banner {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff7e8;
  border: 1px solid #f0d7a6;
  color: #5a4a2d;
}

.notice-banner p {
  margin: 8px 0 0;
}

.notice-banner-share {
  background: #fff1f0;
  border-color: #f0b4ae;
  color: #7a2e28;
}

.notice-banner-share strong {
  display: block;
  font-size: 15px;
}

.notice-banner-ops {
  background: #eef4ff;
  border-color: #b7c9ef;
  color: #243a66;
}

.notice-banner-ops strong {
  display: block;
  font-size: 15px;
}

.notice-banner-ops a {
  color: #1f57da;
  font-weight: 600;
}

.contact-page {
  max-width: 36rem;
}

.contact-page .field {
  display: block;
  margin: 0 0 14px;
}

.contact-page .field span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #334;
}

.contact-page input,
.contact-page textarea,
.contact-page select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #c9d0dc;
  border-radius: 10px;
  font: inherit;
}

.contact-page textarea {
  min-height: 140px;
  resize: vertical;
}

.contact-page .contact-actions {
  margin-top: 8px;
}

.contact-page .contact-mail {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e2e6ee;
}

.contact-honeypot {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact-attachments input[type="file"] {
  padding: 8px 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.contact-attach-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: #667;
  line-height: 1.45;
}

.contact-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.contact-preview-item {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #c9d0dc;
  background: #f4f6fa;
}

.contact-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.contact-preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.home-list,
.home-card-list {
  display: grid;
  gap: 12px;
}

.home-group-title {
  margin: 18px 0 10px;
  font-size: 15px;
  color: #5d6475;
}

.home-group-archive {
  margin-top: 28px;
  padding-top: 8px;
  border-top: 1px solid #e8edf5;
}

.home-archive-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px;
  color: inherit;
  text-decoration: none;
}

.home-archive-link:hover .home-archive-link-title {
  color: #1f57da;
}

.home-archive-link-title {
  font-size: 15px;
  font-weight: 700;
  color: #5d6475;
}

.home-archive-link-meta {
  font-size: 13px;
  color: #7a8294;
}

.home-archive-back {
  margin: 0 0 8px;
  font-size: 13px;
}

.home-archive-back a {
  color: #5d6475;
  text-decoration: none;
}

.home-archive-back a:hover {
  color: #1f57da;
}

.home-card-archive {
  background: #f8f9fc;
}

.home-badge-archive {
  background: #eef1f6;
  color: #5d6475;
}

.home-card {
  background: #fff;
  border: 1px solid #dbe2ef;
  border-radius: 14px;
  padding: 16px;
}

.home-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.home-card-title {
  margin: 0;
  font-size: 20px;
}

.home-badge {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.home-badge-live {
  background: #e8f2ff;
  color: #1f57da;
}

.home-badge-idle {
  background: #fde8e8;
  color: #b91c1c;
}

.home-badge-provisional {
  background: #e6f7f5;
  color: #0f766e;
}

.home-badge-mixed {
  background: #fff2df;
  color: #9a5b00;
}

.home-badge-final {
  background: #fde8ea;
  color: #b42318;
}

.home-card-date {
  margin: 8px 0 0;
  color: #5d6475;
  font-size: 14px;
}

.home-card-note {
  margin: 10px 0 0;
  color: #687089;
  font-size: 13px;
}

.home-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.home-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.home-card-link:hover .home-card-cta {
  color: #2968ff;
}

.home-card-cta {
  margin: 12px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: #3a4d73;
}

.event-route-list {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.event-route-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 16px;
  border-radius: 14px;
  border: 1px solid #dbe2ef;
  background: #fff;
  text-decoration: none;
  color: inherit;
}

.event-route-card strong {
  font-size: 17px;
}

.event-route-card span {
  font-size: 13px;
  color: #5a6a85;
  line-height: 1.4;
}

.event-route-card:hover {
  border-color: #2968ff;
  box-shadow: 0 8px 20px rgba(41, 104, 255, 0.12);
}

.event-route-live {
  border-left: 4px solid #2968ff;
}

.event-route-final {
  border-left: 4px solid #1f9d55;
}

.home-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.home-btn-primary {
  background: #2968ff;
  color: #fff;
}

.home-btn-secondary {
  background: #eef2f8;
  color: #24304a;
}

.pdf-section {
  margin-top: 16px;
  background: #fff;
  border: 1px solid #dbe2ef;
  border-radius: 14px;
  padding: 16px;
}

.section-subtitle {
  margin: 0 0 10px;
  font-size: 16px;
}

.pdf-frame {
  display: block;
  width: 100%;
  min-height: 70vh;
  margin-top: 12px;
  border: 1px solid #dbe2ef;
  border-radius: 10px;
  background: #f8fafc;
}

.final-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid #edf1f7;
}

.final-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.final-row-no {
  width: 28px;
  color: #687089;
  font-weight: 700;
}

.final-row-name {
  font-weight: 600;
}

.final-row-total {
  font-size: 18px;
  font-weight: 800;
}

.event-head p {
  margin: 8px 0 0;
}

.toolbar {
  margin-top: 16px;
  display: grid;
  /* PC / モバイルとも同じ割合（カテゴリー : 検索） */
  grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  width: 100%;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 12px;
  color: #596177;
}

input,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccd3e0;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
}

/* カテゴリー／検索: 高さ揃え + iOS フォーカス拡大防止（16px以上） */
.toolbar input,
.toolbar select {
  box-sizing: border-box;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid #ccd3e0;
  border-radius: 10px;
  font-size: 16px;
  line-height: normal;
  color: #1a1f2d;
  background-color: #fff;
  -webkit-appearance: none;
  appearance: none;
}

.toolbar select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23596177' d='M1.1 1.2l4.9 4.9 4.9-4.9 1.1 1.1-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
}

.field-live-search {
  position: relative;
  display: grid;
  gap: 6px;
}
.field-live-search-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #596177;
}
.live-search-help-btn {
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  border: 1px solid #c5cddb;
  border-radius: 999px;
  background: #fff;
  color: #596177;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}
.live-search-help-btn:hover,
.live-search-help-btn[aria-expanded="true"] {
  background: #eef2f8;
  border-color: #9aa6bb;
  color: #1a1f2d;
}
.live-search-hint {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 4;
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f3f5f9;
  border: 1px solid #e2e7f0;
  font-size: 12px;
  line-height: 1.4;
  color: #5d6475;
  box-shadow: 0 4px 12px rgba(26, 31, 45, 0.08);
}

button {
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: #2968ff;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: #1f57da;
}

.status-row {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  color: #5d6475;
  font-size: 13px;
}

#updatedText.is-reconnecting {
  color: #b45309;
  font-weight: 700;
}

.result-list {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

/*
 * #64:
 * - バー1: position:fixed で固定。クラス一覧が上端に付いたら出し、下のクラスが来ても消さない
 * - クラス帯: バー1 直下 sticky。外れるとバー1 の背面を通過
 * - 最下部: バウンド維持。帯消え防止は main2 fixed pin（overscroll は殺さない）
 * 戻す: ?stickyPad=0
 */
.live-top-safe-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(constant(safe-area-inset-top) + 6px);
  height: calc(env(safe-area-inset-top, 0px) + 6px);
  background: #f2f4f8;
  z-index: 20;
  pointer-events: none;
}

.live-top-safe-bar[hidden],
html:not(.live-sticky-safe-pad) .live-top-safe-bar {
  display: none !important;
}

/* 下部: 上部と同型（safe + 6）。検索確定中だけ */
.live-bottom-safe-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(constant(safe-area-inset-bottom) + 6px);
  height: calc(env(safe-area-inset-bottom, 0px) + 6px);
  background: #f2f4f8;
  z-index: 20;
  pointer-events: none;
}

html:not(.live-sticky-safe-pad) .live-bottom-safe-bar,
html:not(.live-search-active) .live-bottom-safe-bar {
  display: none !important;
}

.class-header {
  position: -webkit-sticky;
  position: sticky;
  top: calc(constant(safe-area-inset-top) + 6px);
  top: calc(env(safe-area-inset-top, 0px) + 6px);
  z-index: 12;
  background: #f2f4f8;
  border-radius: 0;
}

.class-header-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 12px;
  /* 未確定クラス帯: グレー（確定のみ緑） */
  background: #6b6f76;
  color: #fff;
  font-weight: 600;
}

.class-header.class-header-final .class-header-bar {
  background: #1f9d55;
}

/* 任意: sticky 中にベタをやめる旧案（?stickyFlat=1） */
html.live-sticky-flat-when-stuck .class-header.is-stuck .class-header-bar {
  background: #f2f4f8;
  color: #3d4450;
  box-shadow: inset 0 -3px 0 #6b6f76;
}

html.live-sticky-flat-when-stuck .class-header.is-stuck.class-header-final .class-header-bar {
  background: #f2f4f8;
  color: #146c3a;
  box-shadow: inset 0 -3px 0 #1f9d55;
}

html.live-sticky-flat-when-stuck .class-header.is-stuck .class-header-badge {
  background: #146c3a;
  color: #fff;
}

.class-header-name {
  min-width: 0;
}

.class-header-badge {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 4px;
  background: #fff;
  color: #146c3a;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  pointer-events: none;
  user-select: none;
}

/* #58: 進行中／暫定／人数（確定は従来の緑文字） */
.class-header-badge.class-header-badge-active {
  color: #1d4ed8;
}

.class-header-badge.class-header-badge-count {
  color: #334155;
  font-weight: 700;
}

.class-header-badge.class-header-badge-provisional {
  color: #c2410c;
}

html.live-sticky-flat-when-stuck .class-header.is-stuck .class-header-badge-active {
  background: #1d4ed8;
  color: #fff;
}

html.live-sticky-flat-when-stuck .class-header.is-stuck .class-header-badge-provisional {
  background: #c2410c;
  color: #fff;
}

.official-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.official-links .official-sheet-btn {
  min-height: 44px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(20, 40, 80, 0.12);
}

.official-links .home-btn-primary.official-sheet-btn:hover {
  background: #1f56e0;
  color: #fff;
}

.official-links .home-btn-primary.official-sheet-btn:active {
  background: #1847c4;
}

.official-links .home-btn-secondary.official-sheet-btn {
  background: #fff;
  color: #24304a;
  border-color: #c5d0e4;
}

.official-links .home-btn-secondary.official-sheet-btn:hover {
  background: #f3f6fb;
  border-color: #9eb0d0;
}

/* overflow:hidden だと中の .class-header sticky が効かないので角丸は子に付与 */
.class-block {
  display: grid;
  gap: 0;
  border-radius: 10px;
  border: 1px solid #d7deec;
}

.class-block > .class-header:first-child .class-header-bar {
  border-radius: 10px 10px 0 0;
}

/*
 * ピン留め中: ブロック枠は消す（帯の角丸すき間に縦線が覗くのを防ぐ）。
 * カード側に inset で左右（末尾は下も）を描き、枠は残す。
 */
html.live-class-pinned .class-block {
  border-color: transparent;
}

html.live-class-pinned .class-block > .result-card {
  box-shadow: inset 1px 0 0 #d7deec, inset -1px 0 0 #d7deec;
}

html.live-class-pinned .class-block > .result-card:last-child {
  box-shadow:
    inset 1px 0 0 #d7deec,
    inset -1px 0 0 #d7deec,
    inset 0 -1px 0 #d7deec;
}

.class-block > .result-card:last-child {
  border-radius: 0 0 10px 10px;
}

.result-card {
  background: #fff;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid #e2e8f0;
  overflow: hidden;
}

.result-card:last-child {
  border-bottom: none;
}

.result-card.rank-stripe-a {
  background: #ffffff;
}

.result-card.rank-stripe-b {
  background: #f3f6fb;
}

.result-card.rank-stripe-neutral {
  background: #f8f9fc;
}

.result-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
}

.result-header-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.result-header-board {
  flex: 1 1 0;
  min-width: 0;
  display: grid;
  grid-template-columns: var(--header-rank-w, 26px) auto 1fr;
  /* 1:順位/ゼッケン/名前  2:メーカー  3:バッジ — メーカー無しでも2行目を確保 */
  grid-template-rows: auto minmax(calc(12px * 1.3), auto) auto;
  column-gap: var(--header-rank-gap, 6px);
  row-gap: 2px;
  align-items: center;
}

.result-header-board .rank {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  align-self: center;
  width: auto;
  min-width: 0;
  text-align: center;
  line-height: 1.2;
}

/* 狭い順位欄に RET/DNS/DQ を収める（欄幅は数字向けのまま） */
.result-header-board .rank.is-mark {
  font-size: 10px;
  letter-spacing: -0.02em;
  line-height: 1.1;
  max-width: 100%;
}

.result-header-board .bib-no {
  grid-column: 2;
  grid-row: 1;
}

.result-header-board .rider-name {
  grid-column: 3;
  grid-row: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-header-board .subline {
  grid-column: 3;
  grid-row: 2;
  margin-top: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.result-header-board .badge-row {
  grid-column: 2 / -1;
  grid-row: 3;
  margin-top: 0;
}

/* 旧: メーカー無し時に2行目へ上げていた。常に3行目固定のため無効化 */
.result-header-board .badge-row-after-name {
  grid-row: 3;
}

.subline {
  margin-top: 2px;
  color: #596177;
  font-size: 12px;
  line-height: 1.3;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.subline-tip-popover {
  position: fixed;
  z-index: 1200;
  transform: translate(-50%, calc(-100% - 10px));
  pointer-events: none;
}

.subline-tip-popover-text {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 12px;
  background: rgba(30, 35, 45, 0.94);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
  white-space: normal;
  word-break: break-word;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}

.subline-tip-maker {
  font-weight: 700;
}

.subline-tip-team {
  font-weight: 500;
  opacity: 0.95;
}

.subline-tip-maker[hidden],
.subline-tip-team[hidden] {
  display: none !important;
}

.subline-tip-popover-text::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(30, 35, 45, 0.94);
}

.score-box[data-clean] {
  cursor: pointer;
}
.score-box[data-clean]:hover,
.score-box[data-clean]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1.5px rgba(30, 90, 140, 0.35);
}
/* 旧 TOTALセル tip 互換（残存 HTML 用） */
.score-total-tip {
  cursor: pointer;
  text-decoration: underline dotted rgba(30, 35, 45, 0.35);
  text-underline-offset: 2px;
}

.score-total-tip:hover,
.score-total-tip:focus-visible {
  text-decoration-color: rgba(30, 35, 45, 0.7);
  outline: none;
}

.total-tip-popover {
  position: fixed;
  z-index: 1200;
  transform: translate(-50%, calc(-100% - 10px));
  pointer-events: none;
}

.total-tip-popover-text {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  background: rgba(30, 35, 45, 0.94);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
  text-align: center;
}

.total-tip-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

.total-tip-value {
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.total-tip-popover-text::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(30, 35, 45, 0.94);
}

.badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
  min-width: 0;
}

.bib-no {
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
}

.progress-badge {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ss-badge {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ss-badge + .progress-badge {
  margin-left: 0;
}

.progress-badge-complete {
  background: #e7f8ee;
  color: #1e8e4a;
}

.progress-badge-active {
  background: #e8f1ff;
  color: #2563eb;
}

.progress-badge-idle {
  background: #fde8e8;
  color: #b91c1c;
}

.progress-badge-unknown {
  background: #eef1f5;
  color: #9ca3af;
}

.progress-badge-noncompetitive {
  background: #fff4e5;
  color: #b45309;
}

.progress-badge-dq {
  background: #fde8e8;
  color: #b91c1c;
}

.ss-badge-qualified {
  background: #f3e8ff;
  color: #7e22ce;
}

.ss-badge-out {
  background: #eef1f5;
  color: #6b7280;
}

.ss-badge-pending {
  background: #fff4e5;
  color: #b45309;
}

.ss-board-title {
  margin-top: 0;
  margin-bottom: 4px;
  margin-left: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #7e22ce;
  letter-spacing: 0.02em;
}

.ss-board-block {
  margin-top: 8px;
  margin-left: -6px;
  margin-right: -6px;
}

.ss-board-block .section-board {
  margin-top: 0;
  margin-left: 0;
  margin-right: 0;
}

.ss-flat-board {
  margin-left: 6px;
  display: inline-block;
  max-width: 100%;
}

.ss-flat-grid {
  border: 1px solid #dde3ee;
  border-radius: 6px;
  overflow: hidden;
  background: #f9fbff;
}

.ss-flat-row {
  display: flex;
}

.ss-flat-head {
  background: #eef3ff;
  border-bottom: 1px solid #dde3ee;
}

.ss-flat-cell {
  flex: 0 0 38px;
  width: 38px;
  text-align: center;
  padding: 4px 2px;
  font-size: 11px;
  border-right: 1px solid #e4e9f3;
  line-height: 1.25;
  white-space: nowrap;
  box-sizing: border-box;
}

.ss-flat-cell:last-child {
  border-right: none;
}

.ss-flat-cell-lap {
  border-right: 2px solid #b8c4d8;
}

.ss-flat-label {
  color: #1a1f2d;
  font-weight: 600;
}

.ss-flat-score {
  color: #1a1f2d;
  font-weight: 700;
  background: #fff;
}

.ss-flat-excluded {
  background: #eef1f6;
  color: #8a93a8;
}

.ss-board-title-lap {
  text-align: center;
  padding: 4px 2px;
  font-size: 11px;
  font-weight: 700;
  color: #7e22ce;
  letter-spacing: 0.06em;
  background: #faf5ff;
  border-bottom: 1px solid #e9d5ff;
  min-width: 36px;
  line-height: 1.25;
  box-sizing: border-box;
}

.section-board-integrated .section-score-row-ss-start .section-cell-score,
.section-board-integrated .section-score-row-ss-start .section-cell-excluded {
  border-top: 1px solid #e9d5ff;
}

.section-board-integrated .ss-board-title-lap {
  border-top: 1px solid #e9d5ff;
}

.section-cell-label.section-cell-ss,
.section-cell-score.section-cell-ss {
  color: #7e22ce;
}

.section-cell-score.section-cell-ss-labeled {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  line-height: 1.1;
  padding: 3px 2px;
}

.section-cell-ss-tag {
  font-size: 8px;
  font-weight: 700;
  color: #7e22ce;
  letter-spacing: 0.02em;
}

.section-cell-ss-val {
  font-size: 11px;
  font-weight: 700;
  color: #1a1f2d;
}

.rank {
  font-weight: 700;
  font-size: 17px;
  color: #0f8bc8;
  flex-shrink: 0;
  line-height: 1.2;
}

.rider-name {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  min-width: 0;
}

.rider-name-tip {
  cursor: pointer;
  text-decoration: underline dotted rgba(30, 35, 45, 0.35);
  text-underline-offset: 2px;
  -webkit-tap-highlight-color: transparent;
}

.rider-name-tip:hover,
.rider-name-tip:focus-visible {
  text-decoration-color: rgba(30, 35, 45, 0.7);
  outline: none;
}

.name-race-tip-popover-text {
  padding: 8px 14px;
  min-width: max-content;
}

.name-race-tip-value {
  white-space: nowrap;
  font-size: 18px;
  letter-spacing: 0.01em;
}

.section-board {
  margin-top: 4px;
  /* result-body の padding(12px) に対し、端一杯(0) と元(12) の中間 = 6px 余白 */
  margin-left: -6px;
  margin-right: -6px;
  width: auto;
  min-width: 0;
}

.section-board-inner {
  border: 1px solid #dde3ee;
  border-radius: 4px;
  overflow: hidden;
  background: #f9fbff;
}

.section-board-inner.section-board-split {
  display: flex;
  align-items: stretch;
}

.section-board-lap {
  flex: 0 0 auto;
  background: #f9fbff;
  position: relative;
  z-index: 1;
}

.section-board-lap::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2px;
  background: #b8c4d8;
  pointer-events: none;
}

.section-lap-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.section-lap-grid .section-cell-label {
  background: #eef3ff;
  border-bottom: 1px solid #dde3ee;
}

.section-cell-lap {
  min-width: 36px;
}

.section-lap-grid > .section-cell-label.section-cell-lap,
.section-lap-grid > .section-cell-score {
  border-right: none;
}

.section-board-scroll {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.section-board-grid {
  width: 100%;
  min-width: 0;
}

.section-board-scroll .section-board-grid {
  width: max-content;
  min-width: 100%;
}

.section-label-row,
.section-score-row {
  display: grid;
  grid-template-columns: repeat(var(--section-count), minmax(0, 1fr));
  width: 100%;
  min-width: 0;
}

.section-board-scroll .section-label-row,
.section-board-scroll .section-score-row {
  grid-template-columns: repeat(var(--section-count), minmax(26px, max-content));
  min-width: max-content;
}

.section-label-row {
  background: #eef3ff;
  /* border-bottom はセル側へ（行に付けると左列と 1px 段ずれする） */
}

.section-board-scroll .section-label-row .section-cell-label {
  border-bottom: 1px solid #dde3ee;
}

.section-cell-label,
.section-cell-score {
  text-align: center;
  padding: 4px 2px;
  font-size: 11px;
  border-right: 1px solid #e4e9f3;
  white-space: nowrap;
  min-width: 0;
  line-height: 1.25;
}

.section-cell-tail {
  padding-left: 3px;
  padding-right: 3px;
  font-size: 10px;
  letter-spacing: 0;
}

.section-board-scroll .section-cell-tail {
  min-width: 34px;
}

.section-cell-label:last-child,
.section-cell-score:last-child {
  border-right: none;
}

/*
 * 左端列と S/Time 列は別グリッドのため、見出し高さがずれると全行が段違いになる。
 * ラベル行の高さを固定して揃える。
 */
.section-board-split .section-cell-label {
  box-sizing: border-box;
  height: 22px;
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.section-board-split .section-cell-score {
  box-sizing: border-box;
  height: 22px;
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

body.layout-mobile .section-board-split .section-cell-label,
body.layout-mobile .section-board-split .section-cell-score {
  height: 20px;
  min-height: 20px;
}

/* かわうち・モバイル: 点数·ゲート表示用にセルを大きく */
body.layout-mobile.is-kawauchi-event .section-board-split .section-cell-label,
body.layout-mobile.is-kawauchi-event .section-board-split .section-cell-score {
  height: 26px;
  min-height: 26px;
  font-size: 12px;
  padding: 4px 3px;
}
body.layout-mobile.is-kawauchi-event .section-cell-tail {
  font-size: 11px;
  min-width: 40px;
}

.section-cell-label {
  color: #1a1f2d;
  font-weight: 600;
}

.section-cell-score {
  color: #1a1f2d;
  font-weight: 700;
}

.section-cell-excluded {
  background: #eef1f6;
  color: #8a93a8;
}

/* スコア更新セル: 数秒ライト（再描画時は animation-delay 負で途中から継続） */
.section-cell-score.score-cell-flash,
.ss-flat-score.score-cell-flash {
  animation: score-cell-flash 2.8s ease-out both;
}

.score-value.score-value-flash {
  animation: score-value-flash 2.8s ease-out both;
}

@keyframes score-cell-flash {
  0% {
    background: #ffe566;
    box-shadow: inset 0 0 0 1px rgba(212, 160, 0, 0.55);
  }
  35% {
    background: #fff3a8;
  }
  100% {
    background: transparent;
    box-shadow: none;
  }
}

@keyframes score-value-flash {
  0% {
    background: #ffe566;
  }
  35% {
    background: #fff3a8;
  }
  100% {
    background: #fff;
  }
}

.score-box {
  flex: 0 0 auto;
  width: 196px;
  max-width: 50%;
  border: 1px solid #9fd4ef;
  border-radius: 4px;
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
  /* 左ヘッダ（バッジ有無）に伸ばさない。head+value の2行分で高さ固定 */
  align-self: flex-start;
}

/* かわうち方式: SCORE+GATE で5列。通常196pxでは TOTAL が見切れるので広げる */
.score-box.is-kawauchi {
  width: 232px;
  max-width: none;
}
.score-box.is-kawauchi .score-head,
.score-box.is-kawauchi .score-value {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  align-items: center;
}
.score-box.is-kawauchi .score-head span,
.score-box.is-kawauchi .score-value span {
  flex: none;
  min-width: 0;
  padding: 0 1px;
  text-align: center;
  box-sizing: border-box;
}
.score-box.is-kawauchi .score-head span:not(:last-child),
.score-box.is-kawauchi .score-value span:not(:last-child) {
  border-right: 1px solid rgba(255, 255, 255, 0.28);
}
.score-box.is-kawauchi .score-value span:not(:last-child) {
  border-right-color: #dde7f2;
}
.score-box.is-kawauchi .score-value span {
  font-variant-numeric: tabular-nums;
}

.score-head {
  background: #28a7e6;
  color: #fff;
  padding: 4px 3px;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  text-align: center;
  letter-spacing: 0;
  line-height: 1.25;
  flex-shrink: 0;
}

.score-value {
  display: flex;
  align-items: center;
  text-align: center;
  font-size: 15px;
  font-weight: 500;
  padding: 4px 3px;
  background: #fff;
  line-height: 1.1;
  flex: 0 0 auto;
  /* 白い数値エリアを常に2行分の高さに固定 */
  height: calc(15px * 1.1 * 2 + 8px);
  min-height: calc(15px * 1.1 * 2 + 8px);
  box-sizing: border-box;
}

.score-head span,
.score-value span {
  flex: 1 1 0;
  min-width: 0;
  padding: 0 2px;
}

.score-meta {
  margin-top: 2px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  color: #687089;
  font-size: 11px;
}

.score-meta-race-time {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.score-meta-updated {
  flex: 0 0 auto;
  text-align: right;
  white-space: nowrap;
}

.empty {
  text-align: center;
  color: #3f4a63;
  background: #f7f9fc;
  padding: 20px 18px;
  border-radius: 12px;
  border: 1px solid #d7dee9;
  font-size: 15px;
  line-height: 1.55;
  font-weight: 500;
}

.empty-pre-event {
  display: grid;
  gap: 8px;
  justify-items: center;
  max-width: 28rem;
  margin: 0 auto;
  padding: 22px 20px;
  text-align: center;
}

.empty-pre-event-title {
  margin: 0;
  color: #1f2937;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
}

.empty-pre-event-meta {
  margin: 0;
  color: #334155;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.empty-pre-event-note {
  margin: 0;
  color: #475569;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}

.home-empty-hint {
  margin: 8px 0 0;
  text-align: center;
  color: #687089;
  font-size: 13px;
  line-height: 1.5;
}

.home-skeleton {
  display: grid;
  gap: 12px;
}

.home-skeleton-card {
  height: 132px;
  border-radius: 14px;
  border: 1px solid #e4eaf4;
  background: linear-gradient(90deg, #eef2f8 0%, #f8faff 45%, #eef2f8 90%);
  background-size: 200% 100%;
  animation: home-skeleton-shimmer 1.2s ease-in-out infinite;
}

@keyframes home-skeleton-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* スマホ: スコア表・SS表・score-box の左右位置を揃える（result-body padding 12px の半分） */
body.layout-mobile .result-header-row {
  margin-left: -6px;
  margin-right: -6px;
  align-items: flex-start;
}

body.layout-mobile .result-header-board {
  --header-rank-w: 26px;
  --header-rank-gap: 6px;
}

body.layout-mobile .badge-row {
  flex-wrap: nowrap;
  overflow: hidden;
}

body.layout-mobile .progress-badge,
body.layout-mobile .ss-badge {
  font-size: 9px;
  padding: 2px 6px;
}

body.layout-mobile .score-box {
  align-self: flex-start;
  flex-shrink: 0;
}

/* かわうち縦狭: S/G まとめ（通常BOX幅）。layout-pc でも狭い縦ならこちら */
.score-box.is-kawauchi-sg {
  width: 180px;
  max-width: 50%;
}
body.layout-pc .score-box.is-kawauchi-sg {
  width: 180px;
  min-width: 180px;
  max-width: 50%;
}
.score-box.is-kawauchi-sg .score-head {
  font-size: 8px;
  letter-spacing: 0.01em;
}
.score-box.is-kawauchi-sg .score-value span:first-child {
  font-size: 0.92em;
  letter-spacing: -0.02em;
}

body.layout-mobile .ss-flat-board {
  margin-left: 0;
}

/* スマホ縦: 可変列幅。
   - 12セクションまでは LAP + S列 を画面内に収め、Time と13列目以降は横スクロール
   - 11セクション以下なら Time も含めて全部を画面内に表示（スクロールなし）
   - LAP/Time は重み付けで S列より広く確保（LAP > Time。--sb-*-w は main2.js が算出）
   - メイン表と SS 表が同じ --sb-*-w を参照するので、SS 表のセル幅もメイン表に揃う

   列幅は表枠の幅基準(100cqw)で算出する。.section-board / .ss-board-block を
   size container にする。両者は負マージンで同じ幅(カード幅+12px)に広がるので、
   メイン表・SS 表が同じ基準幅を参照でき、列幅も揃う。
   ※ result-body を基準にすると padding 分(12px)狭い内容幅になり表が小さく見える。
   % トラックは max-content 幅のグリッドに対して循環参照になり潰れるため cqw を使う。 */
body.layout-mobile:not(.layout-landscape) .section-board,
body.layout-mobile:not(.layout-landscape) .ss-board-block {
  container-type: inline-size;
}

body.layout-mobile:not(.layout-landscape) .section-board-lap {
  flex: 0 0 calc(100cqw * var(--sb-lap-w, 0.13));
  width: calc(100cqw * var(--sb-lap-w, 0.13));
  min-width: 0;
}

/* セクション数が少ないとき表が画面幅まで伸びて右に余白が出るのを防ぐ */
body.layout-mobile:not(.layout-landscape) .section-board-inner.section-board-split {
  width: fit-content;
  max-width: 100%;
}

/* スクロール領域は LAP 以外の幅に固定。flex:1 だと余分に広がり S13 が見切れる */
body.layout-mobile:not(.layout-landscape) .section-board-scroll {
  flex: 0 0 calc(100cqw * var(--sb-scroll-w, 0.87));
  width: calc(100cqw * var(--sb-scroll-w, 0.87));
  min-width: 0;
  overflow-x: auto;
}

body.layout-mobile:not(.layout-landscape) .section-cell-label.section-cell-lap,
body.layout-mobile:not(.layout-landscape) .section-cell-score.section-cell-lap,
body.layout-mobile:not(.layout-landscape) .ss-board-title-lap {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

body.layout-mobile:not(.layout-landscape) .section-board-scroll .section-label-row,
body.layout-mobile:not(.layout-landscape) .section-board-scroll .section-score-row {
  grid-template-columns:
    repeat(calc(var(--section-count) - 1), calc(100cqw * var(--sb-s-w, 0.08)))
    calc(100cqw * var(--sb-time-w, 0.11));
  width: max-content;
  min-width: max-content;
}

body.layout-mobile:not(.layout-landscape) .section-board-scroll .section-cell-label,
body.layout-mobile:not(.layout-landscape) .section-board-scroll .section-cell-score {
  width: auto;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
}

body.layout-mobile:not(.layout-landscape) .section-board-scroll .section-cell-tail {
  min-width: 0;
}

/* SS 表のセル幅もメイン表の列幅(--sb-*-w)に合わせる。
   SS は S セクション数が少ないので、表全体が「Time + 余ったセクション」分だけ短くなる。 */
body.layout-mobile:not(.layout-landscape) .ss-flat-cell-lap {
  flex: 0 0 calc(100cqw * var(--sb-lap-w, 0.13));
  width: calc(100cqw * var(--sb-lap-w, 0.13));
  min-width: 0;
  box-sizing: border-box;
}

body.layout-mobile:not(.layout-landscape) .ss-flat-cell:not(.ss-flat-cell-lap) {
  flex: 0 0 calc(100cqw * var(--sb-s-w, 0.08));
  width: calc(100cqw * var(--sb-s-w, 0.08));
  min-width: 0;
  box-sizing: border-box;
}

/* スマホ横: S15+Time まで一覧。S16 以上は S16 まで表示し次列を少し見切れ */
body.layout-mobile.layout-landscape .result-body {
  --landscape-visible-units: 17.35;
  --landscape-scroll-viewport-cols: 16.35;
  --board-col-w: calc(100% / var(--landscape-visible-units));
}

body.layout-mobile.layout-landscape .section-board-lap {
  flex: 0 0 var(--board-col-w);
  width: var(--board-col-w);
  min-width: 0;
  max-width: var(--board-col-w);
}

body.layout-mobile.layout-landscape .section-board-scroll {
  overflow-x: auto;
  flex: 0 0 calc(var(--board-col-w) * var(--landscape-scroll-viewport-cols));
  width: calc(var(--board-col-w) * var(--landscape-scroll-viewport-cols));
  min-width: 0;
}

body.layout-mobile.layout-landscape .section-board-scroll .section-board-grid {
  width: calc(var(--board-col-w) * var(--section-count));
  min-width: calc(var(--board-col-w) * var(--section-count));
}

body.layout-mobile.layout-landscape .section-board-scroll .section-label-row,
body.layout-mobile.layout-landscape .section-board-scroll .section-score-row {
  grid-template-columns: repeat(var(--section-count), var(--board-col-w));
  width: calc(var(--board-col-w) * var(--section-count));
  min-width: calc(var(--board-col-w) * var(--section-count));
}

body.layout-mobile.layout-landscape .section-board-scroll .section-cell-label,
body.layout-mobile.layout-landscape .section-board-scroll .section-cell-score {
  width: var(--board-col-w);
  min-width: 0;
  max-width: var(--board-col-w);
  box-sizing: border-box;
}

body.layout-mobile.layout-landscape .section-board-scroll .section-cell-tail {
  min-width: 0;
}

body.layout-mobile.layout-landscape .ss-flat-cell-lap {
  flex: 0 0 var(--main-lap-col-w);
  width: var(--main-lap-col-w);
  min-width: 0;
  box-sizing: border-box;
}

body.layout-mobile.layout-landscape .ss-flat-cell:not(.ss-flat-cell-lap) {
  flex: 0 0 var(--main-s-col-w);
  width: var(--main-s-col-w);
  min-width: 0;
  box-sizing: border-box;
}

/* PC: LAP 38px / S列 30px（余白があれば均一拡大、上限 LAP/Time 50px / S 42px） */
body.layout-pc {
  /* セルの基準幅。少しゆとりを持たせる（S=34 / LAP・Time=42）。
     カード最大幅は 15S+Time をこの基準で並べた幅で頭打ち、16S 以上は表内スクロール。
     カード最小幅はヘッダー（順位+氏名+SCORE box）が収まる幅。
     セクションが少なくカードが最小幅に張り付くときは、セルが伸びて表の右余白を埋める。 */
  --board-lap-base: 42px;
  --board-s-col-base: 34px;
  --board-lap-max: 54px;
  --board-s-col-max: 46px;
  --board-card-pad: 12px;
  /* 基準幅を固定（ビューポートに応じた一律拡大はしない）。これでカード最大幅が安定する。
     少セクション時のヘッダー幅への伸長（セル可変）は別途維持。 */
  --board-max-extra: 0px;
  --pc-max-s-cols: 15;
  --pc-score-box-w: 196px;
  --pc-header-gap: 8px;
}

/* かわうち5列: カード幅計算（--pc-header-min-w）も SCORE box 実幅に合わせる */
body.layout-pc.is-kawauchi-event {
  --pc-score-box-w: 232px;
}

/* セル幅コンパクト切替（a2b12df 相当: S=30 / LAP・Time=38）。
   既定（クラス無し）は 081d4a8 相当の S=34 / LAP・Time=42。
   JS の列数計算は --board-*-base を読むので、この上書きだけで両仕様が連動する。 */
body.layout-pc.pc-cells-compact {
  --board-lap-base: 38px;
  --board-s-col-base: 30px;
  --board-lap-max: 50px;
  --board-s-col-max: 42px;
}

/* カテゴリの右に置くピル型トグル。ナロー/ワイド切替 */
.pc-cell-toggle-field {
  justify-self: end;
  justify-items: end;
}

.pc-cell-toggle-field[hidden] {
  display: none;
}

.pc-cell-toggle {
  padding: 9px 20px;
  border: 1px solid #c7d0e0;
  border-radius: 999px;
  background: #fff;
  color: #1a1f2d;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pc-cell-toggle[aria-pressed="true"] {
  background: #eef3ff;
  border-color: #93b4ff;
}

body.layout-mobile .pc-cell-toggle-field {
  display: none;
}

body.layout-pc .container {
  padding-left: 12px;
  padding-right: 12px;
}

/* ヒーロー／本文カラムはボード幅に揃える。
   --pc-live-column-w は描画前に JS で仮決め→確定するので、全幅→縮小のチラつきを出さない。 */
body.layout-pc .live-content-column {
  width: var(--pc-live-column-w, max-content);
  max-width: 100%;
  margin-inline: auto;
}

body.layout-pc .hero-inner {
  max-width: none;
  padding-left: 12px;
  padding-right: 12px;
}

body.layout-pc .hero-content-column {
  width: var(--pc-live-column-w, max-content);
  max-width: 100%;
  margin-inline: auto;
}

/* 未キャッシュ初回: 正しい幅が付くまで非表示（幅だけ違う一瞬の表示をゼロに） */
html.layout-pc.live-layout-pending .hero-content-column,
html.layout-pc.live-layout-pending main.container > .live-content-column {
  opacity: 0;
}

body.layout-pc .toolbar {
  width: 100%;
}

body.layout-pc .result-list {
  justify-items: stretch;
  min-width: 0;
  width: 100%;
}

body.layout-pc .class-block {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  justify-items: stretch;
}

body.layout-pc .result-card {
  overflow: visible;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

body.layout-pc .result-body {
  --board-extra-w: min(
    var(--board-max-extra),
    max(
      0px,
      calc(
        (min(var(--pc-container-inner-w, 0px), calc(var(--board-lap-max) * 2 + var(--board-s-col-max) * var(--pc-frame-s-cols))) - var(--pc-base-frame-w, 9999px))
        / var(--pc-frame-col-count, 1)
      )
    )
  );
  --board-lap-w: min(var(--board-lap-max), calc(var(--board-lap-base) + var(--board-extra-w)));
  --board-s-col-w: min(var(--board-s-col-max), calc(var(--board-s-col-base) + var(--board-extra-w)));
  --pc-frame-s-cols: var(--pc-visible-s-cols, calc(var(--section-count, 13) - 1));
  /* Time 列分の幅。非スクロール時は LAP 幅ぶん確保、スクロール時は 0（Time はスクロールで表示） */
  --pc-time-slot: var(--board-lap-w);
  --pc-board-frame-w: calc(
    var(--board-lap-w) + var(--board-s-col-w) * var(--pc-frame-s-cols) + var(--pc-time-slot) + 2px + var(--board-card-pad) * 2
  );
  /* ヘッダー（順位+ゼッケン+名前+SCORE表）が表幅より広いときはカード幅をヘッダー基準にする。
     ヘッダー側はカード内容幅なので、カード幅にするには padding 分を足す */
  --pc-header-board-min-w: calc(var(--header-rank-w, 28px) + var(--header-rank-gap, 6px) + 2.5rem + 6rem);
  --pc-header-min-w: calc(
    var(--pc-score-box-w) + var(--pc-header-gap) + var(--pc-header-board-min-w) + var(--board-card-pad) * 2
  );
  --pc-body-w: max(var(--pc-board-frame-w), var(--pc-header-min-w));
  width: var(--pc-body-w);
  /* min-width で算出幅を下限に固定し、画面が狭くてもカードを縮めない（=セルを見切れさせない）。
     収まらない場合はページ側が横スクロールし、丸ごとの 12 列以上を確保する */
  min-width: var(--pc-body-w);
  max-width: 100%;
  padding: var(--board-card-pad);
  box-sizing: border-box;
  overflow-x: clip;
}

body.layout-pc .result-header-row {
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

body.layout-pc .result-header-board {
  --header-rank-w: 28px;
  --header-rank-gap: 6px;
  min-width: var(--pc-header-board-min-w);
}

body.layout-pc .result-header-board .rank.is-mark {
  font-size: 11px;
}

body.layout-pc .score-box {
  align-self: flex-start;
  width: var(--pc-score-box-w);
  min-width: var(--pc-score-box-w);
  max-width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
}

/* 通常ルールより後で上書き。かわうちは5列分を確保し TOTAL 見切れを防ぐ */
body.layout-pc .score-box.is-kawauchi {
  width: var(--pc-score-box-w);
  min-width: var(--pc-score-box-w);
  max-width: none;
}

body.layout-pc .section-board {
  margin-left: 0;
  margin-right: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: visible;
}

body.layout-pc .section-board-inner.section-board-split {
  box-sizing: border-box;
  border: 1px solid #dde3ee;
  overflow: visible;
  width: 100%;
  max-width: 100%;
}

body.layout-pc .section-board-lap {
  flex: 0 0 var(--board-lap-w);
  width: var(--board-lap-w);
  min-width: var(--board-lap-w);
}

body.layout-pc .section-cell-lap {
  min-width: var(--board-lap-w);
  width: var(--board-lap-w);
}

body.layout-pc .section-board-scroll {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  max-width: calc(100% - var(--board-lap-w));
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  /* Windows Chrome 等で非スクロール時に右端に帯状の空きが出るため、
     stable はスクロール発生時のみ適用する（下の .pc-board-scroll 参照） */
  scrollbar-gutter: auto;
}

body.layout-pc .section-board-scroll .section-board-grid {
  width: calc(var(--board-s-col-w) * (var(--section-count, 13) - 1) + var(--board-lap-w));
  min-width: calc(var(--board-s-col-w) * (var(--section-count, 13) - 1) + var(--board-lap-w));
}

body.layout-pc .section-board-scroll .section-label-row,
body.layout-pc .section-board-scroll .section-score-row {
  grid-template-columns: repeat(calc(var(--section-count, 13) - 1), var(--board-s-col-w)) var(--board-lap-w);
  width: calc(var(--board-s-col-w) * (var(--section-count, 13) - 1) + var(--board-lap-w));
  min-width: calc(var(--board-s-col-w) * (var(--section-count, 13) - 1) + var(--board-lap-w));
}

body.layout-pc .section-board-scroll .section-cell-label:not(.section-cell-tail),
body.layout-pc .section-board-scroll .section-cell-score:not(.section-cell-tail) {
  width: var(--board-s-col-w);
  min-width: var(--board-s-col-w);
  max-width: var(--board-s-col-w);
  box-sizing: border-box;
}

body.layout-pc .section-board-scroll .section-cell-tail {
  min-width: var(--board-lap-w);
  max-width: var(--board-lap-w);
  width: var(--board-lap-w);
  box-sizing: border-box;
}

/* PC（非スクロール）: セクションが少なく、表幅が「順位+氏名+スコアボックス」のヘッダー幅に
   満たない場合、表をカード幅いっぱいまで伸ばして列を広げる（枠内に余白を出さない）。
   LAP/Time は重みを大きくして S 列より広く保つ。free space が無い（表幅がカード幅と一致）
   ときは各列は基準幅のまま＝従来どおり。 */
body.layout-pc .result-body:not(.pc-board-scroll) .section-board-lap {
  flex: 1.3 1 var(--board-lap-w);
}

body.layout-pc .result-body:not(.pc-board-scroll) .section-cell-lap {
  width: 100%;
  min-width: 0;
}

body.layout-pc .result-body:not(.pc-board-scroll) .section-board-scroll {
  flex: calc(var(--pc-frame-s-cols) + 1.3) 1 auto;
  width: auto;
  max-width: none;
  /* 全列が一覧のときは横スクロール不要。gutter/スクロールバー帯で Time が欠けて見えるのを防ぐ */
  overflow-x: hidden;
  scrollbar-gutter: auto;
}

body.layout-pc .result-body:not(.pc-board-scroll) .section-board-scroll .section-board-grid {
  width: 100%;
  min-width: 0;
}

body.layout-pc .result-body:not(.pc-board-scroll) .section-board-scroll .section-label-row,
body.layout-pc .result-body:not(.pc-board-scroll) .section-board-scroll .section-score-row {
  grid-template-columns:
    repeat(var(--pc-frame-s-cols), minmax(var(--board-s-col-w), 1fr))
    minmax(var(--board-lap-w), 1.3fr);
  width: 100%;
  min-width: 0;
}

body.layout-pc .result-body:not(.pc-board-scroll) .section-board-scroll .section-cell-label,
body.layout-pc .result-body:not(.pc-board-scroll) .section-board-scroll .section-cell-score {
  width: auto;
  min-width: 0;
  max-width: none;
}

/* PC（スクロール時）: 表示する S 列ぶんだけビューポートを確保し、残りの S 列と Time は横スクロール。
   ビューポート幅 = 表示 S 列数 × S 列幅（=丸ごと整数列）なので、休止状態でセルが半端に切れない。
   Time はスクロール末尾で全幅表示される */
body.layout-pc .result-body.pc-board-scroll {
  --pc-time-slot: 0px;
}

body.layout-pc .result-body.pc-board-scroll .section-board-inner.section-board-split {
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}

body.layout-pc .result-body.pc-board-scroll .section-board-scroll {
  flex: 0 0 calc(var(--board-s-col-w) * var(--pc-visible-s-cols));
  width: calc(var(--board-s-col-w) * var(--pc-visible-s-cols));
  min-width: 0;
  max-width: calc(var(--board-s-col-w) * var(--pc-visible-s-cols));
  overflow-x: auto;
  scrollbar-gutter: stable;
}

body.layout-pc .result-body.pc-board-scroll .section-board-scroll .section-board-grid {
  width: calc(var(--board-s-col-w) * (var(--section-count, 13) - 1) + var(--board-lap-w));
  min-width: calc(var(--board-s-col-w) * (var(--section-count, 13) - 1) + var(--board-lap-w));
}

body.layout-pc .ss-board-block {
  margin-left: 0;
  margin-right: 0;
  width: fit-content;
  max-width: 100%;
}

.ss-board-title-over-lap {
  margin-left: 0;
  text-align: center;
  box-sizing: border-box;
}

body.layout-pc .ss-board-title-over-lap {
  width: var(--board-lap-w);
}

body.layout-mobile:not(.layout-landscape) .ss-board-title-over-lap {
  width: calc(100cqw * var(--sb-lap-w, 0.13));
}

body.layout-mobile.layout-landscape .ss-board-title-over-lap {
  width: var(--main-lap-col-w, var(--board-col-w, 38px));
}

body.layout-pc .ss-flat-board {
  margin-left: 0;
  display: inline-block;
  max-width: 100%;
}

body.layout-pc .ss-flat-cell-lap {
  flex: 0 0 var(--board-lap-w);
  width: var(--board-lap-w);
}

body.layout-pc .ss-flat-cell:not(.ss-flat-cell-lap) {
  flex: 0 0 var(--board-s-col-w);
  width: var(--board-s-col-w);
}

@media (max-width: 720px) {

  body.layout-mobile .rider-name,
  body.layout-mobile .rank,
  body.layout-mobile .bib-no {
    font-size: 15px;
  }

  body.layout-mobile .score-box {
    width: 180px;
  }

  body.layout-mobile .score-value {
    font-size: 14px;
    height: calc(14px * 1.1 * 2 + 8px);
    min-height: calc(14px * 1.1 * 2 + 8px);
  }

  body.layout-mobile .section-cell-label,
  body.layout-mobile .section-cell-score {
    font-size: 10px;
    padding: 3px 1px;
  }
}

/* old classes kept harmless if cached HTML is loaded */
.header h1 {
  margin: 0;
  font-size: 28px;
}

.header p {
  margin-top: 8px;
  color: #5d6475;
}

.section-cell-markable {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.section-cell-marking-active {
  outline: 2px solid #28a7e6;
  outline-offset: -1px;
  background: #e8f6fd;
}

.marking-time-popover {
  position: fixed;
  z-index: 1200;
  transform: translate(-50%, calc(-100% - 10px));
  pointer-events: none;
}

.marking-time-popover-text {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 14px;
  background: rgba(30, 35, 45, 0.94);
  color: #fff;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}

.marking-time-popover-text::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(30, 35, 45, 0.94);
}

.marking-time-popover-label {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.88;
}

.marking-time-popover-value {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}

.ss-flat-score.section-cell-markable {
  cursor: pointer;
}

@media print {
  .no-print,
  .notice-banner-ops {
    display: none !important;
  }
}

/* —— Public gate (/) : dark brand doors —— */
.gate-page {
  min-height: 100vh;
  min-height: 100dvh;
  background: #0b3d57;
  color: #fff;
}

.gate {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px 40px;
  overflow: hidden;
}

.gate-atmosphere {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 70% at 18% 12%, rgba(56, 189, 248, 0.35), transparent 55%),
    radial-gradient(ellipse 70% 60% at 88% 78%, rgba(15, 136, 195, 0.45), transparent 50%),
    linear-gradient(165deg, #0f88c3 0%, #0b3d57 48%, #082636 100%);
  pointer-events: none;
}

.gate-inner {
  position: relative;
  z-index: 1;
  width: min(100%, 28rem);
  text-align: left;
}

.gate-kicker {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.gate-brand {
  margin: 0;
  font-size: clamp(2.1rem, 8vw, 3.1rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.05;
}

.gate-lead {
  margin: 14px 0 0;
  font-size: 15px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.88);
  max-width: 22rem;
}

.gate-nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  margin-top: 36px;
}

.gate-link {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
  transition: border-color 0.15s ease, opacity 0.15s ease;
}

.gate-link:hover {
  border-bottom-color: rgba(255, 255, 255, 0.85);
}

.gate-link-primary {
  font-size: 1.35rem;
}

.gate-foot {
  margin: 48px 0 0;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.gate-foot a {
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
}

.gate-foot a:hover {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.gate-foot-org {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.38);
}

.gate-foot-org:hover {
  color: rgba(255, 255, 255, 0.7);
}

