html,
body {
  min-height: 100%;
  margin: 0;
  padding-top: 30px;
}

body {
  background-color: #111;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body.bg-start { background-image: url('../images/bg01.jpg'); }
body.bg-highscores { background-image: url('../images/bg01.jpg'); }
body.bg-instruction { background-image: url('../images/bg01.jpg'); }
body.bg-info { background-image: url('../images/bg01.jpg'); }
body.bg-imprint { background-image: url('../images/bg01.jpg'); }
body.bg-privacy { background-image: url('../images/bg01.jpg'); }
body[data-screen="setup"] { background-image: url('../images/bg01.jpg'); }
body[data-screen="joining"] { background-image: url('../images/bg01.jpg'); }
body[data-screen="duration"] { background-image: url('../images/bg01.jpg'); }
body[data-screen="countdown"] { background-image: url('../images/bg01.jpg'); }
body[data-screen="running"] { background-image: url('../images/bg01.jpg'); }
body[data-screen="finished"] { background-image: url('../images/bg01.jpg'); }
body[data-screen="unavailable"] { background-image: url('../images/bg01.jpg'); }

body.controller-mode {
  padding: 0;
  min-height: 100dvh;
  background-image: url('../images/controller/bg_controller_01.jpg');
}

body.admin-mode,
body.admin-login-mode {
  background-image: url('../images/bg01.jpg') !important;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body.admin-mode {
  padding-top: 90px;
}

body.admin-login-mode {
  padding: 0;
  min-height: 100dvh;
}

.ts-navbar {
  backdrop-filter: blur(10px);
  background: rgba(10, 10, 10, .82) !important;
}

.ts-nav-active {
  color: #E412DE !important;
}

.ts-bg-video {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: -2;
  pointer-events: none;
}

.ts-bg-video-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.ts-start-hero {
  position: relative;
  z-index: 1;
}

.tapsprint-page-main {
  min-height: calc(100dvh - 130px);
}

.tapsprint-page-panel,
.ts-surface {
  background-color: rgba(255, 255, 255, .92) !important;
  backdrop-filter: blur(2px);
}

.tapsprint-page-scroll {
  min-height: 0;
  overflow-y: auto;
}

.tapsprint-start-logo,
.tapsprint-start-content {
  width: 75vw;
  max-width: 75vw;
}

.tapsprint-start-logo {
  height: auto;
  display: block;
}

.tapsprint-start-content {
  max-width: min(75vw, 900px);
}

.tapsprint-start-text {
  text-wrap: balance;
}

.screen {
  max-width: 920px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.slot { min-height: 64px; }
.counter { font-size: clamp(4rem, 18vw, 11rem); font-weight: 900; line-height: 1; }
.small-reset { font-size: .85rem; }
.qrbox { background: white; display: inline-block; padding: 18px; border-radius: 16px; }
.winner { font-size: clamp(1.8rem, 5vw, 4rem); font-weight: 800; }
.place2 { font-size: clamp(1.1rem, 3vw, 2rem); }
.player-result.mine { font-weight: 800; background: #fff3cd; border-radius: .5rem; }
.result-table { max-width: 720px; margin: 1.25rem auto 0; }
.controller-result { font-size: clamp(1.6rem, 6vw, 3.2rem); font-weight: 900; }
.pause-label { font-size: clamp(5rem, 22vw, 15rem); font-weight: 900; letter-spacing: .08em; line-height: 1; }
.controller-head { font-size: .9rem; color: #666; }
.controller-head-code { color: #111; background: rgba(255, 255, 255, .6); padding: .15rem .35rem; border-radius: .35rem; }

body.controller-mode:not(.play-mode) {
  overflow-x: hidden;
}

.ts-controller-container {
  min-height: 100dvh;
  max-height: 100dvh;
  max-width: min(760px, 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: calc(env(safe-area-inset-top, 0px) + clamp(16px, 4vw, 40px)) clamp(16px, 5vw, 48px) calc(env(safe-area-inset-bottom, 0px) + clamp(16px, 4vw, 40px)) !important;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ts-controller-header { margin-bottom: clamp(18px, 3vw, 34px) !important; }
.ts-controller-app { width: 100%; }
.ts-controller-surface {
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: 28px;
  background: rgba(255, 255, 255, .90) !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28) !important;
}
.ts-controller-surface-body { padding: clamp(24px, 5vw, 48px); }
.ts-controller-control { min-height: 58px; font-size: clamp(1.05rem, 2.8vw, 1.35rem); }
.ts-controller-footer { margin-top: clamp(16px, 3vw, 34px) !important; }

body.play-mode {
  padding: 0 !important;
  background: #050505;
  color: #fff;
  overflow: hidden !important;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body.play-mode .ts-nonplay-ui { display: none !important; }

body.play-mode .ts-play-container {
  max-width: none;
  width: 100vw;
  height: 100dvh;
  padding: 0 !important;
  margin: 0 !important;
}

.play-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  background: rgba(5, 5, 5, .68);
  color: #fff;
  cursor: pointer;
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.play-hint { position: absolute; top: 1rem; left: 1rem; right: 1rem; font-size: clamp(.95rem, 2vw, 1.25rem); opacity: .65; }
.start-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: clamp(5rem, 22vw, 15rem); font-weight: 900; letter-spacing: .03em; pointer-events: none; opacity: 0; animation: startFade .55s ease-out; }
@keyframes startFade { 0% { opacity: 1; transform: scale(.94); } 80% { opacity: .9; } 100% { opacity: 0; transform: scale(1.05); } }
.tap-count { font-size: clamp(5rem, 22vw, 15rem); font-weight: 900; line-height: 1; }
.tap-meta { position: absolute; bottom: 1rem; left: 1rem; right: 1rem; font-size: clamp(1rem, 2.4vw, 1.6rem); opacity: .75; }
.flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 9999; }
.flash.on { animation: tapFlash .11s ease-out; }
@keyframes tapFlash { 0% { opacity: .62; } 100% { opacity: 0; } }

@media (min-width: 992px) {
  .tapsprint-start-logo,
  .tapsprint-start-content {
    width: 50vw;
    max-width: 50vw;
  }
}

.ratio-low { background-color: #f8d7da !important; color: #842029 !important; font-weight: 600; }
.ratio-neutral { background-color: #fff3cd !important; color: #664d03 !important; font-weight: 600; }
.ratio-high { background-color: #d1e7dd !important; color: #0f5132 !important; font-weight: 600; }

#content {
  background: #ffffff;
  margin-top: 0;
  padding: 20px 40px 32px 40px;
  height: calc(100dvh - 130px);
  overflow-y: auto;
}

.page-header {
  border-bottom: 1px solid #dddddd;
  margin-bottom: 1rem !important;
  text-align: center;
}

.admin-data-page #content {
  overflow: hidden;
}

.ts-help-popover {
  --bs-btn-padding-x: 0;
  --bs-btn-padding-y: 0;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  line-height: 1.2rem;
  font-size: .85rem;
  font-weight: 700;
}

.admin-main {
  min-height: 100dvh;
}

.admin-login-card {
  width: min(92vw, 380px);
  border-radius: 1rem;
}

.admin-login-logo {
  width: 100%;
  max-width: 220px;
  height: auto;
}

.ts-columns-menu {
  max-height: 70dvh;
  overflow-y: auto;
}

.ts-admin-data-page-content {
  display: flex;
  flex-direction: column;
}

.ts-admin-data-layout {
  flex: 1 1 auto;
  min-height: 0;
}

.ts-admin-data-tabs {
  flex: 0 0 auto;
  min-height: 0;
  margin-bottom: .75rem !important;
}

.ts-admin-data-tab-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.ts-admin-data-tab-content > .tab-pane.active {
  height: 100%;
  min-height: 0;
}

.ts-admin-data-table {
  max-height: 100%;
  overflow: hidden;
}


.ts-admin-data-table .bootstrap-table {
  font-size: clamp(.72rem, .86vw, .88rem);
}

.ts-admin-data-table .fixed-table-toolbar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: nowrap;
  margin-bottom: .55rem;
}

.ts-admin-data-table .fixed-table-toolbar::before,
.ts-admin-data-table .fixed-table-toolbar::after {
  display: none !important;
}

.ts-admin-data-table .fixed-table-toolbar .search {
  float: none !important;
  margin: 0 !important;
  width: min(100%, 16rem);
  order: 1;
}

.ts-admin-data-table .fixed-table-toolbar .search input {
  width: 100%;
  height: 2.4rem;
  border-radius: 0;
  box-shadow: none;
}

.ts-admin-data-table .fixed-table-toolbar .columns,
.ts-admin-data-table .fixed-table-toolbar .bs-bars,
.ts-admin-data-table .fixed-table-toolbar .float-right,
.ts-admin-data-table .fixed-table-toolbar .float-end {
  float: none !important;
  margin: 0 !important;
}

.ts-admin-data-table .fixed-table-toolbar .columns {
  order: 2;
  margin-left: auto !important;
  display: flex;
  align-items: stretch;
  gap: 0;
}

.ts-admin-data-table .fixed-table-toolbar .btn-group > .btn,
.ts-admin-data-table .fixed-table-toolbar .columns > .btn,
.ts-admin-data-table .fixed-table-toolbar button[name="refresh"],
.ts-admin-data-table .fixed-table-toolbar button[name="fullscreen"],
.ts-admin-data-table .fixed-table-toolbar button[name="columns"],
.ts-admin-data-table .fixed-table-toolbar button[name="export"] {
  min-width: 2.55rem;
  min-height: 2.4rem;
  border-radius: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ts-admin-data-table .fixed-table-toolbar .dropdown-menu {
  max-height: 70dvh;
  overflow-y: auto;
}

.ts-admin-data-table .fixed-table-container,
.ts-admin-data-table .fixed-table-body {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

.ts-admin-data-table .fixed-table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  font-size: .82rem;
  margin-top: .35rem;
}

.ts-admin-data-table .fixed-table-pagination::before,
.ts-admin-data-table .fixed-table-pagination::after {
  display: none !important;
}

.ts-admin-data-table .fixed-table-pagination .pagination-detail,
.ts-admin-data-table .fixed-table-pagination .pagination {
  float: none !important;
  margin: 0 !important;
}

.ts-admin-data-table .table {
  margin-bottom: 0 !important;
}

.ts-admin-data-table .table > :not(caption) > * > * {
  padding: .24rem .34rem;
  vertical-align: middle;
  white-space: nowrap;
}

.ts-admin-data-table .table td,
.ts-admin-data-table .table th {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ts-admin-data-table .table thead th {
  font-weight: 700;
}

.ts-admin-data-table .bi::before {
  display: inline-block;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
}

.ts-admin-data-table .bi-arrow-clockwise::before { content: "↻"; }
.ts-admin-data-table .bi-arrows-fullscreen::before { content: "↔"; }
.ts-admin-data-table .bi-fullscreen::before { content: "↔"; }
.ts-admin-data-table .bi-list-ul::before { content: "☷"; }
.ts-admin-data-table .bi-download::before { content: "⇩"; }
.ts-admin-data-table .bi-chevron-down::before { content: "⌄"; font-size: .75em; margin-left: .25rem; }
.ts-admin-data-table .bi-caret-down-square::before { content: "▿"; }
.ts-admin-data-table .bi-caret-up-square::before { content: "▵"; }

@media (max-width: 767.98px) {
  .ts-admin-data-table .fixed-table-toolbar {
    flex-wrap: wrap;
  }
  .ts-admin-data-table .fixed-table-toolbar .search {
    width: 100%;
  }
  .ts-admin-data-table .fixed-table-toolbar .columns {
    margin-left: 0 !important;
    width: 100%;
    justify-content: flex-end;
  }
}

/* F101Q host game layout */
.ts-host-container {
  max-width: 1320px;
  width: 100%;
}

.ts-host-info {
  min-height: 1.25rem;
  opacity: .82;
}

.ts-host-stage {
  min-height: calc(100dvh - 220px);
  padding-top: clamp(3rem, 7vh, 5.5rem);
}

.ts-host-card {
  color: #111;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 1rem 3rem rgba(0,0,0,.24);
}

.ts-host-center-col {
  position: relative;
  z-index: 3;
}

.ts-host-side-col {
  position: relative;
  z-index: 2;
}

.ts-host-card > .card-body {
  padding: clamp(1.25rem, 2vw, 2rem);
}

.ts-host-center-card {
  max-width: 420px;
  position: relative;
  z-index: 3;
  overflow: visible;
}

.ts-host-side-card {
  max-width: 430px;
  position: relative;
  z-index: 1;
}

.ts-host-logo {
  display: block;
  width: min(100%, 470px);
  margin: -5.2rem auto 1rem;
  pointer-events: none;
}


.ts-host-qr-wrap {
  position: relative;
  z-index: 4;
}

.ts-host-qr {
  display: inline-block;
  padding: .75rem;
  background: #fff;
  position: relative;
  z-index: 4;
}

.ts-host-qr canvas,
.ts-host-qr img {
  display: block;
  position: relative;
  z-index: 5;
}

.ts-host-mode-btn,
.ts-host-slot-btn {
  border-radius: .75rem;
  min-height: 52px;
  font-size: clamp(1.05rem, 1.35vw, 1.35rem);
}

.ts-host-slot-btn {
  font-weight: 700;
}

.ts-host-team-input {
  border-radius: .75rem;
  border-color: #111;
  color: #111;
  font-weight: 500;
}

.ts-host-slots {
  display: grid;
  gap: .65rem;
}

.ts-host-slot-row {
  margin-inline: auto;
  width: min(100%, 320px);
}

@media (max-width: 991.98px) {
  .ts-host-stage {
    min-height: 0;
    padding-top: 1rem;
  }
  .ts-host-logo {
    margin-top: 0;
  }
  .ts-host-card,
  .ts-host-side-card,
  .ts-host-center-card {
    max-width: 520px;
  }
}

/* F101V host/controller UX refinements */
.ts-host-info-bar {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  z-index: 1020;
  width: 100%;
  padding: .35rem .75rem;
  color: rgba(255,255,255,.9);
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(8px);
}

.ts-host-start-square {
  width: min(250px, 72vw);
  aspect-ratio: 1 / 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border-radius: .75rem;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.05;
  text-transform: none;
}

.ts-host-start-square span {
  display: block;
  margin-top: .35rem;
  font-size: clamp(.95rem, 1.45vw, 1.25rem);
  line-height: 1.1;
}


/* F101AJ frontend/host video layer */
.ts-bg-media {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ts-bg-video,
.ts-bg-video-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ts-bg-video {
  object-fit: cover;
}

.ts-bg-video-overlay {
  background: rgba(0, 0, 0, .28);
}

body.ts-video-page,
body.bg-start,
body.bg-highscores,
body.bg-instruction,
body.bg-info,
body.bg-imprint,
body.bg-privacy,
body.host-mode {
  background-image: url('../images/bg01.jpg');
}

body.ts-video-page > nav,
body.ts-video-page > main,
body.ts-video-page > footer,
body.ts-video-page > .container,
body.ts-video-page #app,
body.host-mode > nav,
body.host-mode > .ts-host-info-bar,
body.host-mode > .screen,
body.host-mode > footer,
body.host-mode #app {
  position: relative;
  z-index: 2;
}

body.controller-mode .ts-bg-media,
body.admin-mode .ts-bg-media,
body.admin-login-mode .ts-bg-media {
  display: none;
}

/* F101AK host public pages */
:root {
  --ts-navbar-height: 57px;
  --ts-top-spacing: 33px;
  --ts-public-top-offset: calc(var(--ts-navbar-height) + var(--ts-top-spacing));
}
html { scroll-behavior: smooth; }
body.bg-start,
body.bg-highscores,
body.bg-instruction,
body.bg-info,
body.bg-imprint,
body.bg-privacy {
  padding-top: var(--ts-public-top-offset);
}
.ts-public-main {
  padding-top: 0 !important;
}
.ts-content-shell {
  width: min(100%, 1220px);
  position: relative;
}
.ts-page-logo-wrap {
  position: relative;
  z-index: 2;
  margin-bottom: clamp(-56px, -5vw, -28px);
  pointer-events: none;
}
.ts-page-logo {
  width: min(78vw, 520px);
  height: auto;
  filter: drop-shadow(0 16px 18px rgba(0,0,0,.34));
}
.ts-content-panel {
  background: rgba(255,255,255,.96);
  padding: clamp(72px, 8vw, 112px) clamp(22px, 4vw, 48px) clamp(28px, 4vw, 48px);
  min-height: min(620px, calc(100dvh - 220px));
  overflow: visible;
}
.ts-content-scroll {
  max-height: none;
  overflow: visible;
  font-size: clamp(1rem, 1.55vw, 1.25rem) !important;
}
.ts-content-scroll :target {
  scroll-margin-top: 140px;
}
.ts-anchor-nav .btn,
.ts-mode-buttons .btn {
  min-height: 54px;
  border-radius: 12px;
}
.tapsprint-footer {
  position: relative;
  z-index: 2;
  margin-top: auto;
  text-shadow: 0 1px 5px rgba(0,0,0,.9);
}

.ts-highscore-shell { width: min(100%, 1220px); }
.ts-highscore-panel { min-height: auto; }
.ts-highscore-mobile-controls {
  position: relative;
  z-index: 3;
}
.ts-highscore-desktop-controls {
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 6vw, 92px);
  align-items: center;
}
.ts-highscore-table {
  table-layout: fixed;
  font-size: clamp(.95rem, 1.15vw, 1.08rem);
}
.ts-highscore-table thead th {
  background: #ffc928;
  color: #111;
  border-bottom: 0;
  text-transform: uppercase;
}
.ts-highscore-table th:nth-child(1),
.ts-highscore-table td:nth-child(1) { width: 22%; }
.ts-highscore-table th:nth-child(2),
.ts-highscore-table td:nth-child(2) { width: 32%; }
.ts-highscore-table th:nth-child(3),
.ts-highscore-table td:nth-child(3) { width: 22%; }
.ts-highscore-table th:nth-child(4),
.ts-highscore-table td:nth-child(4) { width: 24%; }
.ts-highscore-table tbody tr { height: 34px; }
.ts-highscore-scroll {
  max-height: calc(34px * 11 + 40px);
  overflow-y: auto;
}

@media (max-width: 991.98px) and (orientation: portrait) {
  .ts-highscore-main { padding-top: 0 !important; }
  .ts-highscore-shell .ts-page-logo-wrap { margin-bottom: 0; }
  .ts-highscore-shell .ts-page-logo { width: min(86vw, 480px); }
  .ts-highscore-panel { padding-top: clamp(26px, 6vw, 44px); }
}

@media (max-width: 575.98px) {
  .ts-public-main {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
  .ts-page-logo { width: min(92vw, 440px); }
  .ts-content-panel {
    border-radius: 18px !important;
    padding-left: 18px;
    padding-right: 18px;
  }
  .ts-content-scroll { font-size: 1rem !important; }
  .ts-highscore-table { font-size: .9rem; }
  .ts-highscore-table tbody tr { height: 32px; }
  .ts-highscore-scroll { max-height: calc(32px * 11 + 38px); }
}

/* F101AL public host pages/layout correction */
html {
  font-size: clamp(13px, 3.6vw, 16px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
}
body {
  font-family: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
.ts-content-scroll h1,
.ts-content-scroll h2,
.ts-content-scroll h3,
.ts-content-scroll h4,
.ts-content-scroll h5,
.ts-content-scroll h6 {
  margin: 0 0 .45rem 0;
  font-family: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #111;
  font-synthesis: none;
}
.ts-content-scroll h1 { font-size: 1.85rem; line-height: 1.18; }
.ts-content-scroll h2 { font-size: 1.55rem; line-height: 1.22; margin-top: 1.15rem; }
.ts-content-scroll h3 { font-size: 1.35rem; line-height: 1.26; margin-top: .9rem; }
.ts-content-scroll h4,
.ts-content-scroll h5,
.ts-content-scroll h6 { font-size: 1.15rem; line-height: 1.30; margin-top: .7rem; }
.ts-content-scroll p { margin: 0 0 1em 0; }
.ts-content-scroll h1,
.ts-content-scroll h2,
.ts-content-scroll h3,
.ts-content-scroll p {
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
}
.ts-content-scroll strong,
.ts-content-scroll b { font-weight: 700; font-synthesis: none; }

.ts-public-main {
  padding-top: 0 !important;
  padding-bottom: 10px !important;
  min-height: 0;
}
.ts-content-shell,
.ts-highscore-shell {
  width: min(calc(100vw - 48px), 1220px);
  max-width: 1220px;
}
.ts-page-logo-wrap {
  margin-bottom: clamp(-54px, -4.5vw, -34px);
}
.ts-page-logo {
  width: min(52vw, 520px);
  max-height: clamp(130px, 19vh, 205px);
  object-fit: contain;
}
.ts-content-panel {
  --ts-panel-height: clamp(440px, calc(100dvh - 280px), 590px);
  height: var(--ts-panel-height);
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(34px, 3.4vw, 52px) clamp(22px, 4vw, 48px) clamp(20px, 3vw, 36px);
  overflow: hidden;
}
.ts-content-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: .35rem;
  font-size: clamp(.95rem, 1.04vw, 1.08rem) !important;
}
.ts-anchor-nav {
  flex: 0 0 auto;
}
.ts-anchor-nav .btn,
.ts-mode-buttons .btn {
  min-height: 48px;
  border-radius: 12px;
  line-height: 1.05;
}

.ts-highscore-main { padding-top: 0 !important; }
.ts-highscore-panel { gap: 0; }
.ts-highscore-panel > h1 {
  flex: 0 0 auto;
  font-size: 1.85rem;
  line-height: 1.18;
  margin: 0 0 .5rem 0;
  color: #111;
}
.ts-highscore-desktop-controls {
  grid-template-columns: 1fr 1fr;
  gap: clamp(18px, 4vw, 72px);
  align-items: center;
  flex: 0 0 auto;
}
.ts-highscore-mobile-controls { flex: 0 0 auto; }
.ts-highscore-tables {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.ts-highscore-tables > [class*="col-"] {
  min-height: 0;
  display: flex;
}
.ts-highscore-tables .table-responsive {
  width: 100%;
  min-height: 0;
}
.ts-highscore-table {
  table-layout: fixed;
  font-size: clamp(.82rem, .92vw, .98rem);
  line-height: 1.18;
}
.ts-highscore-table th,
.ts-highscore-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: .42rem .45rem;
}
.ts-highscore-table th:nth-child(1),
.ts-highscore-table td:nth-child(1) { width: 12%; }
.ts-highscore-table th:nth-child(2),
.ts-highscore-table td:nth-child(2) { width: 34%; }
.ts-highscore-table th:nth-child(3),
.ts-highscore-table td:nth-child(3) { width: 16%; }
.ts-highscore-table th:nth-child(4),
.ts-highscore-table td:nth-child(4) { width: 38%; }
.ts-highscore-table tbody tr { height: 34px; }
.ts-highscore-scroll {
  height: 100%;
  max-height: none;
  overflow-y: auto;
}

@media (max-width: 575.98px) {
  .ts-content-shell,
  .ts-highscore-shell { width: min(calc(100vw - 28px), 1220px); }
  .ts-public-main { padding-top: 0 !important; }
  .ts-page-logo-wrap { margin-bottom: -28px; }
  .ts-page-logo { width: min(94vw, 440px); max-height: 150px; }
  .ts-content-panel {
    --ts-panel-height: auto;
    max-height: none;
    height: auto;
    min-height: calc(100dvh - 170px);
    padding-top: 34px;
  }
  .ts-content-scroll { overflow-y: visible; font-size: 1rem !important; }
  .ts-highscore-panel { min-height: 0; }
  .ts-highscore-tables { overflow: visible; }
  .ts-highscore-table { font-size: .88rem; }
}

/* Startseite: kontrollierte Skalierung bei geringer Viewport-Höhe */
@media (min-width: 768px) and (max-height: 820px) and (orientation: landscape) {
  body.bg-start { padding-top: 66px; }
  body.bg-start .tapsprint-page-main { min-height: calc(100dvh - 92px); }
  body.bg-start .ts-start-hero {
    transform: scale(.75);
    transform-origin: top center;
    margin-top: -10px;
    margin-bottom: -90px;
  }
  body.bg-start .tapsprint-start-logo,
  body.bg-start .tapsprint-start-content {
    width: 64vw;
    max-width: 760px;
  }
}

/* F101BB result screen */
.ts-host-stage-finished .ts-host-card {
  overflow: visible;
}
.ts-host-result-center-card .card-body,
.ts-host-result-side-card .card-body {
  min-height: 0;
}
.ts-host-result-center-body {
  min-height: 0;
  padding-block: clamp(.5rem, 1.6vh, 1.25rem);
}
.ts-host-result-rank {
  font-size: clamp(1.35rem, 2.35vw, 2.35rem);
  font-weight: 900;
  line-height: 1.05;
  color: #050505;
}
.ts-host-result-place {
  font-size: clamp(1.6rem, 2.8vw, 2.85rem);
}
.ts-host-stage-finished .ts-host-slot-btn {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ts-host-stage-finished .ts-host-team-input[readonly] {
  background: #fff;
  opacity: 1;
}
@media (max-height: 820px) and (min-width: 992px) {
  .ts-host-stage-finished .ts-host-logo {
    width: min(100%, 420px);
  }
  .ts-host-result-rank {
    font-size: clamp(1.15rem, 2vw, 2rem);
  }
  .ts-host-result-place {
    font-size: clamp(1.35rem, 2.35vw, 2.35rem);
  }
  .ts-host-stage-finished .ts-host-card > .card-body {
    padding-block: clamp(1rem, 1.5vw, 1.5rem);
  }
}

/* F101BC controller header logo */
.ts-controller-logo {
  display: block;
  width: min(420px, 86vw);
  height: auto;
  margin: 0 auto clamp(8px, 2vw, 14px);
}
.controller-head-code {
  color: #111;
  background: rgba(255, 255, 255, .78);
  padding: .45rem .8rem;
  border-radius: .5rem;
  font-weight: 700;
}


/* F101BD controller refinements */
.ts-controller-header {
  text-align: center;
}
.controller-head-code {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

/* F101BJ admin finalization */
:root {
  --ts-primary: #E412DE;
  --ts-primary-hover: #880a85;
}

body.admin-mode {
  padding-top: 90px;
}

body.admin-mode .btn-primary,
body.admin-mode .bootstrap-table .btn-primary {
  --bs-btn-bg: var(--ts-primary);
  --bs-btn-border-color: var(--ts-primary);
  --bs-btn-hover-bg: var(--ts-primary-hover);
  --bs-btn-hover-border-color: var(--ts-primary-hover);
  --bs-btn-active-bg: var(--ts-primary-hover);
  --bs-btn-active-border-color: var(--ts-primary-hover);
  --bs-btn-disabled-bg: var(--ts-primary);
  --bs-btn-disabled-border-color: var(--ts-primary);
}

body.admin-mode .form-check-input:checked {
  background-color: var(--ts-primary);
  border-color: var(--ts-primary);
}

body.admin-mode .form-control:focus,
body.admin-mode .form-select:focus,
body.admin-mode .form-check-input:focus {
  border-color: var(--ts-primary);
  box-shadow: 0 0 0 .25rem rgba(228, 18, 222, .18);
}

body.admin-mode .nav-tabs .nav-link {
  color: #3a3a3a;
}

body.admin-mode .nav-tabs .nav-link.active,
body.admin-mode .nav-tabs .nav-link:hover,
body.admin-mode .nav-tabs .nav-link:focus {
  color: var(--ts-primary);
}

body.admin-mode a {
  color: var(--ts-primary);
}

body.admin-mode a:hover,
body.admin-mode a:focus {
  color: var(--ts-primary-hover);
}

.ts-admin-kpi,
.ts-admin-dashboard-card,
.ts-admin-fieldset {
  border: 1px solid #dee2e6;
  border-radius: .75rem;
  background: #fff;
  padding: 1rem;
}

.ts-admin-kpi {
  font-size: clamp(1rem, 1.25vw, 1.2rem);
}

.ts-admin-dashboard-card .table > :not(caption) > * > * {
  padding: .35rem .45rem;
}

.admin-settings-page .tab-content {
  min-height: 0;
}

.ts-admin-fieldset {
  height: 100%;
}

.ts-admin-data-table {
  min-width: 0;
}

.ts-admin-data-table .fixed-table-container,
.ts-admin-data-table .fixed-table-body {
  overflow-x: auto !important;
  overflow-y: visible !important;
  scrollbar-gutter: stable both-edges;
}

.ts-admin-data-table .fixed-table-body::-webkit-scrollbar {
  height: 14px;
}

.ts-admin-data-table .fixed-table-body::-webkit-scrollbar-track {
  background: #e9ecef;
}

.ts-admin-data-table .fixed-table-body::-webkit-scrollbar-thumb {
  background: #6c757d;
  border-radius: 999px;
  border: 3px solid #e9ecef;
}

.ts-admin-data-table .fixed-table-body::-webkit-scrollbar-thumb:hover {
  background: #495057;
}

.ts-admin-data-table .fixed-table-toolbar .btn-secondary:hover,
.ts-admin-data-table .fixed-table-toolbar .btn-secondary:focus {
  background-color: #5c636a;
  border-color: #565e64;
}

.ts-admin-data-table .bi-fullscreen::before,
.ts-admin-data-table .bi-arrows-fullscreen::before { content: "⛶"; }


/* F101BK admin data table corrections */
body.admin-mode .pagination .page-item.active .page-link,
body.admin-mode .bootstrap-table .pagination .page-item.active .page-link {
  background-color: var(--ts-primary) !important;
  border-color: var(--ts-primary) !important;
  color: #fff !important;
}

body.admin-mode .pagination .page-link {
  color: var(--ts-primary);
}

body.admin-mode .pagination .page-link:hover,
body.admin-mode .pagination .page-link:focus {
  color: var(--ts-primary-hover);
}

.ts-admin-data-table .fixed-table-body {
  padding-bottom: 1.1rem;
  scrollbar-gutter: stable both-edges;
}

.ts-admin-data-table .fixed-table-container {
  padding-bottom: .15rem;
}

.ts-admin-data-table .fixed-table-toolbar button[title] {
  cursor: pointer;
}

.ts-admin-data-table .bi::before {
  display: inline-block;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
}

.ts-admin-data-table .bi.bi-arrow-clockwise::before,
.ts-admin-data-table .bi-arrow-clockwise::before { content: "↻"; }
.ts-admin-data-table .bi.bi-fullscreen::before,
.ts-admin-data-table .bi-fullscreen::before { content: "⛶"; }
.ts-admin-data-table .bi.bi-arrows-move::before,
.ts-admin-data-table .bi-arrows-move::before { content: "⛶"; }
.ts-admin-data-table .bi.bi-list-ul::before,
.ts-admin-data-table .bi-list-ul::before { content: "☷"; }
.ts-admin-data-table .bi.bi-download::before,
.ts-admin-data-table .bi-download::before { content: "⇩"; }

/* F101D admin pages / local TinyMCE fallback */
.ts-tinymce-local .ts-tinymce-edit {
  background: #fff;
  color: #212529;
  line-height: 1.5;
}
.ts-tinymce-local .ts-tinymce-toolbar .btn {
  color: #212529;
}

/* F101D editor refinement */
body.admin-pages-page #content {
  overflow-y: auto;
}

body.admin-pages-page .tab-content {
  min-height: 0;
}

body.admin-pages-page .tox-tinymce.ts-tinymce-local,
body.admin-pages-page .tox.tox-tinymce {
  max-height: calc(100vh - 330px);
  min-height: 310px;
  overflow: hidden;
}

body.admin-pages-page .ts-tinymce-edit,
body.admin-pages-page .tox-edit-area {
  height: min(380px, calc(100vh - 470px));
  min-height: 240px;
  max-height: 460px;
  overflow-y: auto;
}

body.admin-pages-page .ts-admin-form-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
}

.ts-tinymce-local .ts-tinymce-menubar span {
  cursor: default;
  user-select: none;
}

.ts-tinymce-local .ts-tinymce-toolbar .btn {
  color: #212529;
  background-color: #fff;
}

/* F101D TinyMCE menu + secondary button correction */
body.admin-mode .btn-secondary,
body.admin-mode .btn-secondary:hover,
body.admin-mode .btn-secondary:focus,
body.admin-mode .btn-secondary:active {
  color: #fff !important;
}

.ts-tinymce-local .ts-tinymce-menubar .dropdown-menu {
  font-size: .925rem;
}

.ts-tinymce-local .ts-tinymce-menubar .dropdown-item {
  cursor: pointer;
}


/* F101E UI refinement: consistent admin primary color and form action layout */
body.admin-mode {
  --bs-primary: var(--ts-primary);
  --bs-primary-rgb: 228,18,222;
  --bs-link-color: var(--ts-primary);
  --bs-link-hover-color: var(--ts-primary-hover);
}

body.admin-mode .btn-primary,
body.admin-mode .btn-primary:hover,
body.admin-mode .btn-primary:focus,
body.admin-mode .btn-primary:active,
body.admin-mode .btn-primary.active,
body.admin-mode .btn-primary:disabled,
body.admin-mode .show > .btn-primary.dropdown-toggle {
  color: #fff !important;
}

body.admin-mode .btn-outline-primary {
  --bs-btn-color: var(--ts-primary);
  --bs-btn-border-color: var(--ts-primary);
  --bs-btn-hover-bg: var(--ts-primary);
  --bs-btn-hover-border-color: var(--ts-primary);
  --bs-btn-active-bg: var(--ts-primary-hover);
  --bs-btn-active-border-color: var(--ts-primary-hover);
  --bs-btn-disabled-color: var(--ts-primary);
}

body.admin-mode .btn-outline-primary:hover,
body.admin-mode .btn-outline-primary:focus,
body.admin-mode .btn-outline-primary:active,
body.admin-mode .btn-outline-primary.active {
  color: #fff !important;
}

body.admin-mode .dropdown-item.active,
body.admin-mode .dropdown-item:active,
body.admin-mode .list-group-item.active,
body.admin-mode .nav-pills .nav-link.active {
  background-color: var(--ts-primary) !important;
  border-color: var(--ts-primary) !important;
  color: #fff !important;
}

body.admin-mode .form-check-input:checked {
  background-color: var(--ts-primary) !important;
  border-color: var(--ts-primary) !important;
}

body.admin-mode .ts-admin-settings-actions,
body.admin-mode .ts-admin-form-actions {
  display: block;
  width: 100%;
  clear: both;
}

body.admin-mode .admin-settings-page .ts-admin-settings-actions {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #dee2e6;
}


/* F101F lean host viewport + autoscale */
body.host-mode {
  height: 100svh;
  min-height: 100svh;
  max-height: 100svh;
  overflow: hidden;
  overscroll-behavior: none;
}

body.host-mode .ts-play-container {
  width: 100%;
  max-width: 1320px;
  height: calc(100svh - 124px);
  margin-top: calc(var(--ts-navbar-height, 57px) + 10px);
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.host-mode .ts-host-info-bar:not(.d-none) + .ts-play-container {
  height: calc(100dvh - 158px);
  margin-top: calc(var(--ts-navbar-height, 57px) + 44px);
}

body.host-mode #app {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#hostScale {
  transform-origin: top center;
  will-change: transform;
}

body.host-mode .ts-host-stage {
  min-height: 0;
  padding-top: 0;
}

body.host-mode .ts-host-center-card,
body.host-mode .ts-host-side-card {
  max-width: none;
}

body.host-mode .ts-host-logo {
  margin: 0 auto 1rem;
}
