:root, [data-theme="light"] {
  /* Official Blue Light Theme (Default) */
  --bg-app: #f0f4f9;
  --bg-topbar: linear-gradient(90deg, #0d3880 0%, #154c9e 60%, #1b5cb8 100%);
  --bg-sidebar: #ffffff;
  --bg-sidebar-header: #e8f1fb;
  --bg-sidebar-hover: #f2f7fd;
  --bg-input: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f2f7fd;
  --bg-card-active: #e6f0fa;
  --bg-viewer: #e9f0f8;
  --bg-viewer-bar: #ffffff;
  --bg-subtoolbar: #f8fbfe;
  --bg-pdf-viewport: #d6e2ef;
  --bg-sidebar-panel: #ffffff;
  --bg-sidebar-header-panel: #e8f1fb;
  --bg-thumbnail-card: #f8fbfe;
  --bg-thumbnail-card-hover: #e6f0fa;
  --bg-placeholder: #dce7f3;
  --bg-btn: #ffffff;
  --bg-btn-hover: #edf4fc;
  --bg-btn-active: #154c9e;

  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #7e8e9f;
  --text-heading: #0a2540;

  --border-color: #c9dcf0;
  --border-light: #deebf7;
  --border-active: #154c9e;

  --accent-blue: #154c9e;
  --accent-cyan: #0284c7;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --pdf-page-shadow: 0 10px 32px rgba(13, 56, 128, 0.16), 0 2px 8px rgba(0, 0, 0, 0.07);
  --resizer-bg: #b8cee5;
  --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
}

[data-theme="dark"] {
  /* Modern Deep Dark Theme */
  --bg-app: #0b0f19;
  --bg-topbar: #101726;
  --bg-sidebar: #131b2e;
  --bg-sidebar-header: rgba(11, 15, 25, 0.6);
  --bg-sidebar-hover: #1e293b;
  --bg-input: #0b0f19;
  --bg-card: #162035;
  --bg-card-hover: #1e293b;
  --bg-card-active: rgba(37, 99, 235, 0.2);
  --bg-viewer: #070a10;
  --bg-viewer-bar: #131b2e;
  --bg-subtoolbar: #0f172a;
  --bg-pdf-viewport: #0b0f19;
  --bg-sidebar-panel: #0f172a;
  --bg-sidebar-header-panel: #1e293b;
  --bg-thumbnail-card: #1e293b;
  --bg-thumbnail-card-hover: #273549;
  --bg-placeholder: #1e293b;
  --bg-btn: #0b0f19;
  --bg-btn-hover: #1e293b;
  --bg-btn-active: #2563eb;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-heading: #ffffff;

  --border-color: #243048;
  --border-light: rgba(255, 255, 255, 0.08);
  --border-active: #3b82f6;

  --accent-blue: #3b82f6;
  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --pdf-page-shadow: 0 12px 40px rgba(0, 0, 0, 0.75), 0 3px 12px rgba(0, 0, 0, 0.5);
  --resizer-bg: rgba(255, 255, 255, 0.06);
}

/* 1. Global Portal Header */
.global-portal-header {
  height: 54px;
  width: 100vw;
  background: var(--bg-topbar, linear-gradient(90deg, #0d3880 0%, #154c9e 60%, #1b5cb8 100%));
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 14px;
  color: #ffffff;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

[data-theme="dark"] .global-portal-header {
  background: #101726;
  border-bottom: 1px solid #243048;
}

.gnb-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.gnb-logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gnb-brand-emblem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  color: #0d3880;
  padding: 3px 10px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  user-select: none;
}

[data-theme="dark"] .gnb-brand-emblem {
  background: #1e293b;
  border: 1px solid #334155;
  color: #ffffff;
}

.emblem-name {
  font-size: 0.94rem;
  font-weight: 900;
  letter-spacing: -0.4px;
}

.gnb-main-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.15;
  color: #ffffff;
}

.gnb-feature-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.gnb-chip {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #ffffff;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 0.81rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

[data-theme="dark"] .gnb-chip {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  color: #93c5fd;
}

.gnb-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gnb-live-status {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.15);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
}

[data-theme="dark"] .gnb-live-status {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

.live-pulse-dot {
  width: 7px;
  height: 7px;
  background-color: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 8px #22c55e;
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s, color 0.2s;
}

#app-container {
  display: flex;
  flex: 1;
  height: calc(100vh - 54px);
  width: 100vw;
  overflow: hidden;
}

/* Sidebar */
#sidebar {
  width: 380px;
  min-width: 330px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 10;
  transition: background-color 0.2s, border-color 0.2s;
}

/* Theme Toggle Switch UI */
.theme-switch-wrapper {
  display: flex;
  align-items: center;
  gap: 7px;
  user-select: none;
}

.theme-switch-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.2px;
}

[data-theme="light"] .theme-switch-label {
  color: #ffffff;
}

[data-theme="dark"] .theme-switch-label {
  color: #94a3b8;
}

.theme-switch-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  outline: none;
}

.theme-switch-track {
  position: relative;
  width: 48px;
  height: 24px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .theme-switch-track {
  background: #1e293b;
  border-color: #3b82f6;
}

.theme-switch-icon {
  font-size: 0.68rem;
  line-height: 1;
  z-index: 1;
  opacity: 0.9;
  pointer-events: none;
}

.theme-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .theme-switch-thumb {
  transform: translateX(24px);
  background: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.7);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
}

.developer-credit {
  font-size: 0.7rem;
  color: #a5b4fc;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 1px 7px;
  border-radius: 4px;
}

[data-theme="light"] .brand-badge {
  background: #154c9e;
  color: #ffffff;
  border-color: #154c9e;
}

[data-theme="light"] .sidebar-header {
  background: #eaf2fb;
  border-bottom: 2px solid #c9dcf0;
}

[data-theme="light"] .univ-type-selector {
  background: #e1edf9;
  border-bottom: 1px solid #c9dcf0;
}

[data-theme="light"] .univ-type-btn.active {
  background: #154c9e;
  color: #ffffff;
  border-color: #154c9e;
}

[data-theme="light"] .univ-type-btn.active .type-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

[data-theme="light"] .univ-card.active {
  border-left: 4px solid #154c9e;
  background: #e8f2fc;
  border-color: #b8d4f4;
}

[data-theme="light"] .brochure-tab-btn {
  background: #e2edf8;
  border: 1px solid #bcd6f1;
  color: #334155;
  border-radius: 6px 6px 0 0;
  font-weight: 600;
}

[data-theme="light"] .brochure-tab-btn:hover {
  background: #d4e5f7;
  color: #0d3880;
}

[data-theme="light"] .brochure-tab-btn.active {
  background: #154c9e;
  color: #ffffff;
  border-color: #154c9e;
  box-shadow: 0 2px 8px rgba(21, 76, 158, 0.3);
}

[data-theme="light"] .brochure-tab-btn.disabled {
  opacity: 0.45;
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #94a3b8;
}

[data-theme="light"] .viewer-header {
  background: #ffffff;
  border-bottom: 2px solid #154c9e;
}

[data-theme="dark"] .univ-card.active {
  border-left: 4px solid #3b82f6;
  background: #1e3a8a;
  border-color: #3b82f6;
}

[data-theme="dark"] .brochure-tab-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  border-radius: 6px 6px 0 0;
  font-weight: 600;
}

[data-theme="dark"] .brochure-tab-btn:hover {
  background: #273549;
  color: #ffffff;
}

[data-theme="dark"] .brochure-tab-btn.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

[data-theme="dark"] .brochure-tab-btn.disabled {
  opacity: 0.35;
  background: #111827;
  border-color: #1f2937;
  color: #4b5563;
}

[data-theme="dark"] .viewer-header {
  background: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.app-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.3px;
  line-height: 1.25;
}

.app-subtitle {
  font-size: 0.74rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* University Type Selector (Segmented Control Pill Tabs) */
.univ-type-selector {
  display: flex;
  background: #e2edf8;
  padding: 3px;
  border-radius: 8px;
  margin: 7px 10px 6px 10px;
  border: 1px solid #c9dcf0;
  gap: 3px;
  transition: background-color 0.2s, border-color 0.2s;
}

[data-theme="dark"] .univ-type-selector {
  background: #0f172a;
  border-color: #334155;
  margin: 7px 10px 6px 10px;
}

.univ-type-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: #475569;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.univ-type-btn:hover {
  color: #154c9e;
  background: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .univ-type-btn {
  color: #94a3b8;
}

[data-theme="dark"] .univ-type-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.univ-type-btn.active {
  background: #ffffff;
  color: #154c9e;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(21, 76, 158, 0.16), 0 1px 2px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .univ-type-btn.active {
  background: #1e293b;
  color: #38bdf8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.type-badge {
  background: rgba(21, 76, 158, 0.1);
  color: #154c9e;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  transition: all 0.18s;
}

.univ-type-btn.active .type-badge {
  background: #154c9e;
  color: #ffffff;
}

[data-theme="dark"] .type-badge {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

[data-theme="dark"] .univ-type-btn.active .type-badge {
  background: #3b82f6;
  color: #ffffff;
}

/* Search & Region Filter Row (Single Row) */
.search-filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
}

.search-input-box {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 9px;
  color: var(--text-muted);
  font-size: 0.8rem;
  pointer-events: none;
}

#univ-search-input {
  width: 100%;
  padding: 6px 26px 6px 28px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s, background-color 0.2s;
}

#univ-search-input:focus {
  border-color: var(--accent-blue);
}

.search-clear-btn {
  position: absolute;
  right: 7px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  display: none;
}

.region-select {
  flex: 0 0 82px;
  width: 82px;
  padding: 6px 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.78rem;
  outline: none;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.2s, border-color 0.2s;
}

.region-select:focus {
  border-color: var(--accent-blue);
}

.fav-filter-btn {
  flex: 0 0 32px;
  width: 32px;
  height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.fav-filter-btn:hover {
  background: var(--bg-sidebar-hover);
  border-color: rgba(234, 179, 8, 0.4);
  color: #eab308;
}

.fav-filter-btn.active {
  background: rgba(234, 179, 8, 0.18);
  border-color: #eab308;
  color: #eab308;
  box-shadow: 0 0 8px rgba(234, 179, 8, 0.35);
}

/* University List Container */
.univ-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px 24px 8px;
  background: var(--bg-sidebar);
  scrollbar-width: thin;
}

.univ-list-container::-webkit-scrollbar {
  width: 5px;
}
.univ-list-container::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

/* Sidebar Bottom Footer */
.sidebar-footer {
  padding: 7px 12px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  user-select: none;
}

.sidebar-feedback-btn {
  background: rgba(21, 76, 158, 0.05);
  border: 1px solid rgba(21, 76, 158, 0.14);
  color: #154c9e;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 7px;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
}

.sidebar-feedback-btn:hover {
  background: #154c9e;
  color: #ffffff;
  border-color: #154c9e;
  text-decoration: none;
}

[data-theme="dark"] .sidebar-feedback-btn {
  background: rgba(96, 165, 250, 0.1);
  border-color: rgba(96, 165, 250, 0.2);
  color: #93c5fd;
}

[data-theme="dark"] .sidebar-feedback-btn:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

/* Korean Initial Consonant Section Header */
.univ-section-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 6px 0;
  padding: 3px 4px;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-sidebar);
}

.section-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: #154c9e;
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 800;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(21, 76, 158, 0.25);
  flex-shrink: 0;
}

[data-theme="dark"] .section-initial {
  background: #3b82f6;
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.4);
}

.section-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, #c9dcf0 0%, rgba(201, 220, 240, 0.1) 100%);
}

[data-theme="dark"] .section-line {
  background: linear-gradient(90deg, #243048 0%, rgba(36, 48, 72, 0.1) 100%);
}

/* Seamless University Card (Option 2) */
.univ-card {
  padding: 8px 10px;
  margin-bottom: 2px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.univ-card:hover {
  background: var(--bg-sidebar-hover);
  border-color: var(--border-light);
}

.univ-card.active {
  background: var(--bg-card-active) !important;
  border: 1px solid var(--border-active) !important;
  border-left: 4px solid var(--accent-blue) !important;
}

[data-theme="dark"] .univ-card.active {
  background: #1e3a8a !important;
  border: 1px solid #3b82f6 !important;
  border-left: 4px solid #3b82f6 !important;
}

.univ-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.univ-left-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.univ-region-badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 1px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  min-width: 28px;
  text-align: center;
}

[data-theme="light"] .univ-region-badge {
  color: #0284c7;
  background: rgba(2, 132, 199, 0.1);
  border-color: rgba(2, 132, 199, 0.25);
}

.univ-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}

.univ-card.active .univ-name {
  color: var(--accent-blue);
}

.univ-right-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.special-badge-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.univ-chip {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: -0.2px;
  line-height: 1.25;
  user-select: none;
}

.chip-essay {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

[data-theme="dark"] .chip-essay {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.4);
}

.chip-jungsi {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

[data-theme="dark"] .chip-jungsi {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

.card-fav-btn {
  background: none;
  border: none;
  font-size: 1.05rem;
  color: #94a3b8;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: transform 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-fav-btn:hover {
  color: #f59e0b;
  transform: scale(1.25);
}

.card-fav-btn.is-fav {
  color: #f59e0b;
  font-size: 1.08rem;
  filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.4));
}

[data-theme="dark"] .card-fav-btn {
  color: #64748b;
}

[data-theme="dark"] .card-fav-btn:hover {
  color: #fbbf24;
}

[data-theme="dark"] .card-fav-btn.is-fav {
  color: #fbbf24;
  filter: drop-shadow(0 0 3px rgba(251, 191, 36, 0.5));
}

/* Main Viewer Section */
#viewer-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-viewer);
  position: relative;
  transition: background-color 0.2s;
}

/* Top Bar */
.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 22px;
  background: var(--bg-viewer-bar);
  border-bottom: 1px solid var(--border-color);
  min-height: 60px;
  gap: 16px;
  transition: background-color 0.2s, border-color 0.2s;
}

.viewer-top-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-nav-btn {
  display: none;
  align-items: center;
  gap: 4px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: var(--accent-blue);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.mobile-nav-btn:hover {
  background: rgba(59, 130, 246, 0.25);
}

.viewer-univ-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 200px;
}

.viewer-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.current-univ-name {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.univ-fav-header-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1.2;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.univ-fav-header-btn:hover {
  background: #fef9c3;
  border-color: #fde047;
  color: #ca8a04;
  transform: scale(1.12);
}

.univ-fav-header-btn.is-fav {
  background: #fef3c7;
  border-color: #fde68a;
  color: #d97706;
  font-weight: 900;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
}

.univ-fav-header-btn.is-fav:hover {
  background: #fde68a;
  border-color: #fcd34d;
  color: #b45309;
  transform: scale(1.15);
}

[data-theme="dark"] .univ-fav-header-btn {
  background: transparent;
  border-color: #334155;
  color: #64748b;
}

[data-theme="dark"] .univ-fav-header-btn:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

[data-theme="dark"] .univ-fav-header-btn.is-fav {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fbbf24;
}

.current-region-tag {
  font-size: 0.74rem;
  font-weight: 700;
  color: #154c9e;
  background: #e8f1fc;
  border: 1px solid #bcd5f0;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: -0.2px;
}

[data-theme="dark"] .current-region-tag {
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.3);
}

.year-tag {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: -0.2px;
}

[data-theme="dark"] .year-tag {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
}

.current-brochure-title {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.viewer-center-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.brochure-selector-tabs {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.brochure-tab-btn {
  background: var(--bg-btn);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-weight: 500;
}

.brochure-tab-btn:hover {
  background: var(--bg-btn-hover);
  color: var(--text-heading);
  border-color: var(--accent-blue);
}

.brochure-tab-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.brochure-tab-btn.disabled {
  opacity: 0.35;
  background: var(--bg-btn);
  border-color: var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: none;
}

.brochure-tab-btn.disabled:hover {
  opacity: 0.65;
  background: var(--bg-btn-hover);
  color: var(--text-secondary);
}

/* Admission Portal Button (Distinguished External Link) */
.admission-portal-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: var(--accent-blue);
  transition: all 0.18s ease;
  white-space: nowrap;
  margin-left: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.admission-portal-btn:hover {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

[data-theme="dark"] .admission-portal-btn {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.45);
  color: #60a5fa;
}

[data-theme="dark"] .admission-portal-btn:hover {
  background: #2563eb;
  color: #ffffff;
}

[data-theme="light"] .admission-portal-btn {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

[data-theme="light"] .admission-portal-btn:hover {
  background: #2563eb;
  color: #ffffff;
}

[data-theme="neis"] .admission-portal-btn {
  background: #e8f1fc;
  border-color: #bcd5f0;
  color: #154c9e;
}

[data-theme="neis"] .admission-portal-btn:hover {
  background: #154c9e;
  border-color: #154c9e;
  color: #ffffff;
}

.admission-portal-arrow {
  font-size: 0.72rem;
  opacity: 0.85;
}

/* Sub-toolbar Separator & PDF Icon Buttons */
.subtoolbar-divider {
  width: 1px;
  height: 18px;
  background: var(--border-color);
  margin: 0 3px;
  flex-shrink: 0;
}

.pdf-icon-btn {
  width: 32px;
  min-width: 32px;
  height: 30px;
  padding: 0;
  font-size: 0.92rem;
  text-decoration: none;
}

/* Toast Notification */
.toast-msg {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(15, 23, 42, 0.95);
  color: #f8fafc;
  border: 1px solid rgba(59, 130, 246, 0.5);
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 90vw;
  text-align: center;
}

.toast-msg.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* PDF Frame Container */
.pdf-frame-wrapper {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  background: #111827;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #2b2b2b;
}

/* PDF.js Sub-Toolbar */
.pdf-subtoolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: var(--bg-subtoolbar);
  border-bottom: 1px solid var(--border-color);
  gap: 10px;
  z-index: 15;
  user-select: none;
  flex-wrap: wrap;
  min-height: 44px;
  transition: background-color 0.2s, border-color 0.2s;
}

.pdf-subtoolbar-left,
.pdf-subtoolbar-center,
.pdf-subtoolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pdf-tool-btn {
  background: var(--bg-btn);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.pdf-tool-btn:hover {
  background: var(--bg-btn-hover);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.pdf-tool-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #ffffff;
}

.pdf-search-box {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px 6px;
  gap: 4px;
}

.pdf-search-icon {
  font-size: 0.8rem;
  color: var(--text-muted);
}

#pdf-search-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.78rem;
  width: 120px;
  outline: none;
}

.pdf-search-count {
  font-size: 0.72rem;
  color: var(--accent-amber);
  white-space: nowrap;
  font-weight: 600;
}

.pdf-search-nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.65rem;
  padding: 2px 3px;
  border-radius: 3px;
}

.pdf-search-nav-btn:hover {
  color: var(--accent-blue);
  background: var(--bg-btn-hover);
}

.pdf-page-num-box {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 600;
}

.pdf-page-num-box input {
  width: 42px;
  text-align: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 4px;
  padding: 3px 0;
  font-size: 0.82rem;
  outline: none;
}

.pdf-page-num-box input:focus {
  border-color: var(--accent-blue);
}

/* PDF.js Main Viewport Layout */
.pdf-viewport-layout {
  flex: 1;
  display: flex;
  position: relative;
  width: 100%;
  height: calc(100% - 44px);
  overflow: hidden;
}

/* Left Collapsible Outline & Thumbnails Sidebar */
.pdf-sidebar-panel {
  width: 290px;
  min-width: 180px;
  max-width: 650px;
  background: var(--bg-sidebar-panel);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 10;
  flex-shrink: 0;
  transition: background-color 0.2s, border-color 0.2s;
}

/* Draggable Sidebar Resizer Handle */
.pdf-sidebar-resizer {
  width: 6px;
  cursor: col-resize;
  background: var(--resizer-bg);
  border-right: 1px solid var(--border-color);
  transition: background 0.15s, width 0.15s;
  z-index: 12;
  user-select: none;
  touch-action: none;
  flex-shrink: 0;
}

.pdf-sidebar-resizer:hover,
.pdf-sidebar-resizer.dragging {
  background: var(--accent-blue);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
  width: 7px;
}

.print-icon-btn {
  font-size: 0.95rem;
  padding: 0 9px;
}

.pdf-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-sidebar-header-panel);
  border-bottom: 1px solid var(--border-color);
}

.pdf-sidebar-tabs {
  display: flex;
  gap: 4px;
}

.pdf-sidebar-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.pdf-sidebar-tab-btn.active {
  background: var(--bg-card-active);
  border-color: var(--border-active);
  color: var(--accent-blue);
}

.pdf-sidebar-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.pdf-sidebar-close-btn:hover {
  color: var(--text-primary);
  background: var(--bg-sidebar-hover);
}

.pdf-sidebar-view {
  flex: 1;
  overflow-y: auto;
  display: none;
  padding: 10px;
}

.pdf-sidebar-view.active {
  display: block;
}

/* Outline Tree */
.pdf-outline-tree {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pdf-outline-item {
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.8rem;
  line-height: 1.35;
  cursor: pointer;
  transition: all 0.15s;
  word-break: break-word;
}

.pdf-outline-item:hover {
  background: var(--bg-sidebar-hover);
  color: var(--accent-blue);
}

.pdf-outline-item.depth-1 {
  padding-left: 20px;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.pdf-outline-item.depth-2 {
  padding-left: 32px;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.pdf-outline-empty {
  padding: 20px 10px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Thumbnails Grid */
.pdf-thumbnails-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.pdf-thumbnail-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: var(--bg-thumbnail-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.pdf-thumbnail-card:hover {
  border-color: var(--accent-blue);
  background: var(--bg-thumbnail-card-hover);
}

.pdf-thumbnail-card.active {
  border-color: var(--accent-blue);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.pdf-thumbnail-card canvas {
  width: 100%;
  height: auto;
  border-radius: 3px;
  display: block;
  box-shadow: var(--pdf-page-shadow);
}

.pdf-thumbnail-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Scroll Viewport & Pages */
.pdf-scroll-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 16px 16px 60px 16px;
  background: var(--bg-pdf-viewport);
  -webkit-overflow-scrolling: touch;
  display: flex;
  justify-content: center;
  transition: background-color 0.2s;
}

.pdf-pages-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
}

.pdf-page-card {
  position: relative;
  box-shadow: var(--pdf-page-shadow);
  background: #ffffff;
  border-radius: 4px;
  width: fit-content;
  max-width: 100%;
  display: block;
}

.pdf-page-card canvas {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.pdf-page-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 300px;
  aspect-ratio: 1 / 1.414;
  background: var(--bg-placeholder);
  color: var(--text-muted);
  border-radius: 4px;
}

/* Authentic Fluorescent Text Highlighter (Soft, Translucent & High Contrast) */
.pdf-search-highlight-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
  overflow: hidden;
  border-radius: 4px;
}

.pdf-search-highlight-box {
  position: absolute;
  background-color: rgba(254, 240, 138, 0.32);
  border: none;
  border-radius: 2px;
  pointer-events: none;
  mix-blend-mode: multiply;
  transition: background-color 0.15s ease-in-out;
}

[data-theme="dark"] .pdf-search-highlight-box {
  background-color: rgba(250, 204, 21, 0.22);
  mix-blend-mode: screen;
}

.pdf-search-highlight-box.current {
  background-color: rgba(251, 146, 60, 0.42);
  border: none;
  border-radius: 2px;
  z-index: 10;
  mix-blend-mode: multiply;
  animation: pulseHighlighter 1.4s infinite ease-in-out;
}

[data-theme="dark"] .pdf-search-highlight-box.current {
  background-color: rgba(251, 146, 60, 0.48);
  mix-blend-mode: screen;
}

@keyframes pulseHighlighter {
  0%, 100% {
    opacity: 1;
    background-color: rgba(251, 146, 60, 0.42);
  }
  50% {
    opacity: 0.6;
    background-color: rgba(251, 191, 36, 0.52);
  }
}

/* Loading Overlay */
#loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 15, 25, 0.8);
  backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-in-out;
}

#loading-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 0.9rem;
  color: #cbd5e1;
  font-weight: 500;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 10px;
  padding: 40px 20px;
  text-align: center;
}

.empty-icon {
  font-size: 2.5rem;
}

/* ==========================================================
   📱 Mobile Responsive Design (Master-Detail Layout)
   ========================================================== */

@media (max-width: 768px) {
  html, body {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  body {
    display: flex;
    flex-direction: column;
  }

  .global-portal-header {
    height: 46px;
    padding: 0 10px;
    flex-shrink: 0;
  }

  .gnb-service-tag {
    display: none !important;
  }

  .gnb-main-title {
    font-size: 0.88rem;
  }

  /* Hide Feature Chip & Live Status on Mobile to Maximize Space */
  .gnb-feature-chips {
    display: none !important;
  }

  .gnb-live-status {
    display: none !important;
  }

  #app-container {
    display: flex;
    flex: 1;
    height: calc(100vh - 46px);
    height: calc(100dvh - 46px);
    width: 100vw;
    overflow: hidden;
    position: relative;
    flex-direction: column;
  }

  /* 1. Mobile Sidebar (Default View) */
  #sidebar {
    width: 100% !important;
    min-width: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column;
    border-right: none;
    z-index: 10;
  }

  /* 2. Mobile Main Viewer (Hidden by default) */
  #viewer-section {
    display: none !important;
    width: 100% !important;
    height: 100% !important;
    flex-direction: column;
    z-index: 20;
  }

  /* When a university is selected, active view switches to Viewer */
  #app-container.mobile-view-active #sidebar {
    display: none !important;
  }

  #app-container.mobile-view-active #viewer-section {
    display: flex !important;
  }

  /* Show mobile back button */
  .mobile-nav-btn {
    display: inline-flex !important;
  }

  /* Mobile Header */
  .sidebar-header {
    padding: 12px 14px 10px 14px;
  }

  .header-meta-row {
    margin-bottom: 4px;
  }

  .app-title {
    font-size: 1.15rem;
  }

  .app-subtitle {
    font-size: 0.74rem;
  }

  .search-wrapper {
    padding: 8px 10px;
  }

  .region-filter-wrapper {
    padding: 5px 10px;
  }

  /* University List items */
  .univ-list-container {
    padding: 6px 8px 24px 8px;
  }

  .univ-card {
    padding: 10px 10px;
    margin-bottom: 4px;
  }

  .univ-name {
    font-size: 0.92rem;
  }

  /* Ultra-Compact Mobile Viewer Header */
  .viewer-header {
    padding: 6px 10px;
    min-height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    background: #e8f1fb;
    border-bottom: 2px solid #154c9e;
  }

  [data-theme="dark"] .viewer-header {
    background: #0f172a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .viewer-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
  }

  .viewer-univ-info {
    min-width: 0;
    flex: 1;
  }

  .viewer-title-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 5px;
    overflow: hidden;
  }

  .current-univ-name {
    font-size: 1.05rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .current-brochure-title {
    display: none; /* Hide on mobile to save vertical space */
  }

  .year-tag {
    display: none; /* Hide redundant 2027 tag on mobile */
  }

  .viewer-center-actions {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
  }

  .brochure-selector-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    padding: 2px 0;
    scrollbar-width: none;
    flex: 1;
  }

  .brochure-selector-tabs::-webkit-scrollbar {
    display: none;
  }

  .brochure-tab-btn {
    flex: 0 0 auto;
    padding: 4px 9px;
    font-size: 0.74rem;
    border-radius: 4px;
    font-weight: 700;
  }

  .admission-portal-btn {
    padding: 4px 8px;
    font-size: 0.72rem;
    border-radius: 4px;
    margin-left: 4px;
    flex-shrink: 0;
  }

  /* 3. 모바일 PDF 화면에서 목차, 미리보기, 페이지 이동, 폭맞춤/줌, 새 탭 버튼 제거 */
  #btn-toggle-outline,
  #btn-toggle-thumbnails,
  #pdf-sidebar-panel,
  .pdf-sidebar-resizer,
  .pdf-subtoolbar-center,
  #btn-pdf-prev,
  #btn-pdf-next,
  .pdf-page-num-box,
  #btn-pdf-zoom-out,
  #btn-pdf-zoom-fit,
  #btn-pdf-zoom-in,
  .subtoolbar-divider,
  #open-new-tab-btn {
    display: none !important;
  }

  /* Streamlined Single-Row Mobile PDF Sub-Toolbar */
  .pdf-subtoolbar {
    min-height: 38px;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--bg-subtoolbar);
    border-bottom: 1px solid var(--border-color);
  }

  .pdf-subtoolbar-left {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
  }

  .pdf-search-box {
    flex: 1;
    max-width: 220px;
    padding: 2px 6px;
  }

  #pdf-search-input {
    width: 100%;
    min-width: 60px;
    font-size: 0.74rem;
  }

  .pdf-subtoolbar-right {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
  }

  .pdf-subtoolbar-right .pdf-tool-btn {
    height: 28px;
    padding: 0 7px;
    font-size: 0.88rem;
    border-radius: 5px;
  }

  .pdf-scroll-viewport {
    padding: 8px 4px 40px 4px;
  }

  .pdf-pages-container {
    gap: 10px;
  }

  .pdf-page-card {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  }

  .pdf-frame-wrapper {
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  .app-title {
    font-size: 1.1rem;
  }

  .developer-credit {
    font-size: 0.68rem;
    padding: 1px 6px;
  }

  .brand-badge {
    font-size: 0.68rem;
    padding: 1px 5px;
  }

  .filter-tab {
    flex: 1 1 calc(33.333% - 4px);
    font-size: 0.7rem;
    padding: 5px 2px;
  }

  .current-univ-name {
    font-size: 1.0rem;
  }

  .action-btn {
    font-size: 0.74rem;
    padding: 6px 2px;
  }
}

/* Feedback Modal Overlay & Card */
.feedback-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.feedback-modal-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 14px;
  width: 100%;
  max-width: 490px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

[data-theme="dark"] .feedback-modal-card {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.55);
}

.feedback-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #f1f5f9;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .feedback-modal-header {
  background: #0f172a;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.feedback-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.feedback-modal-icon {
  font-size: 1.15rem;
}

.feedback-modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.feedback-modal-close-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.feedback-modal-close-btn:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .feedback-modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.feedback-modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.feedback-modal-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.feedback-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.feedback-form-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
}

.required-star {
  color: #ef4444;
}

.feedback-type-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.feedback-pill-label {
  cursor: pointer;
}

.feedback-pill-label input[type="radio"] {
  display: none;
}

.feedback-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #f8fafc;
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #475569;
  transition: all 0.15s ease;
  user-select: none;
}

[data-theme="dark"] .feedback-pill {
  background: #0f172a;
  border-color: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

.feedback-pill-label input[type="radio"]:checked + .feedback-pill {
  background: #154c9e;
  border-color: #154c9e;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(21, 76, 158, 0.25);
}

[data-theme="dark"] .feedback-pill-label input[type="radio"]:checked + .feedback-pill {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
}

.feedback-input,
.feedback-textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: #ffffff;
  color: #0f172a;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

[data-theme="dark"] .feedback-input,
[data-theme="dark"] .feedback-textarea {
  background: #0f172a;
  border-color: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
}

.feedback-input:focus,
.feedback-textarea:focus {
  border-color: #154c9e;
  box-shadow: 0 0 0 3px rgba(21, 76, 158, 0.15);
}

[data-theme="dark"] .feedback-input:focus,
[data-theme="dark"] .feedback-textarea:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.feedback-textarea {
  resize: vertical;
  min-height: 80px;
}

.feedback-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .feedback-modal-footer {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.feedback-btn-cancel {
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 0.84rem;
  font-weight: 600;
  background: #f1f5f9;
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

[data-theme="dark"] .feedback-btn-cancel {
  background: #0f172a;
  border-color: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

.feedback-btn-cancel:hover {
  background: #e2e8f0;
  color: #0f172a;
}

[data-theme="dark"] .feedback-btn-cancel:hover {
  background: #334155;
  color: #ffffff;
}

.feedback-btn-submit {
  padding: 8px 18px;
  border-radius: 7px;
  font-size: 0.84rem;
  font-weight: 700;
  background: #154c9e;
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(21, 76, 158, 0.3);
  transition: all 0.15s ease;
}

.feedback-btn-submit:hover {
  background: #0d3880;
  transform: translateY(-1px);
}

.feedback-btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================================
   Welcome & User Guide Landing Screen (Premium Editorial Home State)
   ========================================================================== */
.welcome-guide-view {
  display: flex;
  flex: 1;
  overflow-y: auto;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  background: var(--bg-main);
  animation: fadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.welcome-container {
  max-width: 880px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Hero Section */
.welcome-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 16px;
  background: rgba(21, 76, 158, 0.08);
  color: #154c9e;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 999px;
  letter-spacing: -0.01em;
  border: 1px solid rgba(21, 76, 158, 0.18);
  box-shadow: 0 1px 3px rgba(21, 76, 158, 0.08);
}

.welcome-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #154c9e;
  box-shadow: 0 0 0 2px rgba(21, 76, 158, 0.25);
  animation: pulseDot 2s infinite;
}

[data-theme="dark"] .welcome-badge {
  background: rgba(96, 165, 250, 0.12);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.25);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .welcome-badge-dot {
  background: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.35);
}

.welcome-title {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.32;
  letter-spacing: -0.035em;
  margin: 0;
  word-break: keep-all;
}

.welcome-title-highlight {
  color: #154c9e;
  position: relative;
  display: inline-block;
}

[data-theme="dark"] .welcome-title-highlight {
  color: #60a5fa;
}

.welcome-subtitle {
  font-size: 0.96rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 0;
  word-break: keep-all;
  max-width: 620px;
}

/* Live Stats Metric Strip */
.welcome-stats-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 12px 28px;
  border-radius: 12px;
  margin-top: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.welcome-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-number {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-unit {
  font-size: 0.75rem;
  font-weight: 600;
  color: #154c9e;
  margin-left: 2px;
}

[data-theme="dark"] .stat-unit {
  color: #93c5fd;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-divider {
  width: 1px;
  height: 24px;
  background: var(--border-color);
}

/* Compact Feature Chip Row (icon + short label, no paragraphs) */
.welcome-feature-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.welcome-feature-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.welcome-feature-chip svg {
  color: #154c9e;
  flex-shrink: 0;
}

[data-theme="dark"] .welcome-feature-chip svg {
  color: #60a5fa;
}

/* Trust Footer */
.welcome-trust-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.trust-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #154c9e;
  background: rgba(21, 76, 158, 0.08);
  padding: 2px 7px;
  border-radius: 4px;
}

[data-theme="dark"] .trust-badge {
  color: #93c5fd;
  background: rgba(96, 165, 250, 0.12);
}

.trust-creator {
  font-weight: 600;
  color: var(--text-secondary);
}

/* Mobile Responsive Tweaks */
@media (max-width: 768px) {
  .welcome-guide-view {
    padding: 28px 16px;
    align-items: flex-start;
  }
  
  .welcome-container {
    gap: 22px;
  }

  .welcome-title {
    font-size: 1.5rem;
  }

  .welcome-subtitle {
    font-size: 0.88rem;
  }

  .welcome-stats-strip {
    padding: 10px 14px;
    gap: 10px;
    width: 100%;
    justify-content: space-between;
  }

  .stat-number {
    font-size: 1.05rem;
  }

  .stat-label {
    font-size: 0.68rem;
  }

  .welcome-feature-row {
    gap: 8px;
  }

  .welcome-feature-chip {
    padding: 8px 12px;
    font-size: 0.78rem;
  }
}
