/* ===== CSS Custom Properties ===== */
:root {
    --color-bg: #faf9f7;
    --color-surface: #ffffff;
    --color-text: #1a1a1a;
    --color-text-secondary: #5c5c5c;
    --color-accent: #c44536;
    --color-accent-hover: #a8382b;
    --color-border: #e0ded9;
    --color-border-light: #f0eee9;
    --color-success: #2d6a4f;
    --color-optional: #b08968;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    --max-width: 1280px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Accessibility ===== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: 2px; }

/* ===== Header ===== */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 700;
    font-size: 1.25rem;
}
.logo-text { letter-spacing: -0.02em; }
.site-nav a {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
}
.site-nav a:hover { background: var(--color-border-light); color: var(--color-text); }

/* ===== Main Layout ===== */
.app-layout {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
    flex: 1;
}
@media (max-width: 900px) {
    .app-layout { grid-template-columns: 1fr; }
}

/* ===== Planner Panel ===== */
.planner-panel {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}
.planner-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}
.subtitle { color: var(--color-text-secondary); font-size: 0.95rem; margin-bottom: 1.25rem; }

/* ===== Controls ===== */
.controls-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.25rem;
}
.control-group { display: flex; gap: 0.25rem; align-items: center; }
#franchise-select {
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    min-width: 220px;
}
.mode-switch { background: var(--color-border-light); border-radius: var(--radius-sm); padding: 3px; }
.mode-btn {
    padding: 0.45rem 0.85rem;
    border: none;
    background: transparent;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all 0.15s;
}
.mode-btn.active { background: var(--color-surface); color: var(--color-text); font-weight: 600; box-shadow: var(--shadow-sm); }
.mode-btn:hover:not(.active) { color: var(--color-text); }

/* ===== Entry List ===== */
.list-container { min-height: 100px; }
.entry-list { list-style: none; display: flex; flex-direction: column; gap: 1px; }
.entry-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 0.75rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    transition: box-shadow 0.15s, border-color 0.15s;
    cursor: default;
}
.entry-item.dragging { opacity: 0.5; box-shadow: var(--shadow-md); }
.entry-item.drag-over { border-color: var(--color-accent); background: #fef5f3; }
.entry-item.optional { border-style: dashed; border-color: var(--color-optional); }
.entry-item.watched { opacity: 0.65; }
.entry-item.watched .entry-title { text-decoration: line-through; }

.drag-handle {
    cursor: grab;
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    letter-spacing: -2px;
    user-select: none;
    padding: 0 2px;
}
.drag-handle:active { cursor: grabbing; }

.watch-toggle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.watch-toggle.checked {
    background: var(--color-success);
    border-color: var(--color-success);
}
.watch-toggle.checked::after {
    content: "✓";
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
}

.entry-info { flex: 1; min-width: 0; }
.entry-title { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-meta { font-size: 0.8rem; color: var(--color-text-secondary); }
.entry-type {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--color-border-light);
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    color: var(--color-text-secondary);
    flex-shrink: 0;
}
.entry-item.optional .entry-type { background: #fdf3ed; color: var(--color-optional); }

.remove-entry {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.15s;
}
.remove-entry:hover { color: var(--color-accent); background: #fef5f3; }

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--color-text-secondary);
}

/* ===== Add Entry Form ===== */
.add-entry-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}
.add-entry-form input {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    flex: 1;
    min-width: 120px;
}
#new-year { flex: 0 0 90px; min-width: 70px; }

/* ===== Buttons ===== */
.btn {
    padding: 0.55rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
}
.btn-primary { background: var(--color-accent); color: white; border-color: var(--color-accent); }
.btn-primary:hover { background: var(--color-accent-hover); }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: var(--color-border-light); }

/* ===== Action Bar ===== */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    align-items: center;
}
.save-status { font-size: 0.8rem; color: var(--color-success); margin-left: 0.5rem; }

/* ===== Progress ===== */
.progress-summary {
    margin-top: 1.25rem;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
progress {
    height: 8px;
    border-radius: 4px;
    flex: 1;
    min-width: 100px;
}
progress::-webkit-progress-bar { background: var(--color-border-light); border-radius: 4px; }
progress::-webkit-progress-value { background: var(--color-success); border-radius: 4px; }
progress::-moz-progress-bar { background: var(--color-success); border-radius: 4px; }

/* ===== Info Panel ===== */
.info-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.info-block {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}
.info-block h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}
.info-block p, .info-block li { font-size: 0.88rem; color: var(--color-text-secondary); line-height: 1.55; }
.info-block ul { padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.4rem; }
.info-block li strong { color: var(--color-text); }

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin: 0.5rem 0;
}
.comparison-table th {
    text-align: left;
    font-weight: 600;
    padding: 0.35rem 0.5rem;
    border-bottom: 2px solid var(--color-border);
    color: var(--color-text);
}
.comparison-table td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--color-border-light);
    color: var(--color-text-secondary);
}
.table-note { font-size: 0.78rem; color: var(--color-text-secondary); margin-top: 0.25rem; font-style: italic; }

/* ===== Footer ===== */
.site-footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 1.5rem 1.25rem;
    margin-top: auto;
}
.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    text-align: center;
    font-size: 0.82rem;
    color: var(--color-text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.footer-inner a { color: var(--color-accent); text-decoration: none; }
.footer-inner a:hover { text-decoration: underline; }
.footer-links { display: flex; gap: 1rem; justify-content: center; }
.footer-version { font-size: 0.75rem; color: #999; }

/* ===== Print Styles ===== */
@media print {
    .site-header, .site-footer, .info-panel, .controls-bar, .add-entry-form, .action-bar, .drag-handle, .remove-entry, .watch-toggle { display: none !important; }
    .app-layout { display: block; padding: 0; }
    .planner-panel { box-shadow: none; border: none; padding: 0; }
    .entry-item { break-inside: avoid; border: 1px solid #ccc; margin-bottom: 2px; }
    .entry-item.watched .entry-title { text-decoration: line-through; }
    body { font-size: 12px; }
}

@media (max-width: 600px) {
    .planner-panel { padding: 1rem; }
    .controls-bar { flex-direction: column; align-items: stretch; }
    #franchise-select { min-width: 100%; }
    .add-entry-form { flex-direction: column; }
    #new-year { flex: 1; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
