:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-2: #eef2f8;
    --text: #172033;
    --muted: #68758b;
    --line: #dce3ee;
    --brand: #ff3b30;
    --brand-dark: #d92a22;
    --accent: #1f64ff;
    --success: #138a55;
    --danger: #c62828;
    --shadow: 0 18px 50px rgba(20, 32, 55, .10);
    --radius: 18px;
    --container: 1180px;
}

* { box-sizing: border-box; }

html { scroll-padding-top: 88px; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
        "Yu Gothic", Meiryo, sans-serif;
    line-height: 1.65;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.container {
    width: min(calc(100% - 32px), var(--container));
    margin-inline: auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid rgba(220, 227, 238, .9);
    backdrop-filter: blur(14px);
}

.header-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -.03em;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    aspect-ratio: 1;
    border-radius: 10px;
    background: var(--brand);
    color: white;
    font-size: .9rem;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 20px;
    color: #3a465a;
    font-size: .94rem;
    font-weight: 700;
}

.main-nav form { margin: 0; }

.link-button {
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0;
    font-weight: 700;
}

.button {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border: 1px solid var(--brand);
    border-radius: 999px;
    background: var(--brand);
    color: white;
    font-weight: 800;
    box-shadow: 0 8px 22px rgba(255, 59, 48, .22);
    transition: transform .16s ease, background .16s ease;
}

.button:hover { transform: translateY(-1px); background: var(--brand-dark); }

.button-secondary {
    border-color: var(--line);
    background: white;
    color: var(--text);
    box-shadow: none;
}

.button-secondary:hover { background: var(--surface-2); }

.button-danger {
    border-color: var(--danger);
    background: var(--danger);
}

.button-small {
    min-height: 38px;
    padding: 7px 15px;
    font-size: .88rem;
}

.full-width { width: 100%; }

.hero {
    overflow: hidden;
    background:
        radial-gradient(circle at 78% 30%, rgba(31, 100, 255, .18), transparent 26%),
        radial-gradient(circle at 15% 20%, rgba(255, 59, 48, .17), transparent 30%),
        linear-gradient(135deg, #fff 0%, #f2f6ff 100%);
    border-bottom: 1px solid var(--line);
}

.hero-inner {
    min-height: 560px;
    display: grid;
    grid-template-columns: 1.12fr .88fr;
    align-items: center;
    gap: 70px;
    padding-block: 74px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--brand);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .18em;
}

.hero h1, .page-header h1 {
    margin: 0;
    font-size: clamp(2.5rem, 6vw, 5.1rem);
    line-height: 1.06;
    letter-spacing: -.06em;
}

.hero-copy {
    max-width: 620px;
    margin: 26px 0 0;
    color: #526078;
    font-size: 1.12rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 34px;
}

.hero-visual {
    position: relative;
    padding: 28px;
    border: 1px solid rgba(255,255,255,.8);
    border-radius: 28px;
    background: rgba(255,255,255,.72);
    box-shadow: var(--shadow);
    transform: rotate(-2deg);
}

.schedule-line {
    display: grid;
    grid-template-columns: 76px 1fr;
    align-items: center;
    gap: 16px;
    min-height: 92px;
    padding: 0 22px;
    border-bottom: 1px solid var(--line);
}

.schedule-line:last-child { border-bottom: 0; }
.schedule-line span { color: var(--muted); font-variant-numeric: tabular-nums; }
.schedule-line strong { font-size: 1.08rem; }
.schedule-line.active {
    margin-inline: -14px;
    border: 0;
    border-radius: 16px;
    background: var(--brand);
    color: white;
    box-shadow: 0 12px 30px rgba(255,59,48,.3);
}
.schedule-line.active span { color: rgba(255,255,255,.78); }

.section { padding-block: 72px; }

.section-heading, .page-header-row {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
}

.section-heading { margin-bottom: 28px; }

.section-heading h2, .playlist-header h2 {
    margin: 0;
    font-size: clamp(1.7rem, 3vw, 2.45rem);
    letter-spacing: -.04em;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.category-grid a {
    display: flex;
    min-height: 84px;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface);
    font-weight: 800;
    transition: transform .16s ease, border-color .16s ease;
}

.category-grid a:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.program-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.program-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 9px 25px rgba(20,32,55,.06);
}

.program-card-thumbnail {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #20293a;
}

.program-card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .24s ease;
}

.program-card:hover .program-card-thumbnail img { transform: scale(1.035); }

.thumbnail-placeholder {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    color: white;
    font-size: 2rem;
}

.video-count {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 4px 9px;
    border-radius: 8px;
    background: rgba(10,13,20,.82);
    color: white;
    font-size: .78rem;
    font-weight: 800;
}

.program-card-body { padding: 20px; }

.category-chip {
    display: inline-flex;
    padding: 4px 9px;
    border-radius: 999px;
    background: #ffe9e7;
    color: #b6251e;
    font-size: .72rem;
    font-weight: 900;
}

.program-card h2 {
    margin: 12px 0 8px;
    font-size: 1.16rem;
    line-height: 1.45;
    letter-spacing: -.02em;
}

.program-card p {
    min-height: 3.2em;
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
}

.program-card-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    color: var(--muted);
    font-size: .74rem;
}

.page-header {
    padding-block: 64px;
    background: linear-gradient(135deg, #fff, #f1f5ff);
    border-bottom: 1px solid var(--line);
}

.page-header.compact { padding-block: 42px; }
.page-header.compact h1 { font-size: clamp(2rem, 4vw, 3.2rem); }
.page-header p:last-child { margin-bottom: 0; color: var(--muted); }

.empty-state {
    padding: 68px 24px;
    border: 1px dashed #bfc9d8;
    border-radius: var(--radius);
    background: rgba(255,255,255,.62);
    text-align: center;
}

.empty-state h2, .empty-state h3 { margin-top: 0; }
.empty-state p { color: var(--muted); }
.empty-state .button { margin-top: 12px; }

.flash {
    margin-top: 20px;
    padding: 15px 18px;
    border-radius: 12px;
    border: 1px solid;
}

.flash-success { background: #e9f8f0; color: #0c673e; border-color: #a9dec2; }
.flash-error { background: #fff0f0; color: #8d2020; border-color: #efb6b6; }
.flash ul { margin: 8px 0 0; padding-left: 20px; }

.auth-section {
    min-height: calc(100vh - 160px);
    display: grid;
    place-items: center;
    padding: 64px 16px;
}

.auth-card {
    width: min(100%, 520px);
    padding: 42px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: white;
    box-shadow: var(--shadow);
    text-align: center;
}

.auth-card h1 { margin: 0; font-size: 2.2rem; }
.auth-card > p { color: var(--muted); }

.social-buttons {
    display: grid;
    gap: 12px;
    margin-top: 28px;
}

.social-button {
    min-height: 52px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    font-weight: 800;
}

.social-button.google { background: white; }
.social-button.x { background: #111; color: white; border-color: #111; }
.fine-print { margin-top: 22px; font-size: .78rem; }

.dashboard-list {
    display: grid;
    gap: 12px;
}

.dashboard-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
}

.dashboard-row h2 { margin: 8px 0 3px; font-size: 1.15rem; }
.dashboard-row p { margin: 0; color: var(--muted); font-size: .84rem; }

.status-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
    color: var(--muted);
    font-size: .78rem;
}

.status {
    padding: 3px 8px;
    border-radius: 999px;
    font-weight: 900;
}

.status-published { background: #e5f7ee; color: #087241; }
.status-draft { background: #edf0f5; color: #526078; }
.status-review { background: #fff3d7; color: #875b00; }
.status-archived { background: #ffe8e8; color: #9a2424; }

.row-actions { display: flex; align-items: center; gap: 14px; white-space: nowrap; }

.editor-section { max-width: 1100px; }

.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 28px;
    align-items: start;
}

.form-main, .form-sidebar {
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: white;
}

.form-sidebar {
    position: sticky;
    top: 96px;
}

.field + .field { margin-top: 26px; }
.field label { display: block; margin-bottom: 8px; font-weight: 800; }
.field label span { color: var(--brand); font-size: .75rem; }

.field input, .field textarea, .field select,
.admin-table select {
    width: 100%;
    border: 1px solid #cbd4e1;
    border-radius: 10px;
    background: white;
    color: var(--text);
    padding: 11px 13px;
    outline: none;
}

.field input:focus, .field textarea:focus, .field select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(31,100,255,.12);
}

.field-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.field-heading label { margin: 0; }

.field-help {
    margin: 7px 0 14px;
    color: var(--muted);
    font-size: .82rem;
}

.video-editor-list { display: grid; gap: 9px; }

.video-editor-row {
    display: grid;
    grid-template-columns: 30px 28px minmax(0, 1fr) 34px;
    align-items: center;
    gap: 8px;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #f9fbfe;
}

.video-editor-row.dragging { opacity: .45; border-color: var(--accent); }
.drag-handle { cursor: grab; color: var(--muted); text-align: center; }
.order-number { font-size: .8rem; color: var(--muted); text-align: center; }
.video-editor-row input { padding: 9px 10px; }

.remove-video {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: #ffe8e8;
    color: #a52222;
    font-size: 1.25rem;
}

.publish-box {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.publish-box h2 { margin: 0; font-size: 1.15rem; }
.publish-box p { color: var(--muted); font-size: .82rem; }
.publish-box .button + .button { margin-top: 10px; }

.danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-top: 32px;
    padding: 20px 24px;
    border: 1px solid #efc1c1;
    border-radius: 14px;
    background: #fff7f7;
}

.danger-zone p { margin: 2px 0 0; color: #845151; font-size: .84rem; }

.program-page { padding-block: 30px 72px; }

.program-breadcrumb {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    color: var(--muted);
    font-size: .82rem;
}

.program-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(320px, .85fr);
    gap: 24px;
    align-items: start;
}

.player-shell {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: 18px;
    background: #111;
    box-shadow: var(--shadow);
}

.player-shell iframe { width: 100%; height: 100%; }

.player-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.player-controls > :last-child { justify-self: end; }

.control-button {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: white;
    padding: 7px 14px;
    font-weight: 800;
}

.control-button:disabled { opacity: .4; cursor: default; }
.player-message { margin: 10px 0 0; color: var(--muted); font-size: .84rem; }

.program-info {
    margin-top: 26px;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: white;
}

.program-title-row {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 20px;
}

.program-info h1 {
    margin: 10px 0 0;
    font-size: clamp(1.65rem, 3vw, 2.6rem);
    line-height: 1.3;
    letter-spacing: -.04em;
}

.program-description { white-space: pre-wrap; color: #46536a; }

.program-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .8rem;
}

.editorial-note {
    margin-top: 20px;
    padding: 15px;
    border-radius: 12px;
    background: #f5f7fb;
}

.editorial-note p { margin: 5px 0 0; }

.playlist-column {
    position: sticky;
    top: 96px;
    overflow: hidden;
    max-height: calc(100vh - 122px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: white;
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--line);
}

.playlist-header h2 { font-size: 1.35rem; }

.playlist {
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 8px;
}

.playlist li + li { margin-top: 4px; }

.playlist button {
    width: 100%;
    display: grid;
    grid-template-columns: 26px 104px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 9px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    text-align: left;
}

.playlist button:hover { background: #f2f5fa; }
.playlist button.active { background: #ffeceb; outline: 1px solid #ffc4c1; }

.playlist-position { color: var(--muted); text-align: center; font-size: .8rem; }
.playlist img { width: 104px; aspect-ratio: 16/9; object-fit: cover; border-radius: 7px; }
.playlist-copy { min-width: 0; }
.playlist-copy strong {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: .86rem;
    line-height: 1.45;
}
.playlist-copy small {
    display: block;
    overflow: hidden;
    margin-top: 5px;
    color: var(--muted);
    font-size: .7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: white;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

.admin-table th, .admin-table td {
    padding: 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.admin-table th { background: #f4f7fb; font-size: .76rem; }
.admin-table td { font-size: .84rem; }
.admin-table td small { display: block; color: var(--muted); }
.admin-table form { display: flex; gap: 8px; }
.admin-table select { min-width: 110px; padding: 7px 9px; }

.pagination { margin-top: 32px; }
.pagination nav > div:first-child { display: none; }
.pagination nav > div:last-child { display: flex; justify-content: space-between; align-items: center; }
.pagination svg { width: 18px; }
.pagination a, .pagination span {
    display: inline-flex;
    min-width: 36px;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    background: white;
    padding: 6px 10px;
}

.site-footer {
    border-top: 1px solid var(--line);
    background: white;
    color: var(--muted);
    font-size: .78rem;
}

.footer-inner {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

@media (max-width: 980px) {
    .hero-inner { grid-template-columns: 1fr; min-height: auto; }
    .hero-visual { max-width: 620px; }
    .program-grid { grid-template-columns: repeat(2, 1fr); }
    .category-grid { grid-template-columns: repeat(2, 1fr); }
    .program-layout { grid-template-columns: 1fr; }
    .playlist-column { position: static; max-height: none; }
    .playlist { max-height: 560px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-sidebar { position: static; }
}

@media (max-width: 720px) {
    html { scroll-padding-top: 76px; }
    .header-inner { min-height: 64px; }
    .main-nav > a:not(.button), .main-nav form { display: none; }
    .hero-inner { padding-block: 54px; gap: 40px; }
    .hero h1 { font-size: 3rem; }
    .section { padding-block: 50px; }
    .program-grid, .category-grid { grid-template-columns: 1fr; }
    .page-header-row, .section-heading { align-items: start; flex-direction: column; }
    .dashboard-row { align-items: start; flex-direction: column; }
    .row-actions { width: 100%; justify-content: flex-end; }
    .form-main, .form-sidebar, .program-info { padding: 18px; }
    .player-controls { grid-template-columns: 1fr 1fr; }
    .player-controls .button { grid-column: 1 / -1; grid-row: 1; }
    .player-controls > :last-child { justify-self: stretch; }
    .control-button { width: 100%; }
    .program-title-row { flex-direction: column; }
    .program-title-row .button { align-self: flex-end; }
    .playlist button { grid-template-columns: 24px 88px minmax(0, 1fr); }
    .playlist img { width: 88px; }
    .danger-zone { align-items: start; flex-direction: column; }
    .footer-inner { padding-block: 22px; align-items: start; flex-direction: column; gap: 2px; }
}
