:root {
  /* University of Bonn corporate design:
     blue #004e9f, yellow #fcba00, grey #909085. */
  --uni-blue: #004e9f;
  --uni-yellow: #fcba00;
  --uni-grey: #909085;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #1c2330;
  --muted: #6c6e6a;          /* readable shade of the corporate grey */
  --border: #e1e4ea;
  --primary: #004e9f;        /* uni blue */
  --primary-dark: #003a78;
  --accent: #fcba00;         /* uni yellow */
  --accent-dark: #c98f00;
  --gold: #fcba00;           /* leaderboard #1 uses the corporate yellow */
  --silver: #909085;
  --bronze: #b9863d;
  --danger: #d23b4b;
  --success: #1f8a4c;
  --warning: #b8860b;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 8px 24px rgba(16,24,40,.06);
  --radius: 14px;
  --radius-sm: 9px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.main { flex: 1 0 auto; padding-top: 28px; padding-bottom: 56px; }

/* ---------- Top bar ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(180%) blur(6px);
}
.topbar-inner { position: relative; display: flex; align-items: center; gap: 12px; height: 72px; }
.brand { display: flex; align-items: center; gap: 14px; font-weight: 700; color: var(--text); font-size: 1rem; flex: 0 0 auto; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 42px; width: auto; display: block; }
.brand-sep { width: 1px; height: 30px; background: var(--border); display: inline-block; }
.brand-mark { height: 40px; width: 40px; display: block; border-radius: 50%; }
/* On desktop the wrapper is transparent to layout so nav/nav-auth keep
   their original placement; on mobile it becomes the dropdown panel. */
.nav-collapse { display: contents; }
.nav {
  display: flex; gap: 4px; flex-wrap: nowrap;
}
.nav a {
  color: var(--muted); font-weight: 500; padding: 8px 12px; border-radius: 8px;
  white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-auth { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* Hamburger toggle — hidden on desktop, shown via the mobile media query. */
.nav-toggle { display: none; }
.nav-toggle-cb { position: absolute; opacity: 0; pointer-events: none; }
.nav-user { font-weight: 600; color: var(--text); }
.inline-form { display: inline; margin: 0; }

/* ---------- Floating language toggle ---------- */
.lang-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  width: 54px; height: 54px; border-radius: 50%; overflow: hidden;
  border: 2px solid #fff; background: var(--surface);
  box-shadow: 0 2px 6px rgba(16,24,40,.18), 0 10px 26px rgba(16,24,40,.20);
  display: block;
  transition: transform .15s ease, box-shadow .15s ease;
}
.lang-fab:hover {
  text-decoration: none; transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 10px rgba(16,24,40,.22), 0 14px 32px rgba(16,24,40,.24);
}
.lang-fab:focus-visible { outline: 3px solid rgba(0,78,159,.45); outline-offset: 2px; }
/* Diagonally split toggle: active language fills the larger region. */
.lang-fab-flag {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
}
.lang-fab-active { clip-path: polygon(0 0, 82% 0, 50% 100%, 0 100%); }
.lang-fab-other  { clip-path: polygon(82% 0, 100% 0, 100% 100%, 50% 100%); }
/* Thin white divider along the diagonal seam (top 82%, bottom 50%). */
.lang-fab::after {
  content: ""; position: absolute; left: 66%; top: -25%;
  width: 2px; height: 150%; background: #fff;
  transform: translateX(-50%) rotate(17.6deg);
  z-index: 1; pointer-events: none;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  transition: all .15s ease; white-space: nowrap; text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: #fde8ea; color: var(--danger); border-color: #f6c9cf; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: .85rem; border-radius: 8px; }
.btn-lg { padding: 13px 24px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #003a78 0%, #004e9f 60%, #0a63bd 120%);
  color: #fff; border-radius: 20px; padding: 52px 44px;
  box-shadow: var(--shadow); margin-bottom: 32px;
}
/* Corporate yellow accent bar along the top of the hero. */
.hero::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 6px;
  background: var(--uni-yellow);
}
.hero h1 { font-size: 2.5rem; line-height: 1.1; margin: 0 0 14px; font-weight: 800; letter-spacing: -.02em; }
.hero p { font-size: 1.12rem; max-width: 90ch; margin: 0 0 26px; color: rgba(255,255,255,.92); }
.hero .cta-row { display: flex; gap: 14px; flex-wrap: wrap; }
.hero .btn-primary { background: var(--uni-yellow); color: #20242b; }
.hero .btn-primary:hover { background: #ffc92e; color: #20242b; }
.hero .btn-ghost { color: #fff; border-color: rgba(255,255,255,.55); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.14); color: #fff; }
.hero-doodle {
  position: absolute; right: -40px; top: -30px; font-size: 18rem; opacity: .1;
  transform: rotate(-12deg); pointer-events: none; user-select: none;
  color: var(--uni-yellow);
}

/* ---------- Layout helpers ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.stack > * + * { margin-top: 16px; }
.section-title { font-size: 1.5rem; font-weight: 700; margin: 36px 0 16px; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }
.track-card { display: flex; flex-direction: column; gap: 14px; }
.track-card .pill { align-self: flex-start; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted);
}
.pill-creativity { background: #fff3cf; color: #8a6500; }
.pill-tsp { background: #e0ebf6; color: var(--primary); }
.pill-success { background: #e1f3e8; color: var(--success); }
.pill-warning { background: #fff0cc; color: var(--warning); }

/* ---------- Countdown ---------- */
.countdown { margin-bottom: 28px; text-align: center; border-top: 4px solid var(--uni-yellow); }
.countdown-label { text-transform: uppercase; letter-spacing: .08em; font-size: .82rem; font-weight: 700; color: var(--muted); margin-bottom: 12px; }
.countdown-clock { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; }
.cd-unit { display: flex; flex-direction: column; min-width: 64px; }
.cd-num { font-size: 2.4rem; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; line-height: 1.1; }
.cd-lbl { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.countdown-ended { font-size: 1.3rem; font-weight: 700; color: var(--primary); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px; box-shadow: var(--shadow); }
.stat .num { font-size: 1.8rem; font-weight: 800; }
.stat .label { color: var(--muted); font-size: .9rem; }

/* ---------- Tables / leaderboards ---------- */
.table-wrap { overflow-x: auto; }
table.lb { width: 100%; border-collapse: collapse; }
table.lb th, table.lb td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
table.lb th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
table.lb tbody tr:hover { background: var(--surface-2); }
table.lb td.num, table.lb th.num { text-align: right; font-variant-numeric: tabular-nums; }
.rank { font-weight: 800; width: 2.4rem; display: inline-grid; place-items: center; height: 1.9rem; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.lb-entry { display: flex; align-items: center; gap: 12px; }
.lb-entry:hover { text-decoration: none; }
.lb-entry:hover .lb-title { text-decoration: underline; }
.lb-entry-text { display: flex; flex-direction: column; }
.lb-title { font-weight: 600; color: var(--text); }
.thumb-wrap { flex: 0 0 auto; display: inline-grid; place-items: center; }
.thumb-map {
  width: 58px; height: 58px; flex: 0 0 auto;
  border: 1px solid var(--border); border-radius: 9px; overflow: hidden;
  background: #f3f6fa; display: block;
}
.thumb-map .leaflet-container { width: 100%; height: 100%; background: #f3f6fa; }
.thumb { width: 100%; height: 100%; background: #f3f6fa; display: block; }
.rank-1 { background: #fff0c2; color: #8a6500; }
.rank-2 { background: #ecedeb; color: #6f716c; }
.rank-3 { background: #f3e3d0; color: #9c5a1d; }
.empty { padding: 32px; text-align: center; color: var(--muted); }

/* ---------- Forms ---------- */
.form-card { max-width: 460px; margin: 24px auto; }
.form-wide { max-width: 640px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
.field input[type=text], .field input[type=email], .field input[type=password],
.field input[type=number], .field input[type=file], .field textarea, .field select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px;
  font: inherit; background: var(--surface); color: var(--text);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,109,244,.15);
}
.field textarea { min-height: 110px; resize: vertical; }
.field .hint { color: var(--muted); font-size: .85rem; margin-top: 5px; }
.field .errors { color: var(--danger); font-size: .85rem; margin-top: 5px; list-style: none; padding: 0; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

/* ---------- Notice box (upload rules) ---------- */
.notice { background: #fff8e6; border: 1px solid #f3dca0; border-radius: 10px; padding: 12px 16px 12px 18px; margin-bottom: 18px; font-size: .92rem; }
.notice ul { margin: 8px 0 0; padding-left: 18px; }
.notice li { margin-bottom: 4px; }

/* ---------- Flash ---------- */
.flashes { margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px; }
.flash { padding: 12px 16px; border-radius: 10px; border: 1px solid; font-weight: 500; }
.flash-success { background: #e7f7ee; border-color: #b6e6cb; color: #137a43; }
.flash-danger { background: #fdeaec; border-color: #f3c4cb; color: #b21f30; }
.flash-warning { background: #fdf2dd; border-color: #f4dca6; color: #9a6700; }
.flash-info, .flash-message { background: #e9f0fe; border-color: #c5d8fb; color: #1f55cf; }

/* ---------- Map ---------- */
.map { height: 460px; width: 100%; border-radius: var(--radius); border: 1px solid var(--border); z-index: 1; }
.map-sm { height: 320px; }

/* ---------- Stars ---------- */
.star-count { color: var(--accent-dark); font-weight: 700; white-space: nowrap; }
.star-bar { display: flex; align-items: center; gap: 14px; margin: 0 0 20px; }
.star-count-lg { font-size: 1.3rem; font-weight: 800; color: var(--accent-dark); }

/* ---------- Detail ---------- */
.detail-meta { display: flex; flex-wrap: wrap; gap: 18px; color: var(--muted); margin: 8px 0 20px; }
.detail-meta b { color: var(--text); }
.breadcrumb { color: var(--muted); font-size: .9rem; margin-bottom: 8px; }
.poi-list { columns: 2; column-gap: 28px; }
.poi-list li { margin-bottom: 6px; break-inside: avoid; }

/* ---------- App / QR rows (About page) ---------- */
.app-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); }
.app-row:first-of-type { border-top: 0; }
.qr {
  width: 84px; height: 84px; flex: 0 0 auto; padding: 6px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
}
.app-info { display: flex; flex-direction: column; gap: 2px; }
.app-info .muted { font-size: .9rem; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: auto; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px 20px; color: var(--muted); font-size: .88rem; }

@media (max-width: 860px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .hero { padding: 36px 24px; }
  .hero h1 { font-size: 2rem; }
  .poi-list { columns: 1; }

  /* ----- Collapsible mobile navigation ----- */
  .nav-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; align-items: center;
    gap: 5px; margin-left: auto; width: 44px; height: 44px; flex: 0 0 auto;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer;
  }
  .nav-toggle span {
    display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px;
    transition: transform .2s ease, opacity .2s ease;
  }
  .nav-toggle-cb:focus-visible ~ .nav-toggle { outline: 3px solid rgba(0,78,159,.45); outline-offset: 2px; }
  /* Animate hamburger into an X when open. */
  .nav-toggle-cb:checked ~ .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle-cb:checked ~ .nav-toggle span:nth-child(2) { opacity: 0; }
  .nav-toggle-cb:checked ~ .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .nav-collapse {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 4px;
    background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: var(--shadow); padding: 12px 0 16px;
  }
  .nav-toggle-cb:checked ~ .nav-collapse { display: flex; }

  .nav {
    position: static; transform: none; left: auto;
    flex-direction: column; gap: 2px; width: 100%;
  }
  .nav a { padding: 12px 14px; border-radius: 8px; }
  .nav-auth {
    margin-left: 0; margin-top: 12px; padding-top: 14px; flex-wrap: wrap;
    border-top: 1px solid var(--border);
  }
  .nav-auth .btn { flex: 1 1 auto; }
  .nav-user { padding: 4px 0; }
}
