:root {
    color-scheme: light;
    --bg: #e8e8e8;
    --bg-deep: #d8d8d8;
    --paper: #ffffff;
    --paper-soft: #f4f4f4;
    --ink: #101010;
    --muted: #5f5f5f;
    --line: rgba(16, 16, 16, 0.12);
    --line-strong: rgba(16, 16, 16, 0.2);
    --accent: #111111;
    --accent-soft: rgba(17, 17, 17, 0.08);
    --success: #2d7756;
    --warning: #8d641f;
    --danger: #b74f4f;
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 14px 26px rgba(0, 0, 0, 0.05);
    --ease-soft: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.6), transparent 26%),
        linear-gradient(180deg, #f0f0f0 0%, var(--bg) 44%, var(--bg-deep) 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(17, 17, 17, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(17, 17, 17, 0.04) 1px, transparent 1px);
    background-size: 30px 30px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.32), transparent 88%);
}

body.app-ready .masthead,
body.app-ready .newsroom-layout,
body.app-ready .notice {
    animation: fadeUp 420ms var(--ease-soft) both;
}

body.app-ready .newsroom-layout {
    animation-delay: 70ms;
}

body.is-busy {
    cursor: progress;
}

body.is-modal-open {
    overflow: hidden;
}

.shell {
    width: min(1440px, calc(100% - 40px));
    margin: 28px auto 42px;
    position: relative;
    z-index: 1;
}

.shell > .notice {
    margin-bottom: 24px;
}

.eyebrow,
.card-kicker,
.zone-title {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #6c6c6c;
}

h1,
h2,
h3,
strong {
    margin: 0;
    letter-spacing: -0.05em;
}

h1 {
    font-size: 30px;
    line-height: 1.04;
}

h2 {
    font-size: 1.58rem;
    line-height: 1.08;
}

h3 {
    font-size: 1.1rem;
    line-height: 1.1;
}

.lead,
.sheet-head p,
.source-sheet p,
.dispatch-sheet p,
.form-note,
.mode-note,
.notice,
.result-copy,
.bullet-list,
.ad-head p {
    color: var(--muted);
}

.masthead,
.source-sheet,
.copydesk-sheet,
.dispatch-sheet,
.panel,
.notice,
.modal-panel,
.result-card {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-lg);
}

.masthead {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 28px;
    padding: 30px 32px;
    border-radius: 22px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.masthead::after {
    content: "";
    position: absolute;
    left: 32px;
    right: 32px;
    bottom: 22px;
    height: 2px;
    background: linear-gradient(90deg, #111111 0 20%, transparent 20% 100%);
}

.masthead-copy {
    display: grid;
    gap: 14px;
}

.lead {
    margin: 0;
    max-width: 66ch;
    line-height: 1.74;
}

.masthead-strip {
    display: grid;
    gap: 10px;
    align-content: start;
}

.masthead-strip span {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: var(--paper-soft);
    font-weight: 800;
}

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

.source-column,
.desk-column,
.dispatch-column {
    display: grid;
    gap: 20px;
}

.source-sheet,
.copydesk-sheet,
.dispatch-sheet,
.panel {
    padding: 24px;
    border-radius: 22px;
}

.source-sheet {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(244, 244, 244, 0.94));
}

.source-sheet-soft {
    background: linear-gradient(180deg, rgba(17, 17, 17, 0.08), rgba(255, 255, 255, 0.96));
}

.source-list {
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 14px;
}

.source-list li {
    display: grid;
    gap: 4px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(16, 16, 16, 0.1);
}

.source-list li:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.copydesk-sheet {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 248, 248, 0.96));
    border-radius: 26px;
}

.sheet-head {
    display: grid;
    gap: 10px;
    margin-bottom: 24px;
}

.sheet-head p {
    margin: 0;
    line-height: 1.72;
}

.thread-form {
    display: grid;
    gap: 20px;
}

.field {
    display: grid;
    gap: 10px;
}

.field > span {
    font-size: 0.94rem;
    font-weight: 800;
}

.field-lg textarea {
    min-height: 250px;
}

.edit-zones {
    display: grid;
    gap: 18px;
}

.zone {
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 18px;
    background: rgba(244, 244, 244, 0.88);
    border: 1px solid rgba(16, 16, 16, 0.1);
}

.field-grid {
    display: grid;
    gap: 16px;
}

.field-grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

textarea,
input[type="text"],
select {
    width: 100%;
    min-height: 56px;
    padding: 15px 16px;
    border-radius: 14px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.94);
    color: var(--ink);
    font: inherit;
    transition: border-color 180ms var(--ease-soft), box-shadow 180ms var(--ease-soft), transform 180ms var(--ease-soft);
}

textarea {
    resize: vertical;
    line-height: 1.68;
}

textarea::placeholder,
input[type="text"]::placeholder {
    color: #8b8b8b;
}

textarea:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: rgba(17, 17, 17, 0.34);
    box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.08);
    transform: translateY(-1px);
}

.sheet-actions {
    display: grid;
    gap: 14px;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 0 20px;
    border-radius: 999px;
    border: 0;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform 180ms var(--ease-soft), box-shadow 180ms var(--ease-soft), opacity 180ms var(--ease-soft);
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

#clean-button,
.copy-button {
    color: #ffffff;
    background: linear-gradient(180deg, #1c1c1c 0%, #000000 100%);
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.16);
}

.ghost-button {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
}

.form-note {
    margin: 0;
    line-height: 1.66;
}

.notice {
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 18px;
}

.notice.warning {
    color: var(--warning);
    background: #f5ede0;
}

.notice.error {
    color: var(--danger);
    background: #faecec;
}

.notice.success {
    color: var(--success);
    background: #edf6ef;
}

.hidden {
    display: none !important;
}

.dispatch-sheet {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 245, 245, 0.94));
}

.dispatch-sheet strong {
    display: block;
    margin: 10px 0 8px;
    font-size: 1.46rem;
    line-height: 1.06;
}

.dispatch-sheet-soft {
    background: linear-gradient(180deg, rgba(17, 17, 17, 0.06), rgba(255, 255, 255, 0.96));
}

.ad-shell {
    display: grid;
    gap: 18px;
}

.ad-head {
    display: grid;
    gap: 8px;
}

.ad-head p {
    margin: 0;
    line-height: 1.66;
}

.ad-slot,
.ad-placeholder {
    border-radius: 18px;
    border: 1px solid rgba(16, 16, 16, 0.12);
    background: rgba(245, 245, 245, 0.92);
}

.ad-placeholder {
    padding: 16px;
}

.ad-mockup {
    min-height: 360px;
    border-radius: 16px;
    border: 1px dashed rgba(16, 16, 16, 0.18);
    display: grid;
    place-content: center;
    gap: 12px;
    justify-items: center;
    background:
        linear-gradient(rgba(16, 16, 16, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(16, 16, 16, 0.03) 1px, transparent 1px);
    background-size: 18px 18px;
}

.ad-label {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(17, 17, 17, 0.1);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.ad-copy {
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    z-index: 30;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(32, 32, 32, 0.34);
    backdrop-filter: blur(10px);
}

.modal-panel {
    position: relative;
    width: min(1080px, 100%);
    max-height: min(88vh, 980px);
    overflow: auto;
    padding: 28px;
    border-radius: 24px;
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.modal-head p {
    margin: 10px 0 0;
    line-height: 1.72;
    color: var(--muted);
}

.result-stack {
    display: grid;
    gap: 16px;
}

.result-card {
    padding: 22px;
    border-radius: 18px;
    background: var(--paper);
    box-shadow: var(--shadow-md);
}

.result-card-primary {
    background: linear-gradient(180deg, rgba(17, 17, 17, 0.06), rgba(255, 255, 255, 0.98));
}

.result-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.result-copy {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 0.94rem;
    line-height: 1.74;
}

.bullet-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 8px;
}

.copy-button.is-copied {
    background: linear-gradient(180deg, #3a7a58 0%, #295840 100%);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@media (max-width: 920px) {
    .shell {
        width: min(100% - 24px, 100%);
    }

    .masthead,
    .field-grid-two {
        grid-template-columns: 1fr;
    }

    .modal-head,
    .result-head,
    .action-row {
        flex-direction: column;
        align-items: stretch;
    }

    button,
    .ghost-button,
    .copy-button {
        width: 100%;
    }
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 54px;
    background-image:
        linear-gradient(45deg, transparent 50%, #6f7784 50%),
        linear-gradient(135deg, #6f7784 50%, transparent 50%);
    background-position:
        calc(100% - 24px) calc(50% - 3px),
        calc(100% - 18px) calc(50% - 3px);
    background-size: 7px 7px, 7px 7px;
    background-repeat: no-repeat;
    cursor: pointer;
}
