/* Сканер QR-билетов MEGAGEN — тёмная тема (iPhone, портрет) */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #0d1117; color: #e6edf3;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}
#app { max-width: 560px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.hidden { display: none !important; }

/* --- вход --- */
.login-box { margin: auto; padding: 32px 24px; width: 100%; max-width: 380px; text-align: center; }
.logo { width: 220px; max-width: 70%; margin-bottom: 12px; }
h1 { font-size: 22px; font-weight: 600; color: #e6edf3; margin-bottom: 24px; }
input {
  width: 100%; height: 50px; border-radius: 10px; border: 1px solid #30363d;
  background: #161b22; color: #e6edf3; font-size: 17px; padding: 0 14px; margin-bottom: 12px;
}
input:focus { outline: none; border-color: #0066cc; }

/* --- кнопки --- */
.btn {
  min-height: 48px; min-width: 48px; padding: 10px 18px; border-radius: 10px; border: none;
  font-size: 17px; font-weight: 600; cursor: pointer; color: #e6edf3; background: #21262d;
}
.btn-primary { background: #0066cc; color: #fff; }
.btn-primary:active { background: #004d99; }
.btn-warn { background: #b3451c; color: #fff; }
.btn-ghost { background: transparent; border: 1px solid #30363d; color: #8b949e; }
.btn-sm { min-height: 44px; font-size: 14px; padding: 8px 12px; }
.btn-block { width: 100%; }
button:disabled { opacity: .5; }

/* --- сообщения --- */
.msg { border-radius: 10px; padding: 12px 14px; font-size: 15px; margin-top: 12px; line-height: 1.4; }
.msg-error { background: rgba(239, 68, 68, .15); color: #f87171; }
.msg-warn { background: rgba(245, 158, 11, .15); color: #fbbf24; }
.msg-ok { background: rgba(34, 197, 94, .15); color: #4ade80; }

/* --- шапки --- */
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid #21262d; position: sticky; top: 0; background: #0d1117; z-index: 5;
}
.logo-sm { height: 28px; width: auto; }
.topbar-name { flex: 1; font-size: 15px; color: #8b949e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-wrap { padding: 16px; padding-bottom: 40px; }
.schedule-wrap h2 { font-size: 18px; margin-bottom: 14px; }
.day-title { font-size: 15px; color: #8b949e; margin: 18px 0 8px; font-weight: 600; }

.course-card {
  background: #161b22; border: 1px solid #30363d; border-radius: 12px;
  padding: 14px; margin-bottom: 10px; cursor: pointer;
}
.course-card:active { border-color: #0066cc; }
.course-time { font-size: 13px; color: #58a6ff; font-weight: 600; margin-bottom: 4px; }
.course-title-text { font-size: 16px; font-weight: 600; line-height: 1.3; margin-bottom: 6px; }
.course-lecturer { font-size: 13px; color: #8b949e; margin-bottom: 8px; }
.course-counter { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #e6edf3; }
.badge-full {
  background: #f59e0b; color: #1a1000; font-size: 12px; font-weight: 700;
  border-radius: 6px; padding: 2px 8px;
}

/* --- экран сканирования --- */
.scan-header {
  display: flex; flex-direction: column; gap: 6px; padding: 12px 16px;
  border-bottom: 1px solid #21262d; position: sticky; top: 0; background: #0d1117; z-index: 5;
}
.scan-header .row { display: flex; gap: 8px; align-items: flex-start; }
.scan-header .row .btn { margin-left: auto; }
.scan-header .row .btn + .btn { margin-left: 8px; }
.scan-title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.scan-info { font-size: 13px; color: #8b949e; }
.scan-counters { font-size: 14px; color: #58a6ff; font-weight: 600; }

#reader-wrap { position: relative; background: #000; min-height: 300px; }
#qr-reader { width: 100%; }
#qr-reader video { width: 100% !important; height: auto !important; display: block; }
.scan-frame {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 62%; max-width: 280px; aspect-ratio: 1; border-radius: 14px;
  border: 3px solid rgba(255, 255, 255, .9); pointer-events: none;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, .35);
}
.scan-line {
  position: absolute; left: 6px; right: 6px; top: 40%; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, transparent, #0066cc, transparent);
  animation: scanline 2s ease-in-out infinite;
}
@keyframes scanline { 0% { top: 8%; } 50% { top: 88%; } 100% { top: 8%; } }

/* --- результат --- */
.result-overlay {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 24px;
  background: #0d1117;
}
.result-overlay.ok { background: #07240f; border-top: 8px solid #22c55e; }
.result-overlay.err { background: #2a0d0d; border-top: 8px solid #ef4444; }
.result-overlay.warn { background: #2a2006; border-top: 8px solid #f59e0b; }
.result-overlay.overlimit { background: #2a2006; border: 10px solid #f59e0b; }
.result-icon { font-size: 64px; margin-bottom: 16px; }
.result-title { font-size: 26px; font-weight: 800; margin-bottom: 12px; letter-spacing: .5px; }
.result-overlay.ok .result-title { color: #22c55e; }
.result-overlay.err .result-title { color: #ef4444; }
.result-overlay.warn .result-title { color: #f59e0b; }
.result-name { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.result-sub { font-size: 15px; color: #c9d1d9; line-height: 1.5; margin-bottom: 4px; }
.result-overnum {
  font-size: 56px; font-weight: 900; margin: 16px 0;
  background: linear-gradient(180deg, #f59e0b, #ef4444);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.result-actions { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 340px; }
.result-actions .btn { width: 100%; }
.result-courses { text-align: left; background: rgba(255,255,255,.06); border-radius: 10px; padding: 12px; margin-top: 10px; width: 100%; }
.result-courses .rc-line { padding: 6px 0; font-size: 14px; color: #c9d1d9; border-bottom: 1px solid rgba(255,255,255,.08); }
.result-courses .rc-line:last-child { border-bottom: none; }

/* --- вкладки --- */
.tabs-block { background: #0d1117; padding: 10px 16px 30px; }
.tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.tab {
  flex: 1; min-height: 44px; border-radius: 10px; border: 1px solid #30363d;
  background: #161b22; color: #8b949e; font-size: 15px; font-weight: 600; cursor: pointer;
}
.tab.active { background: #0066cc; color: #fff; border-color: #0066cc; }
.list-line {
  display: flex; justify-content: space-between; gap: 10px; padding: 9px 2px;
  border-bottom: 1px solid #21262d; font-size: 15px;
}
.list-line .l-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-line .l-time { color: #4ade80; white-space: nowrap; font-weight: 600; }
.list-line .l-act { color: #58a6ff; white-space: nowrap; }
.search-row { display: flex; gap: 8px; margin-bottom: 8px; }
.search-row input { flex: 1; margin-bottom: 0; }
.search-empty { color: #8b949e; font-size: 14px; padding: 12px 0; text-align: center; }
#tab-content { max-height: 42vh; overflow-y: auto; }