/* ===== LiveTiming - Main Stylesheet ===== */
/* Semua style untuk komponen card, layout, dan responsive ada di sini.
   Jika perlu perubahan style, cukup edit file ini saja. */

/* ===== BASE ===== */
body {
  font-family: 'JetBrains Mono', monospace;
}

/* ===== ANIMATIONS ===== */
@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.animate-blink {
  animation: blink 1.5s infinite;
}

/* ===== UTILITIES ===== */
/* Hide scrollbar but keep scroll */
.hide-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

/* ===== RESPONSIVE GRID SYSTEM ===== */
/* Landscape: 2-column side-by-side, fixed height, no scroll */
@media (orientation: landscape) {
  body {
    overflow: hidden;
    height: 100vh;
    max-height: 100vh;
    padding: clamp(0.2rem, 0.4vh, 0.5rem);
  }

  header {
    padding: clamp(0.3rem, 0.7vh, 0.75rem) clamp(0.5rem, 1vw, 0.75rem);
    margin-bottom: clamp(0.2rem, 0.4vh, 0.5rem);
  }

  .main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(0.3rem, 0.6vh, 0.75rem);
    flex: 1;
    min-height: 0;
  }

  .lane-section {
    display: flex;
    flex-direction: column;
    gap: clamp(0.2rem, 0.4vh, 0.5rem);
    height: 100%;
    min-height: 0;
  }

  .main-grid .staging-card {
    height: clamp(40px, 10vh, 50px);
    padding: clamp(0.2rem, 0.4vh, 0.4rem);
    flex-shrink: 0;
  }

  .main-grid .result-card {
    height: auto;
    min-height: 0;
    padding: clamp(0.25rem, 0.5vh, 0.5rem);
    flex-shrink: 0;
  }

  .main-grid .ranking-card {
    flex: 1;
    padding: clamp(0.25rem, 0.5vh, 0.5rem);
    min-height: 0;
  }

  .footer-controls {
    flex-direction: row;
    flex-wrap: nowrap;
    margin-top: clamp(0.2rem, 0.4vh, 0.5rem);
    padding: clamp(0.2rem, 0.4vh, 0.5rem) clamp(0.3rem, 0.5vw, 0.5rem);
  }

  .footer-lane {
    flex-direction: row;
    flex-wrap: nowrap;
  }

  .footer-lane input {
    width: clamp(1.5rem, 4vw, 2rem);
    padding: clamp(0.1rem, 0.2vh, 0.25rem) clamp(0.15rem, 0.3vw, 0.25rem);
  }

  .footer-lane button {
    padding: clamp(0.1rem, 0.2vh, 0.25rem) clamp(0.2rem, 0.4vw, 0.375rem);
  }

  /* === Flexible font sizing based on viewport height === */
  /* Staging card */
  .main-grid .staging-card [id^="grid-num-"] {
    font-size: clamp(1.2rem, 4vh, 1.2rem) !important;
  }

  .main-grid .staging-card [id^="grid-name-"] {
    font-size: clamp(0.8rem, 2vh, 1rem) !important;
  }

  .main-grid .staging-card [id^="grid-team-"] {
    font-size: clamp(0.6rem, 1.4vh, 0.75rem) !important;
  }

  .main-grid .staging-card [id^="grid-badge-"] {
    font-size: clamp(0.6rem, 1.4vh, 0.75rem) !important;
  }

  /* Result card - main timer */
  .main-grid .result-card [id^="time-"] {
    font-size: clamp(2.2rem, 4.5vh, 3rem) !important;
  }

  .main-grid .result-card [id^="speed-container-"] {
    font-size: clamp(0.85rem, 2.5vh, 1.5rem) !important;
  }

  .main-grid .result-card [id^="finish-num-"] {
    font-size: clamp(0.8rem, 2.5vh, 1rem) !important;
  }

  .main-grid .result-card [id^="finish-name-"] {
    font-size: clamp(0.8rem, 2.5vh, 1rem) !important;
  }

  .main-grid .result-card [id^="finish-team-"] {
    font-size: clamp(0.7rem, 1.6vh, 0.8rem) !important;
  }

  .main-grid .result-card [id^="result-badge-"] {
    font-size: clamp(0.6rem, 1.5vh, 0.75rem) !important;
  }

  /* Ranking table */
  .ranking-card table {
    font-size: clamp(0.8rem, 2.8vh, 0.95rem) !important;
  }

  .ranking-card thead tr {
    font-size: clamp(0.8rem, 2.55vh, 0.95rem) !important;
  }

  .ranking-card table tbody td div.text-\[17px\] {
    font-size: clamp(1.1rem, 2.6vh, 1.3rem) !important;
  }

  .ranking-card table tbody td div.text-\[15px\] {
    font-size: clamp(0.95rem, 2.2vh, 1.1rem) !important;
  }

  .ranking-card table tbody td div.text-\[13px\] {
    font-size: clamp(0.8rem, 1.8vh, 0.95rem) !important;
  }

  /* Header */
  header h1 {
    font-size: clamp(0.7rem, 1.6vh, 0.9rem) !important;
  }

  header #clock {
    font-size: clamp(0.65rem, 1.4vh, 0.8rem) !important;
  }

  header img {
    height: clamp(1.2rem, 3.5vh, 2rem) !important;
  }

  /* Footer controls */
  .footer-controls {
    font-size: clamp(0.55rem, 1.2vh, 0.7rem) !important;
  }

  .footer-lane input {
    font-size: clamp(0.55rem, 1.2vh, 0.7rem) !important;
  }

  .footer-lane button {
    font-size: clamp(0.55rem, 1.2vh, 0.7rem) !important;
  }

  .footer-lane span {
    font-size: clamp(0.55rem, 1.2vh, 0.7rem) !important;
  }
}

/* Portrait: stacked vertically, scrollable */
@media (orientation: portrait) {
  body {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .main-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: none;
  }

  .lane-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .main-grid .staging-card {
    height: auto;
    min-height: 60px;
  }

  .main-grid .result-card {
    height: auto;
    min-height: 0;
  }

  .main-grid .result-card [id^="time-"] {
    font-size: clamp(1.5rem, 4.5vh, 3rem) !important;
  }

  .main-grid .result-card [id^="speed-container-"] {
    font-size: clamp(1rem, 2.8vh, 1.25rem) !important;
  }

  .main-grid .result-card [id^="finish-num-"] {
    font-size: clamp(1rem, 2.8vh, 1.25rem) !important;
  }

  .main-grid .result-card [id^="finish-name-"] {
    font-size: clamp(0.9rem, 2.5vh, 1.1rem) !important;
  }

  .main-grid .result-card [id^="finish-team-"] {
    font-size: clamp(0.7rem, 1.6vh, 0.8rem) !important;
  }

  .main-grid .ranking-card {
    height: auto;
    min-height: 200px;
    max-height: 300px;
  }

  .footer-controls {
    flex-direction: column;
    gap: 0.5rem !important;
  }

  .footer-lane {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px !important;
  }

  .footer-lane input {
    width: 60px !important;
  }
}