@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@400;500;600;700;800&display=swap');

:root {
  --ink: #141327;
  --muted: #6b7280;
  --brand: #5b4bdb;
  --brand-deep: #241b52;
  --brand-bright: #7c5cff;
  --danger: #e11d48;
  --surface: #ffffff;
  --bg: #f4f5fb;
  --border: #e5e7f0;
  --radius: 20px;
  --shadow: 0 24px 60px -30px rgba(26, 20, 74, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Raleway, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

img {
  max-width: 100%;
}

p,
h1,
h2,
h3 {
  margin: 0;
}

.muted {
  color: var(--muted);
}

/* ---------- boot ---------- */
.boot-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: linear-gradient(160deg, #1b1440, #3a2d91 55%, #6c52ff);
  color: #fff;
  z-index: 50;
}

.boot-screen p {
  font-size: 14px;
  letter-spacing: 0.03em;
  opacity: 0.85;
}

.spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

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

/* ---------- shared button ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 13px 20px;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.btn:disabled {
  opacity: 0.65;
  cursor: progress;
  transform: none !important;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-bright));
  box-shadow: 0 14px 28px -14px rgba(91, 75, 219, 0.85);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 18px 32px -14px rgba(91, 75, 219, 0.95);
}

.btn-ghost {
  color: var(--ink);
  background: #fff;
  border-color: var(--border);
}

.btn-ghost:hover {
  border-color: #c9cbe0;
}

/* ---------- auth ---------- */
.auth-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
  background:
    radial-gradient(900px 500px at 12% 8%, rgba(124, 92, 255, 0.4), transparent 60%),
    radial-gradient(800px 500px at 88% 92%, rgba(225, 29, 72, 0.24), transparent 60%),
    linear-gradient(160deg, #17122f, #2a2160 55%, #4a37b4);
}

.auth-card {
  width: min(940px, 100%);
  background: #fff;
  border-radius: 28px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  box-shadow: 0 40px 80px -40px rgba(6, 2, 30, 0.8);
}

.auth-brand {
  position: relative;
  padding: 46px 42px;
  color: #fff;
  background: linear-gradient(155deg, #241b52, #4c3fd1 62%, #7c5cff);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
}

.auth-brand::before,
.auth-brand::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.auth-brand::before {
  width: 320px;
  height: 320px;
  right: -140px;
  top: -130px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 65%);
}

.auth-brand::after {
  width: 280px;
  height: 280px;
  left: -110px;
  bottom: -120px;
  background: radial-gradient(circle, rgba(225, 29, 72, 0.35), transparent 65%);
}

.brand-badge {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  background: #fff;
  display: grid;
  place-items: center;
  padding: 10px;
  box-shadow: 0 18px 34px -18px rgba(0, 0, 0, 0.7);
  position: relative;
  z-index: 1;
}

.brand-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-badge.small {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  padding: 7px;
  flex: none;
}

.auth-brand h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  position: relative;
  z-index: 1;
}

.auth-brand h1 span {
  color: #ffd166;
}

.brand-copy {
  font-size: 15px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.82);
  max-width: 30ch;
  position: relative;
  z-index: 1;
}

.auth-points {
  list-style: none;
  margin: auto 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.auth-points li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
}

.tick {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  flex: none;
}

.auth-form {
  padding: 46px 42px;
  display: flex;
  flex-direction: column;
}

.auth-form h2 {
  font-size: 26px;
  letter-spacing: -0.02em;
}

.auth-form > .muted {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.5;
}

form {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
}

label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6c6a86;
  margin-bottom: 8px;
}

input {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: #f8f8fd;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  margin-bottom: 18px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

input::placeholder {
  color: #a5a5b8;
}

input:focus {
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(91, 75, 219, 0.14);
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 66px;
}

.reveal {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--brand);
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
}

.reveal:hover {
  background: rgba(91, 75, 219, 0.08);
}

.form-error,
.form-success {
  font-size: 13.5px;
  line-height: 1.45;
  padding: 11px 13px;
  border-radius: 10px;
  margin: 0 0 16px;
}

.form-error {
  color: #a30f33;
  background: #fff1f4;
  border: 1px solid #ffd3dd;
}

.form-success {
  color: #12603c;
  background: #eefbf4;
  border: 1px solid #c8f0da;
}

#login-submit {
  width: 100%;
  margin-top: 4px;
  padding: 15px;
}

.fineprint {
  margin-top: auto;
  padding-top: 26px;
  font-size: 12px;
  color: #9b99ae;
  text-align: center;
}

.auth-card.single {
  display: block;
  width: min(520px, 100%);
  padding: 38px;
}

.single-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 6px;
}

.single-head .brand-badge {
  background: linear-gradient(150deg, #241b52, #6c52ff);
}

.single-head .brand-badge img {
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

.single-head h2 {
  font-size: 22px;
}

.single-head .muted {
  margin-top: 3px;
  font-size: 13.5px;
  line-height: 1.45;
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 4px;
}

.form-actions .btn-primary {
  flex: 1 1 220px;
}

/* ---------- dashboard ---------- */
.app-view {
  min-height: 100vh;
  background:
    radial-gradient(1000px 480px at 100% -10%, rgba(124, 92, 255, 0.12), transparent 60%),
    var(--bg);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.app-brand img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  padding: 3px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
}

.app-brand em {
  font-style: normal;
  color: var(--brand);
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: #a30f33;
  background: #fff1f4;
  border: 1px solid #ffd3dd;
  border-radius: 999px;
  padding: 8px 13px;
  white-space: nowrap;
}

.pill svg {
  width: 16px;
  height: 16px;
  fill: var(--danger);
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--brand);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.icon-btn:hover {
  transform: translateY(-1px);
  border-color: #c9cbe0;
}

.icon-btn-danger {
  color: var(--danger);
}

.icon-btn-danger:hover {
  background: #fff1f4;
  border-color: #ffd3dd;
}

.app-main {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) clamp(16px, 4vw, 40px) 60px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.page-heading h1 {
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.page-heading .muted {
  margin-top: 6px;
  font-size: 15px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #12603c;
  background: #eefbf4;
  border: 1px solid #c8f0da;
  padding: 8px 13px;
  border-radius: 999px;
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16);
}

.state-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px;
  text-align: center;
  box-shadow: var(--shadow);
}

.skeleton-row {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.skeleton-row span {
  flex: 1;
  height: 8px;
  border-radius: 99px;
  background: linear-gradient(90deg, #eef0f8, #f7f8fd, #eef0f8);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.state-card .btn {
  margin-top: 16px;
}

.meeting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
}

.stream-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 44px -34px rgba(26, 20, 74, 0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.stream-card:hover {
  transform: translateY(-3px);
  border-color: #cfd2e8;
  box-shadow: 0 28px 50px -30px rgba(26, 20, 74, 0.55);
}

.stream-art {
  position: relative;
  min-height: 148px;
  padding: 16px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(280px 160px at 85% 10%, rgba(255, 209, 102, 0.3), transparent 65%),
    radial-gradient(260px 180px at 5% 100%, rgba(225, 29, 72, 0.35), transparent 65%),
    linear-gradient(145deg, #201844, #3b2c98 58%, #6c52ff);
  overflow: hidden;
}

.stream-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.5;
}

.play {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 26px -10px rgba(0, 0, 0, 0.6);
  position: relative;
  z-index: 1;
  transition: transform 0.2s ease;
}

.stream-card:hover .play {
  transform: scale(1.08);
}

.play svg {
  width: 24px;
  height: 24px;
  fill: var(--brand);
  margin-left: 3px;
}

.live-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(10, 8, 26, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.24);
  padding: 5px 9px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.live-tag .dot {
  width: 6px;
  height: 6px;
  box-shadow: none;
}

.stream-logo {
  position: absolute;
  right: 12px;
  bottom: 10px;
  width: 46px;
  height: 46px;
  object-fit: contain;
  opacity: 0.9;
  z-index: 1;
}

.stream-body {
  padding: 16px 16px 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stream-body h3 {
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.stream-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.stream-meta .watch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--brand);
  font-weight: 700;
}

.stream-meta .watch svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  transition: transform 0.18s ease;
}

.stream-card:hover .watch svg {
  transform: translateX(3px);
}

.footnote {
  margin-top: 30px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #8f8da4;
  text-align: center;
  max-width: 60ch;
  margin-left: auto;
  margin-right: auto;
}

.state-card.error {
  border-color: #ffd3dd;
}

.state-card.error h3 {
  font-size: 17px;
  color: #a30f33;
}

.state-card.error p {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .auth-card {
    grid-template-columns: 1fr;
    max-width: 480px;
  }

  .auth-brand {
    padding: 26px 26px 24px;
    gap: 10px;
  }

  .brand-badge {
    width: 60px;
    height: 60px;
    border-radius: 16px;
  }

  .auth-brand h1 {
    font-size: 26px;
  }

  .brand-copy,
  .auth-points {
    display: none;
  }

  .auth-form {
    padding: 28px 26px 30px;
  }

  .auth-card.single {
    padding: 26px;
  }
}

@media (max-width: 600px) {
  .app-header {
    padding: 11px 14px;
  }

  .app-brand span {
    display: none;
  }

  .app-header-right {
    gap: 7px;
  }

  .pill {
    font-size: 11.5px;
    padding: 7px 10px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .live-badge {
    align-self: flex-start;
  }

  .meeting-grid {
    grid-template-columns: 1fr;
  }

  .form-actions .btn {
    flex: 1 1 100%;
  }
}

/* ---------- iPhone / foldable safe areas ---------- */
@supports (height: 100dvh) {
  .auth-view,
  .app-view {
    min-height: 100dvh;
  }
}

@supports (padding: env(safe-area-inset-top)) {
  .app-header {
    padding-top: calc(14px + env(safe-area-inset-top));
    padding-left: max(clamp(16px, 4vw, 40px), env(safe-area-inset-left));
    padding-right: max(clamp(16px, 4vw, 40px), env(safe-area-inset-right));
  }

  .app-main {
    padding-left: max(clamp(16px, 4vw, 40px), env(safe-area-inset-left));
    padding-right: max(clamp(16px, 4vw, 40px), env(safe-area-inset-right));
  }

  .auth-view {
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
    padding-bottom: max(28px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 430px) {
  .auth-view {
    padding: calc(14px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
      calc(14px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .auth-card {
    border-radius: 20px;
  }

  .auth-brand {
    padding: 22px 20px 20px;
  }

  .auth-brand h1 {
    font-size: 24px;
  }

  .brand-badge {
    width: 56px;
    height: 56px;
    border-radius: 15px;
  }

  .auth-form {
    padding: 24px 20px 26px;
  }

  .app-header {
    padding: calc(10px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
      10px max(12px, env(safe-area-inset-left));
    gap: 8px;
  }

  .app-header-right {
    gap: 6px;
  }

  .app-brand img {
    width: 34px;
    height: 34px;
  }

  .app-main {
    padding: 18px max(14px, env(safe-area-inset-right))
      calc(44px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  }

  .page-heading h1 {
    font-size: 26px;
  }

  .pill {
    padding: 7px 9px;
    font-size: 11px;
  }

  .meeting-grid {
    gap: 14px;
  }

  .stream-art {
    min-height: 136px;
  }

  .footnote {
    margin-top: 22px;
  }
}

@media (max-width: 350px) {
  .app-brand {
    gap: 8px;
    font-size: 16px;
  }

  .pill {
    padding: 6px 8px;
    font-size: 10.5px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .page-heading h1 {
    font-size: 24px;
  }

  .auth-form h2 {
    font-size: 22px;
  }
}
