/* EngLiew Lab — liquid glass SPA */
:root {
  --bg: #070b16;
  --bg-elevated: rgba(14, 20, 38, 0.75);
  --ink: #e8eefc;
  --muted: #9aa8c7;
  --line: rgba(148, 163, 204, 0.22);
  --cyan: #5eead4;
  --violet: #a78bfa;
  --magenta: #f472b6;
  --ok: #34d399;
  --danger: #fda4af;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Syne", "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --header-h: 76px;
  --max: 1120px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Keep HTML hidden working when components set display:flex/inline-flex */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: var(--mono);
}

.liquid-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1000px 500px at 10% -10%, rgba(94, 234, 212, 0.12), transparent 55%),
    radial-gradient(800px 420px at 90% 0%, rgba(167, 139, 250, 0.16), transparent 50%),
    radial-gradient(700px 400px at 50% 100%, rgba(244, 114, 182, 0.1), transparent 55%),
    var(--bg);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(52px);
  opacity: 0.45;
  mix-blend-mode: screen;
}

.blob-a {
  width: min(42vw, 480px);
  height: min(42vw, 480px);
  left: -8%;
  top: 10%;
  background: radial-gradient(circle at 30% 30%, #5eead4, transparent 65%);
}

.blob-b {
  width: min(48vw, 520px);
  height: min(48vw, 520px);
  right: -12%;
  top: 15%;
  background: radial-gradient(circle at 40% 40%, #a78bfa, transparent 65%);
}

.blob-c {
  width: min(36vw, 400px);
  height: min(36vw, 400px);
  left: 35%;
  bottom: -12%;
  background: radial-gradient(circle at 50% 50%, #f472b6, transparent 65%);
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 204, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 204, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 18%, transparent 78%);
  pointer-events: none;
}

.glass {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-radius: var(--radius);
}

.app-shell {
  height: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 1.5rem) 0.85rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.site-header {
  flex: 0 0 auto;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: nowrap;
  padding: 0.55rem 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.site-nav-wrap {
  position: relative;
  flex-shrink: 0;
}

.site-nav-btn {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0.15rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.site-nav-btn:hover,
.site-nav-btn:focus-visible,
.site-nav-btn[aria-expanded="true"] {
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(94, 234, 212, 0.08);
  outline: none;
}

.site-nav-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 0.4rem);
  min-width: 12.5rem;
  z-index: 50;
  padding: 0.4rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  flex-direction: column;
  gap: 0.15rem;
  display: none;
}

.site-nav-menu.is-open {
  display: flex;
}

.site-nav-menu[hidden] {
  display: none !important;
}

.site-nav-menu .menu-item.is-active {
  background: rgba(94, 234, 212, 0.14);
  color: var(--cyan);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-text strong {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
}

.brand-text span {
  font-size: 0.72rem;
  color: var(--muted);
}

/* Destinations open only from the top-left icon at every width. */
.nav {
  display: none !important;
}

.auth-slot {
  flex-shrink: 0;
  position: relative;
  margin-left: auto;
}

@media (max-width: 800px) {
  .site-nav-menu.is-open {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    top: auto;
    bottom: 0.75rem;
    min-width: 0;
    padding: 0.55rem;
    border-radius: 18px;
    gap: 0.2rem;
  }

  .site-nav-menu .menu-item {
    padding: 0.9rem 1rem;
    font-size: 1.05rem;
    border-radius: 12px;
  }
}

.user-menu-wrap {
  position: relative;
}

.user-chip,
.user-chip-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.65rem 0.25rem 0.3rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.user-chip-btn:hover,
.user-chip-btn[aria-expanded="true"] {
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(94, 234, 212, 0.08);
}

/* Avatar face inside the chip button */
.user-avatar-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: linear-gradient(135deg, #5eead4, #a78bfa);
  color: #0a0f1c;
  flex-shrink: 0;
  overflow: hidden;
  pointer-events: none;
}

.user-chip-btn:hover .user-avatar-btn,
.user-chip-btn[aria-expanded="true"] .user-avatar-btn {
  border-color: rgba(94, 234, 212, 0.85);
  box-shadow: 0 0 0 2px rgba(94, 234, 212, 0.2);
}

.user-avatar-letter {
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1;
}

.user-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.8rem;
  background: linear-gradient(135deg, #5eead4, #a78bfa);
  color: #0a0f1c;
  flex-shrink: 0;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.chev {
  font-size: 0.7rem;
  opacity: 0.7;
  line-height: 1;
}

/* Hidden by default — display:flex must NOT override [hidden] */
.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  min-width: 11.5rem;
  z-index: 40;
  padding: 0.4rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  flex-direction: column;
  gap: 0.15rem;
  display: none;
}

.user-menu.is-open {
  display: flex;
}

.user-menu[hidden] {
  display: none !important;
}

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.menu-item:hover {
  background: rgba(94, 234, 212, 0.1);
  color: var(--cyan);
}

.menu-item-danger {
  color: var(--danger);
}

.menu-item-danger:hover {
  background: rgba(253, 164, 175, 0.12);
  color: #fecdd3;
}

.menu-sep {
  height: 1px;
  margin: 0.25rem 0.4rem;
  background: var(--line);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.stage {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.view.is-active {
  display: flex;
}

/* Home: text ~50% | image ~50% — equal height columns on desktop */
.home-layout {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.15rem;
  align-items: stretch;
  padding: 0.25rem 0;
}

.home-hero {
  padding: clamp(1.6rem, 3.5vw, 2.4rem);
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: auto;
  border: 2px solid #ffffff;
  box-shadow: var(--shadow);
}

.home-photo-wrap {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  min-height: 0;
  height: 100%;
  align-self: stretch;
}

.home-photo {
  margin: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border-radius: 28px;
  overflow: hidden;
  border: 2px solid #ffffff;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 11, 22, 0.55);
  box-shadow: var(--shadow);
}

/* Full image visible (only rounded corners clip) */
.home-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.eyebrow code {
  font-size: 0.78rem;
  color: var(--cyan);
  background: rgba(94, 234, 212, 0.08);
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.15);
}

.home-hero h1,
.view-head h2,
.about-panel h2,
.dlg-card h2 {
  margin: 0 0 0.75rem;
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.12;
}

.home-hero h1 {
  font-size: clamp(1.85rem, 3.6vw, 2.75rem);
  padding-right: 0.25rem;
}

.liquid-text {
  background: linear-gradient(120deg, #5eead4, #a78bfa 45%, #f472b6 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede,
.view-sub,
.modal-desc,
.about-panel p {
  margin: 0;
  color: var(--muted);
}

.lede {
  font-size: 1rem;
  max-width: 42ch;
  margin-top: 0.15rem;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.4rem;
}

#btn-signup.is-hidden {
  display: none !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  font-family: inherit;
  background: transparent;
  color: var(--ink);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #5eead4, #a78bfa 55%, #f472b6);
  color: #0a0f1c;
  box-shadow: 0 10px 28px rgba(167, 139, 250, 0.3);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
}

.view-head {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.9rem;
}

.view-head h2 {
  font-size: clamp(1.45rem, 2.8vw, 1.9rem);
}

.view-sub {
  margin-top: 0.2rem;
  font-size: 0.92rem;
}

.news-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.segmented {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 0.25rem;
  padding: 0.25rem;
  margin-bottom: 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(12, 18, 34, 0.55);
  max-width: 100%;
}

.segment {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.segment.is-active,
.segment[aria-selected="true"] {
  color: #0a0f1c;
  background: linear-gradient(135deg, #5eead4, #a78bfa);
}

.segment:hover:not(.is-active) {
  color: var(--ink);
}

/* Projects — always tall enough to show list */
.projects-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0.5rem;
  flex: 1 1 auto;
  min-height: 180px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.projects-list > li {
  margin: 0;
  padding: 0;
}

.project-name {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  text-align: left;
  padding: 1.05rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(18, 26, 48, 0.85);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.project-name:hover,
.project-name:focus-visible {
  border-color: rgba(94, 234, 212, 0.5);
  background: rgba(94, 234, 212, 0.08);
  outline: none;
}

.project-name-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: #f2f6ff;
}

.project-name-meta {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--cyan);
}

.projects-tabs {
  flex: 0 0 auto;
  margin-bottom: 0.75rem;
}

.project-group {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.project-group-title {
  margin: 0.35rem 0 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.modal-creator {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  color: var(--cyan);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.check-row input {
  width: auto;
}

.news-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.15rem 0.15rem 1rem;
  overscroll-behavior: contain;
}

.news-loading,
.news-empty {
  padding: 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line);
  color: var(--muted);
  background: rgba(12, 18, 34, 0.4);
}

.news-row {
  position: relative;
  display: block;
  flex: 0 0 auto;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(167, 139, 250, 0.08), rgba(12, 18, 34, 0.55));
  overflow: visible;
}

.news-row-link {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem 1rem;
  align-items: start;
  padding: 1rem 1.1rem;
  min-height: 4.5rem;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.news-row-link:hover,
.news-row-link:focus-visible {
  background: rgba(94, 234, 212, 0.07);
  outline: none;
}

.news-row-staff .news-row-link {
  padding-right: 5.5rem;
}

.news-row-pinned {
  border-color: rgba(250, 204, 21, 0.45);
  background: linear-gradient(
    145deg,
    rgba(250, 204, 21, 0.1),
    rgba(12, 18, 34, 0.55)
  );
}

.news-staff-actions {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.news-pin {
  height: 1.75rem;
  padding: 0 0.5rem;
  border: 1px solid rgba(250, 204, 21, 0.45);
  border-radius: 999px;
  background: rgba(12, 18, 34, 0.85);
  color: #fde68a;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  line-height: 1;
}

.news-pin:hover,
.news-pin.is-pinned {
  background: rgba(250, 204, 21, 0.18);
  color: #fef3c7;
}

.news-delete {
  width: 1.75rem;
  height: 1.75rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(253, 164, 175, 0.45);
  border-radius: 50%;
  background: rgba(12, 18, 34, 0.85);
  color: var(--danger);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.news-delete:hover {
  background: rgba(253, 164, 175, 0.2);
  color: #fecdd3;
}

.news-rank {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--cyan);
}

.news-row h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  line-height: 1.45;
  font-weight: 600;
  white-space: normal;
  overflow: visible;
  display: block;
  -webkit-line-clamp: unset;
}

.news-row-body {
  min-width: 0;
}

.news-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.news-link {
  align-self: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--violet);
  white-space: nowrap;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.1);
}

/* Videos */
.staff-panel {
  flex: 0 0 auto;
  margin-bottom: 0.85rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 0.55rem 0.65rem;
  align-items: end;
}

.inline-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.inline-form .span-2 {
  grid-column: 1 / -2;
}

.inline-form input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 24, 0.65);
  color: var(--ink);
  font: inherit;
}

.videos-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: grid;
  /* Larger cards so embeds are readable on phone */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 0.85rem;
  padding-bottom: 0.5rem;
  align-content: start;
}

.video-card {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid var(--line);
  overflow: hidden;
  min-height: 0;
  max-width: 100%;
}

.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  min-height: 160px;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-body {
  padding: 0.75rem 0.9rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1 1 auto;
}

.video-body h3 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-channel {
  margin: 0;
  font-size: 0.8rem;
  color: var(--cyan);
}

.video-desc {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-body .news-link {
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
  align-self: flex-start;
}

.video-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.video-actions .btn-sm {
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
}

.video-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.35rem;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
}

.check-row input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--cyan);
}

.news-sources-form select {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(12, 18, 34, 0.7);
  color: var(--text);
  font: inherit;
}

.news-sources-form textarea {
  width: 100%;
  min-height: 8rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 24, 0.65);
  color: var(--ink);
  font: inherit;
  font-family: var(--mono);
  font-size: 0.85rem;
  resize: vertical;
  line-height: 1.45;
}

.field-hint {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Official + Community side by side (especially mobile) */
.news-tabs-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
  flex: 0 0 auto;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.news-tab-group {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.3rem;
  flex: 1 1 0;
  min-width: 0;
}

.news-tab-label {
  margin: 0;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.news-tab-group .segmented {
  margin-bottom: 0;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
  padding: 0.18rem;
}

.news-tab-group .segment {
  flex: 1 1 auto;
  padding: 0.35rem 0.45rem;
  font-size: 0.72rem;
}

.btn-danger-text {
  color: var(--danger) !important;
}

/* Users admin */
.users-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex: 0 0 auto;
}

.search-field {
  flex: 1 1 220px;
}

.search-field input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 24, 0.65);
  color: var(--ink);
  font: inherit;
}

.users-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(240px, 1.1fr);
  gap: 0.85rem;
  overflow: hidden;
}

.users-list {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.user-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(18, 26, 48, 0.75);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.user-row:hover,
.user-row.is-active {
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(94, 234, 212, 0.08);
}

.user-row-name {
  font-weight: 700;
}

.user-row-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.user-detail {
  min-height: 0;
  overflow: auto;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.user-detail h3 {
  margin: 0.2rem 0 0.75rem;
  font-size: 1.2rem;
}

.detail-dl {
  margin: 0 0 1rem;
  display: grid;
  gap: 0.55rem;
}

.detail-dl > div {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.detail-dl dt {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.detail-dl dd {
  margin: 0;
  font-weight: 600;
}

.ud-role-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.ud-role-box label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.ud-role-box select {
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 24, 0.65);
  color: var(--ink);
  font: inherit;
}

.about-panel {
  padding: clamp(1.4rem, 3vw, 2.2rem);
  border-radius: 28px;
  max-width: 720px;
  overflow: auto;
  border: 1px solid var(--line);
}

.about-panel p {
  margin: 0 0 0.9rem;
}

.about-contact a {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 1rem;
}

.about-contact a:hover {
  text-decoration: underline;
}

/* Native dialogs */
.dlg {
  border: none;
  padding: 0;
  background: transparent;
  max-width: calc(100vw - 2rem);
  color: var(--ink);
}

.dlg::backdrop {
  background: rgba(3, 6, 14, 0.72);
  backdrop-filter: blur(6px);
}

.dlg-card {
  position: relative;
  width: min(440px, 92vw);
  max-height: min(88vh, 640px);
  overflow: auto;
  padding: 1.5rem 1.4rem 1.35rem;
  border-radius: 22px;
  border: 1px solid var(--line);
  margin: 0;
}

.modal-close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.modal-tagline {
  margin: 0 0 0.55rem;
  color: var(--cyan);
  font-weight: 600;
}

.modal-desc {
  margin: 0 0 0.9rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.build-stats {
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(7, 11, 22, 0.45);
}

.build-stats .eyebrow {
  margin-bottom: 0.45rem;
}

.build-stats ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.build-stats li {
  margin-bottom: 0.3rem;
}

.build-stats strong {
  color: var(--ink);
  font-weight: 600;
}

.projects-placeholder {
  padding: 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line);
  color: var(--muted);
  list-style: none;
}

.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 1.1rem;
}

.stack span {
  font-size: 0.72rem;
  font-family: var(--mono);
  padding: 0.2rem 0.45rem;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: #c5d0ea;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.auth-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
  padding-right: 2rem;
}

.auth-tab {
  flex: 1;
  padding: 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.auth-tab.is-active {
  color: #0a0f1c;
  background: linear-gradient(135deg, #5eead4, #a78bfa);
  border-color: transparent;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* display:flex above would otherwise override the hidden attribute */
.auth-form[hidden] {
  display: none !important;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.auth-form input,
.auth-form select,
.auth-form textarea {
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(7, 11, 22, 0.65);
  color: var(--ink);
  font: inherit;
}

.auth-form input:focus,
.auth-form select:focus,
.auth-form textarea:focus {
  outline: none;
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.12);
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.85rem;
}

.form-ok {
  margin: 0;
  color: var(--ok);
  font-size: 0.85rem;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
}

/* Profile */
.profile-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-bottom: 0.5rem;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
  align-items: start;
}

.profile-card {
  padding: 1.15rem 1.2rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 22px;
}

.avatar-studio {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-items: center;
}

#avatar-canvas {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #111;
  touch-action: none;
}

.avatar-controls {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.avatar-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.avatar-controls input[type="text"],
.avatar-controls input[type="file"] {
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(7, 11, 22, 0.65);
  color: var(--ink);
  font: inherit;
}

.avatar-controls input[type="color"] {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  padding: 0.2rem;
  cursor: pointer;
}

.file-label input[type="file"] {
  font-size: 0.8rem;
}

@media (max-width: 860px) {
  /* Stack tightly — full image, no crop, no empty band */
  .home-layout {
    height: auto;
    max-height: 100%;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 0.65rem;
    align-content: start;
    align-items: stretch;
    overflow: auto;
    padding: 0;
  }

  .home-photo-wrap {
    order: -1;
    height: auto;
    width: 100%;
    flex: 0 0 auto;
    align-self: stretch;
  }

  .home-photo {
    height: auto;
    max-height: none;
    width: 100%;
    max-width: 100%;
    aspect-ratio: auto;
    margin: 0;
  }

  .home-photo img {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
  }

  .home-hero {
    height: auto;
    max-height: none;
    padding: 1.15rem 1.2rem;
  }

  .home-actions #btn-signup.is-hidden {
    display: none !important;
  }

  .news-row-link {
    grid-template-columns: auto 1fr;
    gap: 0.55rem 0.75rem;
    padding: 0.7rem 0.85rem;
  }

  .news-row-staff .news-row-link {
    padding-right: 2.2rem;
  }

  .project-name {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .inline-form .span-2 {
    grid-column: 1;
  }

  .users-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .auth-slot {
    margin-left: auto;
  }

  .user-name {
    display: none;
  }

  .segment {
    padding: 0.35rem 0.5rem;
    font-size: 0.72rem;
  }

  .news-tabs-row {
    gap: 0.3rem;
  }

  .news-tab-label {
    font-size: 0.58rem;
  }

  .news-tab-group .segment {
    padding: 0.3rem 0.35rem;
    font-size: 0.68rem;
  }

  .news-tab-group {
    gap: 0.2rem;
  }
}

/* —— Learn / Lab LMS —— */
.learn-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.learn-home {
  padding: 1.1rem 1.2rem 1.2rem;
}

.learn-home h3 {
  margin: 0 0 0.4rem;
  font-family: var(--display);
  font-size: 1.15rem;
}

.learn-home .md-body,
.quest-body .md-body {
  color: var(--muted);
  font-size: 0.92rem;
}

.md-body p,
.md-body ul,
.md-body h3,
.md-body h4 {
  margin: 0.45rem 0 0;
}

.md-body ul {
  padding-left: 1.2rem;
}

.md-body code {
  font-size: 0.85em;
  color: var(--cyan);
}

.learn-voyage {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.learn-voyage-head {
  padding: 1rem 1.15rem;
}

.learn-voyage-head h3 {
  margin: 0.15rem 0 0.35rem;
  font-family: var(--display);
  font-size: clamp(1.15rem, 2vw, 1.4rem);
}

.learn-voyage-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.quest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 0.75rem;
}

.quest-card {
  padding: 0.95rem 1rem 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(14, 20, 38, 0.55);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  text-align: left;
  color: inherit;
  cursor: pointer;
  font: inherit;
  width: 100%;
}

.quest-card:hover {
  border-color: rgba(94, 234, 212, 0.4);
}

.quest-card.is-open {
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

.quest-card.is-done {
  border-color: rgba(52, 211, 153, 0.4);
}

.quest-card-top {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.quest-num {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(167, 139, 250, 0.18);
  color: var(--cyan);
}

.quest-card h4 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.quest-mini {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.quest-check {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  flex: 0 0 auto;
}

.quest-check input {
  width: 16px;
  height: 16px;
  accent-color: #34d399;
  cursor: pointer;
}

.quest-body {
  display: none;
  padding-top: 0.35rem;
  border-top: 1px solid var(--line);
}

.quest-card.is-open .quest-body {
  display: block;
}

.learn-unlock {
  padding: 1.1rem 1.2rem;
  border: 1px dashed rgba(167, 139, 250, 0.45);
  background: linear-gradient(
    135deg,
    rgba(94, 234, 212, 0.08),
    rgba(167, 139, 250, 0.1)
  );
}

.learn-unlock h3 {
  margin: 0.15rem 0 0.4rem;
  font-family: var(--display);
}

.learn-unlock p {
  margin: 0;
  color: var(--muted);
}

.learn-progress-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 560px) {
  .quest-card-top {
    flex-wrap: wrap;
  }
  .quest-check {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }
}

