:root {
    --bg: #f7f7f3;
    --paper: #ffffff;
    --ink: #18212f;
    --muted: #5c6573;
    --line: #dde3ea;
    --accent: #1358db;
    --accent-soft: #eef4ff;
    --warm: #faf6ea;
    --ok: #1a6a42;
    --shadow: 0 20px 50px rgba(24, 33, 47, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(19, 88, 219, 0.08), transparent 28%),
        linear-gradient(180deg, #fbfbf8 0%, var(--bg) 100%);
    font-family: "RIDIBatang", serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

img {
    display: block;
    max-width: 100%;
}

.page {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 60px;
}

.hero {
    display: grid;
    gap: 18px;
    padding: 18px 0 24px;
}

.hero-main {
    padding: 32px 34px;
    border: 1px solid var(--line);
    border-radius: 30px;
    background: linear-gradient(180deg, #ffffff 0%, #f6f8fc 100%);
    box-shadow: var(--shadow);
}

.eyebrow,
.section-kicker {
    margin: 0 0 12px;
    color: var(--accent);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    border: 1px solid rgba(19, 88, 219, 0.12);
    font-weight: 700;
}

.hero-main h1 {
    display: block;
    max-width: 100%;
    margin: 0;
    color: var(--ink);
    font-family: "KOHIBaeumOTF", serif;
    font-weight: 400;
    font-size: clamp(2.2rem, 4.6vw, 4.3rem);
    line-height: 1.08;
    letter-spacing: -0.04em;
    word-break: keep-all;
}

.hero-copy {
    max-width: 880px;
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.78;
}

.hero-image {
    margin: 0;
    overflow: hidden;
    border-radius: 28px;
    border: 1px solid var(--line);
    background: var(--paper);
    box-shadow: var(--shadow);
}

.hero-image img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    background: #ffffff;
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
    align-items: start;
}

.panel,
.rail-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.panel {
    overflow: hidden;
}

.panel-body {
    padding: 28px;
}

.block {
    display: grid;
    gap: 16px;
}

.block + .block {
    margin-top: 28px;
}

.block-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.block-head h2,
.result-head h2,
.rail-card h3 {
    margin: 0;
}

.block-head h2,
.result-head h2 {
    font-size: clamp(1.25rem, 2vw, 1.8rem);
    line-height: 1.2;
    letter-spacing: -0.03em;
}

.status-pill,
.template-btn,
.secondary-btn,
.text-btn,
.primary-btn,
.example-chip {
    border-radius: 999px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.status-pill {
    border: 1px solid var(--line);
    background: var(--accent-soft);
    color: var(--accent);
    padding: 10px 14px;
    line-height: 1.4;
}

.status-pill.warn {
    background: #fff5e9;
    color: #935220;
    border-color: #f0d8b9;
}

.prompt-input,
.prompt-preview,
.triple-grid input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    color: var(--ink);
    padding: 14px 15px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.prompt-input,
.prompt-preview {
    min-height: 180px;
    resize: vertical;
    line-height: 1.75;
}

.triple-grid input {
    min-height: 54px;
}

.prompt-input:focus,
.prompt-preview:focus,
.triple-grid input:focus {
    outline: none;
    border-color: rgba(19, 88, 219, 0.5);
    box-shadow: 0 0 0 4px rgba(19, 88, 219, 0.08);
    transform: translateY(-1px);
}

.template-buttons,
.examples-list,
.pick-grid,
.matrix-grid,
.notes-list,
.rail-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.template-btn,
.secondary-btn,
.text-btn,
.primary-btn,
.example-chip {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    min-height: 42px;
    padding: 0 16px;
}

.template-btn.is-active {
    border-color: #0f4ec5;
    background: linear-gradient(135deg, #0f5fff 0%, #1358db 100%);
    color: #ffffff;
    box-shadow: 0 12px 28px rgba(19, 88, 219, 0.16);
}

.primary-btn {
    border-color: #0f4ec5;
    background: linear-gradient(135deg, #0f5fff 0%, #1358db 100%);
    color: #ffffff;
    min-height: 54px;
    padding: 0 26px;
    box-shadow: 0 16px 30px rgba(19, 88, 219, 0.18);
}

.text-btn {
    border-color: transparent;
    background: transparent;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.template-btn:hover,
.secondary-btn:hover,
.text-btn:hover,
.primary-btn:hover,
.example-chip:hover {
    transform: translateY(-1px);
}

.template-btn:disabled,
.secondary-btn:disabled,
.text-btn:disabled,
.primary-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.triple-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.inline-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.examples-box {
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fbfcff;
    padding: 14px 16px 16px;
}

.examples-box summary {
    cursor: pointer;
    color: var(--accent);
    font-weight: 700;
}

.examples-list {
    margin-top: 14px;
}

.example-chip {
    min-height: 38px;
    background: var(--accent-soft);
    color: var(--accent);
}

.summary-block {
    margin-top: 30px;
    padding-top: 4px;
    border-top: 1px solid var(--line);
}

.summary-card,
.result-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.summary-card > div,
.result-stat,
.pick-card,
.matrix-card,
.notes-list > div {
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fbfcff;
    padding: 16px;
}

.summary-label,
.result-stat span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.9rem;
}

.summary-card strong,
.result-stat strong {
    display: block;
    line-height: 1.6;
}

.notice-box,
.error-box {
    display: none;
    border-radius: 18px;
    padding: 15px 16px;
    line-height: 1.65;
}

.notice-box {
    border: 1px solid #eadbbd;
    background: var(--warm);
    color: #7d4a20;
}

.error-box {
    border: 1px solid #f0c9bf;
    background: #fff5f2;
    color: #8d3521;
}

.notice-box.is-visible,
.error-box.is-visible {
    display: block;
}

.submit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.submit-copy,
.rail-item,
.result-head p,
.pick-card p,
.matrix-card,
.idea-row,
.notes-list > div {
    color: var(--muted);
    line-height: 1.7;
}

.submit-copy {
    max-width: 620px;
    margin: 0;
}

.result-panel {
    display: none;
    padding: 0 28px 28px;
}

.result-panel.is-visible {
    display: block;
    animation: fadeUp 0.28s ease;
}

.result-grid {
    display: grid;
    gap: 20px;
}

.result-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
    flex-wrap: wrap;
}

.result-head p {
    margin: 8px 0 0;
}

.result-block {
    display: grid;
    gap: 14px;
}

.pick-grid,
.matrix-grid {
    display: grid;
    grid-template-columns: 1fr;
}

.pick-card h3,
.matrix-card h3 {
    margin: 0 0 10px;
}

.pick-combo,
.matrix-sub {
    display: inline-flex;
    margin-bottom: 10px;
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 700;
}

.idea-list {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.idea-item {
    padding: 14px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: #ffffff;
}

.idea-item strong {
    display: block;
    margin-bottom: 8px;
}

.notes-list {
    display: grid;
    gap: 12px;
}

.prompt-preview {
    min-height: 220px;
}

.side-rail {
    display: grid;
    gap: 16px;
    position: sticky;
    top: 22px;
}

.rail-card {
    padding: 22px;
}

.rail-card h3 {
    margin-bottom: 12px;
    font-size: 1.02rem;
}

.rail-list {
    display: grid;
    gap: 14px;
}

.rail-item strong {
    display: block;
    margin-bottom: 4px;
    color: var(--ink);
}

.rail-links {
    display: grid;
    gap: 10px;
}

.rail-links a {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fbfcff;
    padding: 12px 14px;
}

.rail-reset-button {
    width: 100%;
    margin-top: 16px;
    justify-content: center;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1080px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .side-rail {
        position: static;
    }
}

@media (max-width: 720px) {
    .page {
        width: min(100%, calc(100% - 20px));
        padding-top: 18px;
    }

    .panel-body,
    .rail-card,
    .result-panel {
        padding: 22px;
    }

    .triple-grid,
    .summary-card,
    .result-summary {
        grid-template-columns: 1fr;
    }

    .hero-main h1 {
        font-size: 2.3rem;
    }

    .submit-row,
    .block-head,
    .result-head {
        align-items: stretch;
    }

    .primary-btn {
        width: 100%;
    }
}
