:root {
  --bg: #eef2f8;
  --panel: #f9fbff;
  --panel-strong: #ffffff;
  --sidebar: #1d2a3a;
  --sidebar-soft: #27384c;
  --border: #d9e0eb;
  --text: #18222f;
  --muted: #586778;
  --brand: #3c77d8;
  --brand-soft: rgba(60, 119, 216, 0.12);
  --shadow: 0 20px 40px rgba(22, 31, 44, 0.1);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

body {
  min-height: 100vh;
}

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-soft));
  color: #eef4ff;
  padding: 32px 22px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f9a14b, #d76921);
  color: white;
  font-size: 1.6rem;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(217, 105, 33, 0.4);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(238, 244, 255, 0.7);
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: 1.8rem;
  line-height: 1.1;
}

.week-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-item {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 16px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.nav-item:hover {
  transform: translateX(2px);
  border-color: rgba(255, 255, 255, 0.18);
}

.nav-item.active {
  background: var(--brand-soft);
  border-color: rgba(168, 196, 255, 0.35);
}

.nav-item.muted {
  opacity: 0.75;
}

.nav-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.78;
  margin-bottom: 6px;
}

.nav-title {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
}

.main-panel {
  padding: 32px 28px 40px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
  padding: 0 4px;
}

.page-header > div {
  flex: 1 1 auto;
  min-width: 0;
}

.page-header h2 {
  font-size: clamp(1.8rem, 2vw, 2.5rem);
  width: 100%;
  max-width: none;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: normal;
  overflow-wrap: break-word;
  line-height: 1.1;
}

.header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 999px;
  text-decoration: none;
  background: var(--brand);
  color: white;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(60, 119, 216, 0.2);
}

.embed-shell {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
  overflow: hidden;
}

.thread-embed {
  width: 100%;
  min-height: 0;
  background: transparent;
}

.thread-load-error {
  margin: 0;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding-bottom: 18px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 700px) {
  .page-header h2 {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
}
