:root {
  --bg: #0b0c0f;
  --panel: #12141a;
  --muted: #8a93a6;
  --text: #e8ecf1;
  --accent: #4f8cff;
  --accent-2: #7c4dff;
  --border: #222633;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    "Helvetica Neue",
    Arial,
    "Apple Color Emoji",
    "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

header {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #10131a 0%, #0b0c0f 100%);
}
.wrapper {
  max-width: 100%;
  margin: 0 auto;
  padding: 8px 16px;
}
.header__row {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 250px;
}
.brand__logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: conic-gradient(
    from 180deg,
    var(--accent),
    var(--accent-2),
    var(--accent)
  );
  box-shadow:
    0 0 0 2px #ffffff0a inset,
    0 8px 24px #00000066;
}
h1 {
  font-size: 16px;
  margin: 0;
  letter-spacing: 0.2px;
}
.tag {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}

.controls {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}
.control {
  display: grid;
  gap: 6px;
}
label {
  color: var(--muted);
  font-size: 12px;
}
select,
button {
  background: #0f1219;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}
select:hover,
button:hover {
  border-color: #2d3344;
}
button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
button.ghost {
  background: transparent;
}
.sr-only {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  min-height: 0;
}
@media (max-width: 900px) {
}

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: none;
  border-radius: 0;
  padding: 0;
  min-height: 0;
}
.panel__header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}
.panel__title {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}
.panel__body {
  padding: 12px;
}

.weeks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 65vh;
  overflow: auto;
  padding-right: 2px;
}
.week-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: #0e1118;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}
.week-item:hover {
  border-color: #2b3142;
}
.week-item.active {
  border-color: #3b4bff66;
  background: linear-gradient(180deg, #121726, #0e111e);
  box-shadow: 0 0 0 1px #3b4bff26 inset;
}
.week-item .title {
  font-size: 14px;
}
.week-item .meta {
  font-size: 12px;
  color: var(--muted);
}
.week-item .badge {
  font-size: 11px;
  color: #cfe0ff;
  background: #19305a;
  border: 1px solid #2b4fa1;
  padding: 2px 6px;
  border-radius: 6px;
  white-space: nowrap;
}

.viewer {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  background: #0e1118;
  aspect-ratio: auto;
  min-height: 0;
}
.viewer-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
.viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #0e121a, #0b0e15);
}
.spacer {
  flex: 1;
}

.alert {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f1218;
  color: var(--muted);
  font-size: 13px;
}
.alert.warn {
  border-color: #4a3a10;
  background: #191307;
  color: #f0cc83;
}
.alert.error {
  border-color: #4a1b1b;
  background: #1b0e0e;
  color: #ffb3b3;
}
.alert.info {
  border-color: #2a3346;
}

a {
  color: #9db7ff;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

footer {
  max-width: 1200px;
  margin: 0 auto 24px;
  padding: 0 16px;
  color: var(--muted);
  font-size: 12px;
}
code {
  background: #0e1118;
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 6px;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 12px;
}

/* === Layout bar & control overrides (migrated from inline <style>) === */
.layout-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 8px 16px 4px;
  background: linear-gradient(180deg, #10131a, #0d1016);
  border-bottom: 1px solid var(--border);
}

.layout-bar .control {
  gap: 4px;
}

.layout-bar .control label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
}

.viewer-container {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#messageOverlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: #0b0c0fcc;
  backdrop-filter: blur(2px);
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.btn-inline {
  background: #151b29;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}

.btn-inline:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tag.small {
  font-size: 11px;
  padding: 3px 6px;
}

.grow {
  flex: 1;
}

/* --- Weeks panel additions --- */
.weeks-panel {
  border-top: 1px solid var(--border);
  background: #0e1118;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px 16px;
}
.weeks-panel__header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.weeks-panel__title {
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.weeks-panel__legend {
  display: flex;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}
.legend-chip {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #10141d;
}
.legend-chip.current {
  border-color: #2b4fa1;
  background: #152338;
  color: #9db7ff;
}
.legend-chip.active {
  border-color: #3b4bff66;
  background: #121726;
  color: #d0d8ff;
}
.week-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.week-link {
  background: #121620;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}
.week-link:hover {
  border-color: #2d3344;
  background: #161b26;
}
.week-link.current {
  box-shadow: 0 0 0 1px #2b4fa1;
}
.week-link.active {
  background: linear-gradient(180deg, #121726, #0e111e);
  border-color: #3b4bff66;
  box-shadow: 0 0 0 1px #3b4bff26 inset;
}
