:root {
    --bg: #f7f6f2;
    --card: #ffffff;
    --ink: #111111;
    --muted: #6b6b6b;
    --line: #d8d8d8;
    --line-dark: #111111;
    --accent: #0a84ff;
    --danger: #b00020;
    --soft: #f1f1f1;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
    --success: #1f7a3f;
    --warning: #7b5c18;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
}

body.modal-open {
    overflow: hidden;
}

a {
    color: inherit;
}

.topbar,
.app {
    max-width: 1120px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 18px;
    padding-right: 18px;
}

.topbar {
    padding-top: 22px;
    padding-bottom: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand-mark {
    display: block;
    height: 28px;
    width: auto;
}

.nav,
.nav-left,
.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nav {
    justify-content: space-between;
    width: 100%;
}

.nav-link,
.pill,
.button,
.button-dark,
.button-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    text-decoration: none;
}

.pill,
.nav-link {
    border: 1px solid var(--line);
    background: #fff;
    padding: 8px 12px;
    font-size: 13px;
}

.pill {
    color: var(--muted);
}

.nav-link {
    color: var(--ink);
    font-weight: 700;
}

.button,
.button-dark,
.button-ghost {
    padding: 12px 18px;
    font-weight: 900;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
}

.button-dark,
.nav-link.primary {
    border-color: var(--line-dark);
    background: var(--ink);
    color: #fff;
}

.button-ghost {
    background: transparent;
}

.help-button {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    font-weight: 900;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
}

.app {
    margin-bottom: 80px;
}

.app-narrow {
    max-width: 760px;
}

.app-wide {
    max-width: 1120px;
}

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 26px;
}

.panel + .panel {
    margin-top: 18px;
}

.panel-muted {
    background: rgba(255, 255, 255, 0.8);
}

.home-layout,
.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 18px;
    align-items: start;
}

.home-main,
.dashboard-main {
    min-width: 0;
}

.sidebar-stack {
    display: grid;
    gap: 18px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 22px;
}

.card {
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 18px;
    background: #fff;
}

.card h2,
.panel h2 {
    margin: 0 0 10px;
    font-size: 18px;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 14px;
}

.meta-row span:first-child {
    color: var(--muted);
}

.stack {
    display: grid;
    gap: 18px;
}

h1,
h2,
h3 {
    letter-spacing: -0.06em;
}

h1 {
    margin: 0 0 6px;
    font-size: 42px;
    line-height: 1;
}

.eyebrow,
.section-title {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.sub {
    margin: 0 0 22px;
    color: var(--muted);
    font-size: 16px;
}

.dropzone {
    min-height: 310px;
    border: 2px solid #b9b9b9;
    border-radius: 24px;
    background: #fbfbfb;
    display: grid;
    place-items: center;
    padding: 22px;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
    overflow: hidden;
}

.dropzone:hover,
.dropzone.is-dragging {
    border-color: var(--accent);
    background: #f5faff;
}

.dropzone:focus {
    outline: 4px solid rgba(10, 132, 255, 0.18);
    outline-offset: 3px;
}

.dropzone.has-image {
    min-height: 380px;
    background: #fff;
}

.drop-inner {
    display: grid;
    gap: 10px;
    justify-items: center;
}

.upload-mark {
    width: 62px;
    height: 62px;
    border: 1px solid var(--line);
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-size: 28px;
    background: #fff;
}

.drop-title {
    font-size: 18px;
    font-weight: 800;
}

.drop-help,
.meta,
.muted {
    color: var(--muted);
    font-size: 14px;
}

.preview {
    max-width: 100%;
    max-height: 520px;
    object-fit: contain;
    border-radius: 18px;
    display: none;
}

.file-name {
    margin-top: 12px;
    color: var(--muted);
    font-size: 13px;
    display: none;
    word-break: break-word;
}

.dropzone.has-image .drop-inner {
    display: none;
}

.dropzone.has-image .preview,
.dropzone.has-image .file-name {
    display: block;
}

.section {
    margin-top: 24px;
}

.ratio-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.ratio-card {
    appearance: none;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    padding: 16px 8px;
    min-height: 132px;
    cursor: pointer;
    display: grid;
    justify-items: center;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.ratio-card:hover {
    transform: translateY(-1px);
    border-color: #999;
}

.ratio-card.is-selected {
    border-color: var(--line-dark);
    box-shadow: inset 0 0 0 2px var(--line-dark);
    background: #fafafa;
}

.ratio-shape {
    width: var(--shape-w);
    height: var(--shape-h);
    border: 2px solid currentColor;
    border-radius: 6px;
    background: #f2f2f2;
    display: block;
}

.ratio-label {
    font-weight: 900;
    font-size: 15px;
}

.ratio-name {
    font-size: 12px;
    color: var(--muted);
}

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

.field label {
    font-size: 14px;
    font-weight: 800;
    color: var(--muted);
}

.input,
.textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px 16px;
    font: inherit;
    background: #fff;
    color: var(--ink);
}

.textarea {
    min-height: 140px;
    resize: vertical;
}

.option-row,
.cta-row,
.split-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.dtf {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 10px 14px;
    background: #fff;
    cursor: pointer;
    user-select: none;
    font-weight: 800;
}

.dtf input {
    width: 17px;
    height: 17px;
    margin: 0;
}

.dtf small {
    font-weight: 700;
    color: var(--muted);
}

.go {
    appearance: none;
    border: 0;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    min-width: 104px;
}

.go:disabled {
    background: #9d9d9d;
    cursor: not-allowed;
}

.message,
.notice,
.error {
    margin-top: 16px;
    border-radius: 16px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    font-size: 14px;
}

.message,
.error {
    background: #fff4f4;
    color: var(--danger);
    border-color: #ffd0d0;
    display: none;
}

.message.is-visible,
.error.is-visible {
    display: block;
}

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

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

.card-item {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    padding: 16px;
}

.card-item-title {
    font-weight: 900;
    text-decoration: none;
}

.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 8px 12px;
    background: var(--soft);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.checker {
    border-radius: 20px;
    border: 1px solid var(--line);
    overflow: hidden;
    min-height: 260px;
    display: grid;
    place-items: center;
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #ddd 25%, transparent 25%),
        linear-gradient(-45deg, #ddd 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ddd 75%),
        linear-gradient(-45deg, transparent 75%, #ddd 75%);
    background-size: 24px 24px;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.result-img {
    max-width: 100%;
    max-height: 620px;
    object-fit: contain;
    display: block;
}

.download-row {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    padding: 12px 18px;
    font-weight: 900;
    font-size: 14px;
}

.download.secondary {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
}

.account-menu {
    position: relative;
}

.account-menu summary {
    list-style: none;
    cursor: pointer;
}

.account-menu summary::-webkit-details-marker {
    display: none;
}

.account-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 6px 8px 6px 6px;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--ink);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}

.account-copy {
    display: grid;
    gap: 2px;
    text-align: left;
    min-width: 0;
}

.account-copy strong,
.account-copy span {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-copy strong {
    font-size: 13px;
}

.account-copy span {
    font-size: 12px;
    color: var(--muted);
}

.account-popover {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 220px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow);
    display: grid;
    gap: 6px;
    z-index: 20;
}

.account-popover a {
    text-decoration: none;
    border-radius: 12px;
    padding: 10px 12px;
    font-weight: 700;
}

.account-popover a:hover {
    background: var(--soft);
}

.thumbnail-row {
    display: grid;
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.thumb {
    width: 68px;
    height: 68px;
    border-radius: 14px;
    border: 1px solid var(--line);
    object-fit: cover;
    background: #fff;
}

.content-list {
    display: grid;
    gap: 14px;
}

.content-list h3 {
    margin: 0 0 6px;
    font-size: 18px;
}

.content-list p,
.faq-item p,
.terms-copy p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.faq-item {
    padding: 16px 0;
    border-top: 1px solid var(--line);
}

.faq-item:first-child {
    border-top: 0;
    padding-top: 0;
}

.terms-copy {
    display: grid;
    gap: 16px;
}

.footer-links {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
}

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

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 17, 17, 0.42);
}

.modal-card {
    position: relative;
    width: min(620px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 24px;
}

.modal-close {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
}

.back {
    display: inline-flex;
    margin-bottom: 14px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 800;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

@media (max-width: 960px) {
    .home-layout,
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    h1 {
        font-size: 34px;
    }

    .panel {
        padding: 20px;
        border-radius: 24px;
    }

    .ratio-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .option-row,
    .cta-row,
    .split-row,
    .nav {
        align-items: stretch;
        flex-direction: column;
    }

    .nav-right,
    .nav-left {
        width: 100%;
    }

    .go,
    .button,
    .button-dark,
    .button-ghost,
    .nav-link,
    .pill {
        width: 100%;
    }

    .help-button {
        width: 100%;
        height: 42px;
    }

    .account-trigger {
        width: 100%;
        justify-content: flex-start;
    }

    .account-popover {
        position: static;
        width: 100%;
        margin-top: 10px;
    }
}

@media (max-width: 440px) {
    .ratio-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }
}
