:root {
    color-scheme: light;
    --bg: #f4e6da;
    --bg-deep: #ead7c9;
    --paper: #fffaf5;
    --paper-strong: #ffffff;
    --ink: #2d211b;
    --muted: #7b685d;
    --line: rgba(94, 70, 56, 0.16);
    --line-strong: rgba(94, 70, 56, 0.26);
    --accent: #d56f4a;
    --accent-deep: #ab4f2f;
    --accent-soft: rgba(213, 111, 74, 0.12);
    --accent-lilac: #c594c8;
    --accent-sky: #8db7df;
    --success: #39795b;
    --warning: #936126;
    --danger: #b84f4f;
    --radius-xl: 30px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --shadow-lg: 0 28px 48px rgba(113, 76, 54, 0.12);
    --shadow-md: 0 16px 28px rgba(113, 76, 54, 0.08);
    --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 right, rgba(255, 255, 255, 0.55), transparent 28%),
        linear-gradient(180deg, #f7ede4 0%, var(--bg) 45%, var(--bg-deep) 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 18% 20%, rgba(213, 111, 74, 0.12), transparent 14%),
        radial-gradient(circle at 76% 24%, rgba(197, 148, 200, 0.12), transparent 16%),
        radial-gradient(circle at 62% 76%, rgba(141, 183, 223, 0.14), transparent 18%);
}

body.app-ready .atelier-hero,
body.app-ready .atelier-layout,
body.app-ready .notice {
    animation: fadeUp 440ms var(--ease-soft) both;
}

body.app-ready .atelier-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,
.band-title {
    margin: 0;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #8b7266;
}

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

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

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

h3 {
    font-size: 1.14rem;
    line-height: 1.12;
}

.lead,
.stage-head p,
.voice-panel p,
.state-sheet p,
.form-note,
.field-note,
.result-copy,
.bullet-list,
.ad-head p,
.notice p {
    color: var(--muted);
}

.atelier-hero,
.voice-panel,
.draft-stage,
.state-sheet,
.panel,
.notice,
.modal-panel,
.result-card {
    border: 1px solid var(--line);
    background: rgba(255, 250, 245, 0.92);
    box-shadow: var(--shadow-lg);
}

.atelier-hero {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 30px;
    padding: 34px 36px;
    border-radius: 36px 36px 64px 36px;
    margin-bottom: 24px;
}

.atelier-hero::after {
    content: "";
    position: absolute;
    right: 34px;
    bottom: -46px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(213, 111, 74, 0.1);
    filter: blur(4px);
}

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

.lead {
    margin: 0;
    max-width: 64ch;
    line-height: 1.72;
}

.tone-spectrum {
    display: grid;
    gap: 12px;
    align-content: start;
}

.swatch {
    min-height: 64px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-radius: 999px;
    color: #fffaf4;
    font-weight: 800;
    box-shadow: var(--shadow-md);
}

.swatch-1 {
    background: linear-gradient(135deg, #ef9b73, #db6f4f);
}

.swatch-2 {
    background: linear-gradient(135deg, #a58dda, #7560b5);
}

.swatch-3 {
    background: linear-gradient(135deg, #6ea2da, #4f7fb2);
}

.swatch-4 {
    background: linear-gradient(135deg, #8ec1ac, #5c8f78);
}

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

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

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

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

.hidden {
    display: none !important;
}

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

.voice-column,
.workbench,
.right-rail {
    display: grid;
    gap: 20px;
}

.voice-panel,
.draft-stage,
.state-sheet,
.panel {
    padding: 24px;
    border-radius: 28px;
}

.voice-panel {
    border-top-left-radius: 40px;
    background: linear-gradient(180deg, rgba(255, 250, 245, 0.95), rgba(248, 236, 226, 0.92));
}

.voice-panel-accent {
    background:
        linear-gradient(180deg, rgba(213, 111, 74, 0.12), rgba(255, 250, 245, 0.95)),
        rgba(255, 250, 245, 0.95);
}

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

.marker-list li {
    display: grid;
    gap: 4px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(94, 70, 56, 0.12);
}

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

.marker-list span {
    line-height: 1.6;
}

.draft-stage {
    border-radius: 42px 42px 26px 26px;
    background:
        linear-gradient(90deg, rgba(213, 111, 74, 0.08), transparent 14%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 247, 240, 0.94));
}

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

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

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

.message-frame {
    padding: 16px;
    border-radius: 28px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 245, 238, 0.88));
    border: 1px solid rgba(94, 70, 56, 0.12);
}

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

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

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

.tuning-ribbon {
    display: grid;
    gap: 18px;
    padding: 18px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.54);
    border: 1px dashed rgba(94, 70, 56, 0.18);
}

.ribbon-group {
    display: grid;
    gap: 14px;
}

.triple-row,
.double-row {
    display: grid;
    gap: 16px;
}

.triple-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

textarea,
input[type="text"],
select {
    width: 100%;
    min-height: 56px;
    padding: 15px 16px;
    border-radius: 16px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.88);
    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.72;
}

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

textarea:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: rgba(213, 111, 74, 0.46);
    box-shadow: 0 0 0 4px rgba(213, 111, 74, 0.12);
    transform: translateY(-1px);
}

.field-note {
    font-size: 0.88rem;
    line-height: 1.55;
}

.action-footer {
    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;
}

#convert-button,
.copy-button {
    color: #fff;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep) 100%);
    box-shadow: 0 12px 24px rgba(171, 79, 47, 0.18);
}

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

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

.state-sheet {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(251, 241, 232, 0.92));
}

.state-sheet strong {
    display: block;
    margin: 10px 0 8px;
    font-size: 1.52rem;
    line-height: 1.05;
}

.state-sheet-soft {
    background:
        linear-gradient(180deg, rgba(197, 148, 200, 0.16), rgba(255, 250, 245, 0.94)),
        rgba(255, 250, 245, 0.92);
}

.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: 20px;
    border: 1px solid rgba(94, 70, 56, 0.12);
    background: rgba(255, 255, 255, 0.72);
}

.ad-placeholder {
    padding: 16px;
}

.ad-mockup {
    min-height: 360px;
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(213, 111, 74, 0.08), rgba(197, 148, 200, 0.08)),
        repeating-linear-gradient(135deg, transparent 0, transparent 16px, rgba(94, 70, 56, 0.04) 16px, rgba(94, 70, 56, 0.04) 17px);
    display: grid;
    place-items: center;
    align-content: center;
    gap: 12px;
}

.ad-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(213, 111, 74, 0.35);
}

.ad-copy {
    color: var(--accent-deep);
    font-size: 1.8rem;
    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(79, 53, 42, 0.32);
    backdrop-filter: blur(10px);
}

.modal-panel {
    position: relative;
    width: min(1040px, 100%);
    max-height: min(88vh, 980px);
    overflow: auto;
    padding: 28px;
    border-radius: 30px;
    background: rgba(255, 250, 245, 0.96);
}

.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.7;
    color: var(--muted);
}

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

.result-card {
    padding: 22px;
    border-radius: 22px;
    background: var(--paper-strong);
    border: 1px solid rgba(94, 70, 56, 0.1);
    box-shadow: var(--shadow-md);
}

.result-card-primary {
    background:
        linear-gradient(180deg, rgba(213, 111, 74, 0.08), rgba(255, 255, 255, 0.94)),
        #fff;
}

.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, #458969 0%, #306650 100%);
}

.notice.is-visible,
.result-stack.is-entering,
.modal.is-visible .modal-panel {
    animation: fadeUp 320ms var(--ease-soft) both;
}

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

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

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

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

    .atelier-hero,
    .triple-row,
    .double-row {
        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%, #8a7367 50%),
        linear-gradient(135deg, #8a7367 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;
}
