:root {
  --ub-blue: #005bbb;
  --accent: #2563eb;
  --accent-light: #60a5fa;
  --nav-bg: #151824;
  --canvas-bg: #181a22;
  --card-bg: #222532;
  --card-soft: #2a2e3e;
  --input-bg: #171a24;
  --border: #34394e;
  --text: #f7f9ff;
  --muted: #b8c3da;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .18);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas-bg);
  color: var(--text);
  font-family: var(--font-main);
  line-height: 1.5;
}
img { max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }

/* Navigation */
.topnav {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  background: rgba(21, 24, 36, .96);
  box-shadow: 0 2px 16px rgba(0, 0, 0, .22);
  backdrop-filter: blur(12px);
}
.topnav-content {
  width: min(1240px, 100%);
  min-height: 64px;
  margin: 0 auto;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.nav-left { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.logo { width: 42px; height: 42px; object-fit: cover; border-radius: 10px; }
.logo-text { font-size: 1.15rem; font-weight: 800; letter-spacing: .2px; }
.nav-right { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.nav-right::-webkit-scrollbar { display: none; }
.nav-right a {
  flex: 0 0 auto;
  padding: 9px 13px;
  border-radius: 9px;
  color: #dce5f8;
  text-decoration: none;
  font-size: .95rem;
  font-weight: 600;
  transition: background .18s ease, color .18s ease;
}
.nav-right a:hover { background: #272b3a; color: #fff; }
.nav-right a.active { background: var(--accent); color: #fff; }

/* Shared layout */
.page-shell { width: min(1100px, calc(100% - 32px)); margin: 40px auto 56px; }
.page-header { text-align: center; margin-bottom: 30px; }
.page-header h1, .dashboard-header h1, .dashboard-header h2 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 5vw, 2.7rem);
  line-height: 1.1;
}
.page-header p, .dashboard-header p { margin: 0; color: var(--muted); }
.dashboard-section {
  width: min(760px, calc(100% - 32px));
  margin: 42px auto 56px;
  padding: clamp(24px, 5vw, 40px);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.dashboard-header { text-align: center; margin-bottom: 28px; }
.center-form { width: min(500px, 100%); margin: 0 auto; }
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Inputs and buttons */
label { display: block; margin-bottom: 8px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 11px;
  background: var(--input-bg);
  color: var(--text);
  padding: 12px 14px;
  transition: border-color .18s ease, background .18s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-light); background: #1d2130; }
textarea { min-height: 130px; resize: vertical; }
.field { margin-bottom: 18px; }
.help-text { margin: 6px 0 0; font-size: .88rem; color: var(--muted); }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; margin: 14px 0; }
.checkbox-row input { width: auto; margin-top: 4px; }
.checkbox-row label { margin: 0; font-weight: 500; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 22px;
  border: 0;
  border-radius: 11px;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, opacity .16s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.btn-blue { background: var(--accent); color: #fff; }
.btn-blue:hover { background: #1d4ed8; }
.btn-transparent { background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.55); }
.btn-transparent:hover { background: rgba(255,255,255,.16); }
.status { min-height: 24px; margin-top: 12px; color: var(--muted); }
.status.success { color: #86efac; }
.status.error { color: #fca5a5; }

/* Homepage */
.hero {
  position: relative;
  min-height: 620px;
  display: grid;
  place-items: center;
  background: url('bg.jpg') center / cover no-repeat;
  overflow: hidden;
}
.hero::before { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(10,14,28,.69), rgba(10,14,28,.82)); }
.hero-content {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 32px));
  padding: 72px 0 58px;
  text-align: center;
}
.hero h1 { margin: 0 0 14px; font-size: clamp(2.3rem, 6vw, 4rem); line-height: 1.05; }
.hero p { width: min(820px, 100%); margin: 0 auto 30px; color: #e7edf9; font-size: clamp(1rem, 2.5vw, 1.2rem); }
.hero-buttons { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 40px; }
.features-wrapper { display: flex; justify-content: center; }
.features { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)); gap: 16px; max-width: fit-content; }
.feature-link { text-decoration: none; }
.feature-btn {
  height: 150px;
  padding: 18px 12px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 16px;
  background: rgba(28, 32, 48, .82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 800;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
  backdrop-filter: blur(8px);
}
.feature-btn:hover { transform: translateY(-4px); background: rgba(32, 39, 62, .96); border-color: var(--accent-light); }
.feature-btn img { width: 56px; height: 56px; object-fit: contain; border-radius: 10px; }
.stats-section { padding: 34px 20px; background: #20232e; }
.stats-center { width: min(960px, 100%); margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; text-align: center; }
.stats-big { display: block; margin-bottom: 2px; font-size: 2rem; font-weight: 900; }
.features-section { width: min(1160px, calc(100% - 32px)); margin: 0 auto; padding: 56px 0 64px; }
.features-header { text-align: center; margin-bottom: 28px; }
.features-header h2 { margin: 0 0 8px; font-size: clamp(1.8rem, 4vw, 2.4rem); }
.features-header p { margin: 0; color: var(--muted); }
.features-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.feature-card { padding: 26px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.feature-card img { width: 88px; height: 82px; object-fit: contain; border-radius: 12px; }
.feature-card h3 { margin: 15px 0 8px; }
.feature-card p { margin: 0 0 20px; color: var(--muted); flex: 1; }
.disclaimer { width: min(1160px, calc(100% - 32px)); margin: 0 auto 42px; color: #9aa8c5; text-align: center; font-size: .9rem; }

/* Translator */
.language-select { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; margin-bottom: 18px; }
.swap-btn { width: 46px; height: 46px; border: 1px solid var(--border); border-radius: 50%; background: #2d3347; color: #fff; cursor: pointer; }
.text-area-container { display: grid; gap: 14px; }

/* Map */
.region-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 24px 0 30px; }
.region-buttons button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 15px;
  background: var(--card-soft);
  color: #e2e8f0;
  font-weight: 700;
  cursor: pointer;
}
.region-buttons button:hover, .region-buttons button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.map-container { width: min(1000px, calc(100% - 32px)); margin: 0 auto 56px; }
.map-frame { width: 100%; height: min(68vh, 580px); min-height: 420px; border: 1px solid var(--border); border-radius: 18px; background: #dbe4f0; box-shadow: var(--shadow); }

/* Region matcher */
.section-divider { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.dashboard-list { display: grid; gap: 12px; margin-top: 18px; }
.student {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #1c202d;
}
.student strong { display: block; margin-bottom: 6px; font-size: 1.05rem; }
.student a { color: #93c5fd; word-break: break-word; }
.privacy-note { padding: 12px 14px; margin-bottom: 18px; border: 1px solid #46506d; border-radius: 11px; background: #242a3a; color: #cad4e8; font-size: .9rem; }

/* Mood tracker */
.mood-center { width: min(820px, calc(100% - 32px)); margin: 0 auto 56px; }
.mood-box { padding: 28px; }
.mood-box h2 { margin: 0 0 20px; text-align: center; }
.mood-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.mood-row button {
  min-height: 94px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #303548;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.mood-row button:hover, .mood-row button.selected { background: var(--accent); transform: translateY(-2px); }
.mood-row button:disabled { opacity: .58; cursor: default; transform: none; }
.mood-emoji { display: block; margin-bottom: 5px; font-size: 1.9rem; }
.mood-results { margin-top: 24px; padding: 26px; }
.mood-results h3 { margin: 0 0 4px; }
.mood-results > p { margin: 0 0 18px; color: var(--muted); }
.mood-summary-row { display: grid; grid-template-columns: 88px 1fr 46px; gap: 10px; align-items: center; margin: 11px 0; }
.mood-label { text-align: left; font-weight: 700; }
.summary-bar { height: 18px; border-radius: 999px; background: #12151e; overflow: hidden; }
.summary-fill { height: 100%; width: 0; border-radius: inherit; transition: width .35s ease; }
.mood-percent { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.mood-comment { margin-top: 18px; font-weight: 800; }

/* Chat */
.chat-page { min-height: calc(100dvh - 64px); display: flex; justify-content: center; background: #dfe4ea; }
.app-container { width: min(760px, 100%); min-height: calc(100dvh - 64px); display: flex; flex-direction: column; background: #fff; color: #1f2937; box-shadow: 0 0 34px rgba(0,0,0,.12); }
.chat-header { padding: 14px 18px; display: flex; align-items: center; gap: 10px; background: var(--ub-blue); color: #fff; }
.chat-header-icon { font-size: 1.8rem; }
.chat-header h1 { margin: 0; font-size: 1.15rem; }
.chat-header p { margin: 2px 0 0; font-size: .78rem; opacity: .9; }
#chat-box { flex: 1; min-height: 260px; overflow-y: auto; padding: 20px; background-image: radial-gradient(#dce1e7 1px, transparent 0); background-size: 20px 20px; }
.message { width: fit-content; max-width: 85%; margin-bottom: 14px; padding: 11px 14px; border-radius: 17px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.message.bot { margin-right: auto; background: #edf1f5; border-bottom-left-radius: 4px; }
.message.user { margin-left: auto; background: var(--ub-blue); color: #fff; border-bottom-right-radius: 4px; }
.quick-replies { display: flex; gap: 8px; padding: 10px 14px; overflow-x: auto; scrollbar-width: none; border-top: 1px solid #e7e9ed; background: #fff; }
.quick-replies::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid #d7dde5; border-radius: 999px; padding: 8px 12px; background: #f3f6f9; color: var(--ub-blue); font-size: .85rem; font-weight: 800; cursor: pointer; }
.chip:hover { background: var(--ub-blue); color: #fff; }
.input-zone { padding: 12px 14px 16px; display: flex; gap: 9px; background: #fff; border-top: 1px solid #e7e9ed; }
#user-input { margin: 0; background: #fff; color: #111827; border-color: #d6dbe3; }
#send-btn { width: 48px; flex: 0 0 48px; border: 0; border-radius: 50%; background: var(--ub-blue); color: #fff; cursor: pointer; }
#send-btn:disabled { background: #9ca3af; cursor: wait; }
.loading-dots::after { content: '…'; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

footer { padding: 24px 18px; text-align: center; color: #8392b0; font-size: .9rem; }

@media (max-width: 900px) {
  .features { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
  .features-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mood-row { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 700px) {
  .topnav-content { align-items: flex-start; flex-direction: column; gap: 4px; padding: 8px 14px; }
  .nav-right { width: 100%; padding-bottom: 4px; }
  .nav-right a { padding: 8px 10px; font-size: .88rem; }
  .hero { min-height: 700px; }
  .features { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .features-grid { grid-template-columns: 1fr; }
  .stats-center { grid-template-columns: 1fr; gap: 18px; }
  .language-select { grid-template-columns: 1fr; }
  .swap-btn { margin: 0 auto; transform: rotate(90deg); }
  .search-row { grid-template-columns: 1fr; }
  .search-row .btn { width: 100%; }
  .mood-row { grid-template-columns: repeat(2, 1fr); }
  .mood-summary-row { grid-template-columns: 80px 1fr 42px; font-size: .9rem; }
  .chat-page, .app-container { min-height: calc(100dvh - 112px); }
}

@media (max-width: 430px) {
  .features { grid-template-columns: 1fr 1fr; gap: 10px; }
  .feature-btn { height: 126px; }
  .mood-row { grid-template-columns: 1fr; }
  .map-frame { min-height: 360px; }
}
