:root {
  --bg: #0A0E17;
  --bg-gradient: radial-gradient(circle at 50% 0%, #152238 0%, #0A0E17 65%);
  --surface: #121824;
  --surface-card: #151C2C;
  --surface-hover: #1C263B;
  --surface-active: #23314D;
  --primary: #3B82F6;
  --primary-glow: rgba(59, 130, 246, 0.35);
  --primary-soft: rgba(59, 130, 246, 0.15);
  --orange: #F97316;
  --orange-glow: rgba(249, 115, 22, 0.4);
  --orange-soft: rgba(249, 115, 22, 0.18);
  --green: #10B981;
  --red: #EF4444;
  --text: #F8FAFC;
  --text-dim: #94A3B8;
  --text-muted: #64748B;
  --border: rgba(255, 255, 255, 0.08);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  touch-action: pan-y;
}

#kioskApp {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  max-width: 1100px;
  margin: 0 auto;
  padding: 30px 24px 24px;
  gap: 24px;
  position: relative;
}

/* ---------- Top Hero Timer Widget (Prominent, large, visible from afar) ---------- */
.hero-timer-card {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.4) 0%, rgba(18, 24, 38, 0.95) 100%);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: var(--radius-lg);
  padding: 34px 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 12px 36px -8px rgba(0, 0, 0, 0.6);
  flex: none;
  min-height: 220px;
}

.hero-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hero-label {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #93C5FD;
}

.hero-countdown {
  font-size: 80px;
  font-weight: 900;
  line-height: 1;
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
  letter-spacing: -2px;
  text-shadow: 0 6px 24px rgba(59, 130, 246, 0.55);
  margin: 6px 0;
}

.hero-sub {
  font-size: 21px;
  color: #CBD5E1;
  font-weight: 600;
}

.hero-right-current {
  background: rgba(10, 14, 23, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  padding: 20px 26px;
  min-width: 360px;
  max-width: 480px;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hero-live-clock {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

.current-pair-tag {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
}

.current-subj-title {
  font-size: 20px;
  font-weight: 800;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.current-meta {
  font-size: 15px;
  color: var(--text-dim);
}

/* ---------- Main Middle Content Grid (Reachable lower-middle zone) ---------- */
.main-content-grid {
  display: grid;
  grid-template-columns: 240px 1fr 200px;
  gap: 16px;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

/* ---------- Column 1: Days Navigation (2 Weeks) ---------- */
.days-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.days-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  align-content: start;
}

.day-btn {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.16s ease;
  position: relative;
  min-height: 54px;
}

.day-btn:active {
  transform: scale(0.96);
}

.day-btn-dow {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.day-btn-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.day-btn.is-today .day-btn-dow {
  color: #93C5FD;
}

.day-btn.is-today::after {
  content: "";
  position: absolute;
  bottom: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
}

.day-btn.active {
  background: var(--primary);
  border-color: #60A5FA;
  box-shadow: 0 4px 16px var(--primary-glow);
}

.day-btn.active .day-btn-dow,
.day-btn.active .day-btn-num {
  color: #FFFFFF;
}

.day-btn.has-changes {
  border-color: rgba(249, 115, 22, 0.7);
  background: var(--orange-soft);
}

.day-btn.has-changes .day-btn-dow {
  color: #FDBA74;
}

.day-btn.has-changes .day-btn-num {
  color: #FFEDD5;
}

.day-btn.has-changes::before {
  content: "•";
  position: absolute;
  top: 2px;
  right: 6px;
  font-size: 16px;
  font-weight: 900;
  color: var(--orange);
}

.day-btn.has-changes.active {
  background: var(--orange);
  border-color: #FB923C;
  box-shadow: 0 4px 18px var(--orange-glow);
}

.day-btn.has-changes.active .day-btn-dow,
.day-btn.has-changes.active .day-btn-num {
  color: #FFFFFF;
}

.changes-status-box {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.changes-status-box.active-changes {
  background: var(--orange-soft);
  border-color: rgba(249, 115, 22, 0.6);
  color: #FFEDD5;
}

.changes-status-box.no-changes {
  color: var(--text-muted);
}

/* ---------- Column 2: Center Viewport ---------- */
.center-viewport {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.view-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  animation: fadeIn 0.2s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  flex: none;
}

.view-header-title {
  font-size: 21px;
  font-weight: 800;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 10px;
}

.today-pill {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-glow);
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}

.orange-pill {
  background: var(--orange-soft);
  color: var(--orange);
  border: 1px solid var(--orange-glow);
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}

.schedule-scroll-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}

/* Changes Card Section (Exact style from bot) */
.changes-section-banner {
  background: rgba(249, 115, 22, 0.08);
  border: 1px solid rgba(249, 115, 22, 0.35);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 6px;
}

.changes-section-title {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #FB923C;
  display: flex;
  align-items: center;
  gap: 6px;
}

.change-card {
  background: var(--surface-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 4px solid var(--orange);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.change-card.del {
  border-left-color: var(--red);
}

.change-card.add {
  border-left-color: var(--green);
}

.change-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.change-pair-num {
  font-size: 15px;
  font-weight: 800;
  color: #FFFFFF;
}

.change-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-hover);
  color: #CBD5E1;
}

.change-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14.5px;
  line-height: 1.4;
}

.change-icon {
  font-size: 16px;
  flex: none;
}

.old-val {
  color: var(--text-muted);
  text-decoration: line-through;
}

.new-val {
  color: #FFFFFF;
  font-weight: 700;
}

.arrow {
  color: var(--orange);
  font-weight: 700;
  margin: 0 4px;
}

/* Pair lesson card */
.lesson-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: all 0.18s ease;
}

.lesson-card.is-current {
  border-color: var(--primary);
  box-shadow: 0 4px 20px var(--primary-glow);
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.15) 0%, var(--surface-card) 100%);
}

.lesson-num-badge {
  width: 44px;
  height: 44px;
  background: var(--surface-hover);
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 21px;
  font-weight: 900;
  color: var(--primary);
  flex: none;
}

.lesson-card.is-current .lesson-num-badge {
  background: var(--primary);
  color: #FFFFFF;
}

.lesson-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lesson-time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lesson-time {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.lesson-status-badge {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--primary);
}

.lesson-subj-title {
  font-size: 18px;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.3;
}

.lesson-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.info-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: #CBD5E1;
}

.empty-schedule {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text-dim);
}

.empty-icon {
  font-size: 46px;
}

/* ---------- Group Picker in Center ---------- */
.group-picker-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.picker-search-bar {
  display: flex;
  align-items: center;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 12px;
  flex: none;
}

.picker-search-input {
  background: transparent;
  border: none;
  outline: none;
  color: #FFFFFF;
  font-size: 17px;
  width: 100%;
}

.picker-section-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin: 10px 0 6px;
}

.picker-grid-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.tg-btn-grid {
  display: grid;
  gap: 8px;
}

.tg-btn-grid.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.tg-btn-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.tg-btn {
  background: linear-gradient(180deg, #1E2D3B 0%, #16222E 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: #E2E8F0;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tg-btn:active {
  background: var(--primary);
  color: #FFFFFF;
  transform: scale(0.97);
}

.tg-btn.category {
  background: linear-gradient(180deg, #1F364D 0%, #172A3C 100%);
  border-color: rgba(59, 130, 246, 0.35);
  color: #93C5FD;
}

.tg-btn.category:active {
  background: var(--primary);
  color: #FFFFFF;
}

.tg-btn.back {
  background: #2D3748;
  color: #F1F5F9;
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 16px;
}

/* ---------- Column 3: Action Panel (Clean, centered vertically with schedule) ---------- */
.action-panel {
  display: flex;
  flex-direction: column;
  justify-content: center; /* Exactly at hand reach alongside the schedule cards */
  gap: 16px;
}

.group-big-button {
  background: var(--primary);
  border: none;
  border-radius: var(--radius-lg);
  padding: 30px 14px;
  color: #FFFFFF;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 24px var(--primary-glow);
  transition: all 0.16s ease;
  width: 100%;
}

.group-big-button:active {
  transform: scale(0.96);
}

.btn-group-name {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.btn-group-hint {
  font-size: 14px;
  font-weight: 700;
  opacity: 0.95;
}

.inactivity-tracker {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inactivity-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--surface-hover);
  border-radius: 2px;
  overflow: hidden;
}

.inactivity-progress-fill {
  height: 100%;
  background: var(--primary);
  width: 100%;
  transition: width 1s linear;
}

/* ---------- Bottom QR Codes Section ---------- */
.kiosk-footer-qrs {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  flex: none;
}

.qr-card-item {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.qr-image-wrapper {
  width: 88px;
  height: 88px;
  background: #FFFFFF;
  border-radius: 12px;
  padding: 6px;
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.qr-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-title-only {
  font-size: 18px;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.25;
}

/* ---------- Changes Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

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

.modal-content-card {
  background: var(--surface);
  border: 1px solid rgba(249, 115, 22, 0.4);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 20px;
  font-weight: 800;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: var(--surface-card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.modal-scroll-body {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
