:root {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #1e293b;
  --border: rgba(148, 163, 184, 0.18);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #34d399;
  --accent-2: #38bdf8;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: radial-gradient(circle at top right, #064e3b 0%, var(--bg) 48%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", sans-serif;
  min-height: 100dvh;
}
.hidden { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(11, 17, 32, 0.9); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border); padding: 12px 18px;
}
.topbar-main { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.brand-block { display: flex; align-items: center; gap: 10px; }
.brand-icon { font-size: 28px; line-height: 1; }
.brand-block h1 { margin: 0; font-size: 1.15rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.ver-tag { font-size: 0.72rem; color: var(--accent); background: rgba(52, 211, 153, 0.15); padding: 2px 7px; border-radius: 999px; }
.subtitle { margin: 2px 0 0; font-size: 0.78rem; color: var(--muted); }
.topbar-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.select-input, .search-input {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; min-height: 40px; font-size: 0.9rem;
}
.search-row { display: flex; gap: 8px; margin-top: 10px; }
.search-input { flex: 1; }

.btn-ghost, .btn-primary, .btn-sm, .tab-btn {
  cursor: pointer; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 0.85rem;
  padding: 8px 12px; min-height: 40px;
}
.btn-primary { background: linear-gradient(135deg, #059669, #0284c7); border-color: transparent; font-weight: 600; }
.btn-sm { min-height: 34px; padding: 5px 10px; font-size: 0.8rem; }
.btn-summary { background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.45); color: #a7f3d0; font-weight: 600; }
.filters-panel { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.track-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab-btn.active { background: rgba(52, 211, 153, 0.2); border-color: var(--accent); color: #d1fae5; font-weight: 600; }
.status-strip { margin-top: 8px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 0.78rem; color: var(--muted); }

.collapsed-summary {
  position: sticky; top: 0; z-index: 35; height: 44px;
  display: flex; align-items: center; justify-content: space-between; padding: 0 14px;
  background: rgba(15, 23, 42, 0.94); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.collapsed-left, .collapsed-actions { display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.badge-pill { background: rgba(56, 189, 248, 0.16); color: #bae6fd; border: 1px solid rgba(56, 189, 248, 0.35); padding: 2px 8px; border-radius: 999px; font-size: 0.74rem; }

.main-stage { display: flex; gap: 16px; padding: 16px 18px 80px; align-items: flex-start; }
.cards-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
@media (min-width: 1400px) { .cards-grid { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); } }

.school-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: transform 0.15s ease, border-color 0.15s ease;
}
.school-card:hover { transform: translateY(-2px); border-color: rgba(52, 211, 153, 0.5); }
.card-thumb-wrap { position: relative; aspect-ratio: 16 / 9; background: #0f172a; overflow: hidden; cursor: pointer; }
.card-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.85rem; padding: 12px; text-align: center; }

.source-badge { position: absolute; top: 8px; left: 8px; font-size: 0.72rem; padding: 3px 8px; border-radius: 999px; backdrop-filter: blur(8px); }
.source-ego { background: rgba(16, 185, 129, 0.88); color: #052e16; font-weight: 700; }
.source-api { background: rgba(30, 41, 59, 0.88); color: #e2e8f0; border: 1px solid var(--border); }
.level-badge { position: absolute; top: 8px; right: 8px; background: rgba(15, 23, 42, 0.9); color: var(--accent-2); border: 1px solid rgba(56, 189, 248, 0.45); font-size: 0.75rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; }

.card-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-title { margin: 0; font-size: 1rem; font-weight: 700; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.76rem; color: var(--muted); }
.card-summary { margin: 0; font-size: 0.86rem; line-height: 1.45; color: #cbd5e1; }
.notice-preview { margin: 0; padding-left: 16px; font-size: 0.8rem; color: #93c5fd; display: flex; flex-direction: column; gap: 3px; }
.card-actions { margin-top: auto; padding-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }

.desktop-inspector { width: 380px; flex-shrink: 0; position: sticky; top: 72px; max-height: calc(100dvh - 90px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.inspector-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 700; }

.app-dialog { width: min(600px, 94vw); max-height: 90vh; max-height: 90dvh; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 16px; padding: 0; overflow: hidden; }
.app-dialog[open] { display: flex; flex-direction: column; }
.app-dialog::backdrop { background: rgba(2, 6, 23, 0.72); backdrop-filter: blur(4px); }
.dialog-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.dialog-header h2 { margin: 0; font-size: 1rem; }
.dialog-body { padding: 14px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-actions { position: sticky; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--border); padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 12px)); display: flex; justify-content: flex-end; gap: 8px; }

.sheet-backdrop { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.68); z-index: 45; }
.detail-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--surface); border-top: 1px solid var(--border); border-radius: 18px 18px 0 0; max-height: 90vh; max-height: 90dvh; display: flex; flex-direction: column; animation: slideUpSheet 0.2s ease-out; }
@keyframes slideUpSheet { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { width: 42px; height: 4px; border-radius: 999px; background: var(--muted); margin: 8px auto; }
.sheet-body { padding: 8px 16px 14px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

body.zen-fullscreen .topbar, body.zen-fullscreen .collapsed-summary, body.zen-fullscreen .desktop-inspector { display: none !important; }
body.zen-fullscreen .main-stage { width: 100vw; min-height: 100vh; padding: 16px; }
.floating-exit-zen { position: fixed; top: 12px; right: 12px; z-index: 60; background: rgba(15, 23, 42, 0.78); backdrop-filter: blur(10px); color: #fff; border: 1px solid var(--accent); border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.toast { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: #0f172a; color: #fff; border: 1px solid var(--accent); padding: 10px 16px; border-radius: 999px; z-index: 80; font-size: 0.85rem; }

.summary-section { margin-bottom: 14px; }
.summary-section h4 { margin: 0 0 6px; font-size: 0.92rem; color: var(--accent); }
.summary-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; line-height: 1.45; }
.summary-link { color: #93c5fd; text-decoration: none; }
.summary-link:hover { text-decoration: underline; }
.whatsnew-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.whatsnew-card { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 0.85rem; }
.muted { color: var(--muted); font-size: 0.84rem; }
.mobile-only { display: none; }
.admin-auth-box { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 768px) {
  .mobile-only { display: inline-flex; align-items: center; }
  .desktop-inspector { display: none !important; }
  .btn-ghost, .btn-primary, .tab-btn { min-height: 44px; }
  .filters-panel.mobile-collapsed { display: none; }
}
