:root {
    --bg: #ffffff;
    --surface: #fffdf9;
    --surface-strong: #f7f2ec;
    --text: #111111;
    --muted: #5f5a55;
    --line: #d7d0c8;
    --line-strong: #b9a999;
    --blue: #1d4ed8;
    --blue-soft: #eef4ff;
    --brown: #8b5e3c;
    --brown-soft: #f7efe8;
    --success: #166534;
    --warning: #9a3412;
    --danger: #b91c1c;
    --shadow: 0 22px 60px rgba(35, 25, 15, 0.08);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --max-width: 1180px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(29, 78, 216, 0.08), transparent 34%),
        radial-gradient(circle at top right, rgba(139, 94, 60, 0.1), transparent 28%),
        linear-gradient(180deg, #ffffff 0%, #fffdfa 100%);
    color: var(--text);
    font: 16px/1.55 "Segoe UI", Aptos, sans-serif;
}

a {
    color: var(--blue);
    text-decoration: none;
}

a:hover {
    color: var(--brown);
}

button,
input,
select,
textarea {
    font: inherit;
}

textarea,
select,
input[type="file"] {
    width: 100%;
}

textarea,
select {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--text);
    padding: 0.9rem 1rem;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

textarea:focus,
select:focus,
button:focus-visible,
.text-button:focus-visible,
.upload-zone:focus-within {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.13);
}

textarea {
    resize: vertical;
    min-height: 220px;
}

.page-shell {
    width: min(var(--max-width), calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.1rem 0 3rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.site-header,
.tool-section,
.howto-section,
.about-section,
.content-grid,
.details-section,
.faq-section,
.example-section,
.related-section,
.site-footer {
    position: relative;
    z-index: 1;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0 1.3rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 2.7rem;
    height: 2.7rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--blue) 0%, var(--brown) 100%);
    color: #ffffff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.15rem;
}

.header-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1.1rem;
    font-size: 0.95rem;
}

.header-nav a {
    color: var(--muted);
}

.header-nav a:hover {
    color: var(--blue);
}

.language-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.7rem 1rem;
    padding: 0.95rem 1.1rem;
    border: 1px solid rgba(185, 169, 153, 0.55);
    border-radius: var(--radius-md);
    background: rgba(255, 253, 249, 0.86);
    box-shadow: 0 10px 24px rgba(35, 25, 15, 0.05);
}

.language-label {
    color: var(--muted);
    font-weight: 700;
}

.language-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.lang-button,
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    font-size: 0.83rem;
    font-weight: 600;
}

.lang-button {
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--muted);
    cursor: pointer;
}

.lang-button:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.lang-button.is-active {
    border-color: rgba(29, 78, 216, 0.22);
    background: var(--blue-soft);
    color: var(--blue);
    box-shadow: 0 8px 18px rgba(29, 78, 216, 0.1);
}

.tool-card,
.info-card,
.detail-card,
.example-card {
    border: 1px solid rgba(185, 169, 153, 0.55);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow);
}

.card-kicker,
.example-label {
    margin: 0 0 0.7rem;
    color: var(--brown);
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.tool-card h2,
.tool-card h3,
.info-card h2,
.section-heading h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
    line-height: 1.08;
}

.supporting-text,
.info-card p,
.detail-card p,
.example-card p,
.site-footer p {
    color: var(--muted);
}

.button-row,
.utility-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.button,
.tab-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.button {
    min-height: 2.9rem;
    padding: 0 1.15rem;
    font-weight: 600;
}

.button:hover,
.tab-button:hover,
.text-button:hover {
    transform: translateY(-1px);
}

.button-primary {
    background: linear-gradient(135deg, var(--blue) 0%, #4b6ce2 100%);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(29, 78, 216, 0.22);
}

.button-primary:hover {
    color: #ffffff;
}

.button-secondary {
    border-color: var(--line);
    background: #ffffff;
    color: var(--text);
}

.button-secondary:hover {
    border-color: var(--brown);
    color: var(--brown);
}

.tool-section {
    margin-top: 1.5rem;
}

.howto-section,
.about-section,
.faq-section,
.related-section,
.details-section,
.example-section {
    margin-top: 1.6rem;
}

.tabs {
    display: inline-flex;
    gap: 0.5rem;
    padding: 0.45rem;
    border: 1px solid rgba(185, 169, 153, 0.55);
    border-radius: 999px;
    background: rgba(255, 253, 249, 0.82);
}

.tab-button {
    min-height: 2.8rem;
    padding: 0 1.2rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
}

.tab-button.is-active {
    background: #ffffff;
    color: var(--text);
    border-color: var(--line);
    box-shadow: 0 8px 18px rgba(17, 17, 17, 0.08);
}

.tab-panel {
    display: none;
    padding-top: 1.1rem;
}

.tab-panel.is-active {
    display: block;
}

.tool-grid,
.content-grid,
.details-grid {
    display: grid;
    gap: 1.2rem;
}

.tool-grid {
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.85fr);
}

.tool-card,
.info-card,
.detail-card,
.example-card {
    padding: 1.45rem;
}

.accent-card {
    background:
        linear-gradient(180deg, rgba(247, 239, 232, 0.9) 0%, rgba(255, 255, 255, 0.95) 100%);
}

.card-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.badge-blue {
    background: var(--blue-soft);
    color: var(--blue);
}

.badge-brown {
    background: var(--brown-soft);
    color: var(--brown);
}

.tool-form {
    display: grid;
    gap: 1rem;
}

.field {
    display: grid;
    gap: 0.55rem;
}

.field > span {
    font-weight: 600;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.option-grid,
.option-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem 1rem;
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.72rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #ffffff;
}

.toggle input {
    margin: 0;
}

.status {
    display: none;
    padding: 0.8rem 0.95rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 600;
}

.status.is-visible {
    display: block;
}

.status.is-success {
    color: var(--success);
    background: rgba(22, 101, 52, 0.07);
    border-color: rgba(22, 101, 52, 0.15);
}

.status.is-warning {
    color: var(--warning);
    background: rgba(154, 52, 18, 0.08);
    border-color: rgba(154, 52, 18, 0.18);
}

.status.is-error {
    color: var(--danger);
    background: rgba(185, 28, 28, 0.08);
    border-color: rgba(185, 28, 28, 0.18);
}

.text-button {
    appearance: none;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--blue);
    cursor: pointer;
    font-weight: 700;
}

.upload-zone {
    position: relative;
    display: grid;
    gap: 0.35rem;
    padding: 1.3rem;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-md);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(238, 244, 255, 0.5) 100%);
    cursor: pointer;
}

.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-zone.is-dragging {
    border-color: var(--blue);
    background: linear-gradient(180deg, rgba(238, 244, 255, 0.95) 0%, rgba(255, 255, 255, 0.92) 100%);
}

.upload-title {
    font-weight: 700;
}

.upload-copy,
.note-stack,
.supporting-text {
    color: var(--muted);
}

.note-stack {
    display: grid;
    gap: 0.6rem;
    padding-top: 0.4rem;
}

.content-grid {
    margin-top: 1.5rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.about-card,
.faq-item,
.related-card {
    border: 1px solid rgba(185, 169, 153, 0.55);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
}

.about-card {
    padding: 1.45rem;
}

.about-card p {
    margin: 0;
    color: var(--muted);
}

.about-card p + p {
    margin-top: 0.95rem;
}

.howto-list {
    margin: 0;
    padding-left: 1.35rem;
}

.howto-list li + li {
    margin-top: 0.8rem;
}

.howto-list li {
    color: var(--text);
}

.faq-list {
    display: grid;
    gap: 0.95rem;
}

.faq-item {
    padding: 1rem 1.15rem;
}

.faq-item summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--text);
    list-style: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item p {
    margin: 0.85rem 0 0;
    color: var(--muted);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.related-card {
    display: grid;
    gap: 0.45rem;
    padding: 1.15rem;
    color: var(--text);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.related-card strong {
    font-size: 1.02rem;
}

.related-card span {
    color: var(--muted);
}

.related-card:hover {
    transform: translateY(-2px);
    border-color: rgba(29, 78, 216, 0.3);
    box-shadow: 0 18px 34px rgba(29, 78, 216, 0.08);
}

.section-heading {
    margin-bottom: 1rem;
}

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

.example-card {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}

code {
    display: inline-block;
    padding: 0.3rem 0.55rem;
    border-radius: 0.65rem;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 0.96rem;
}

.site-footer {
    display: grid;
    gap: 0.65rem;
    padding: 2rem 0 0.3rem;
    border-top: 1px solid rgba(185, 169, 153, 0.5);
    margin-top: 1.9rem;
}

.footer-copy {
    margin: 0;
    color: var(--muted);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem 1.25rem;
}

.footer-links a {
    color: var(--muted);
    font-weight: 600;
}

.footer-links a:hover {
    color: var(--blue);
}

@media (max-width: 980px) {
    .tool-grid,
    .content-grid,
    .details-grid,
    .related-grid,
    .example-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .page-shell {
        width: min(var(--max-width), calc(100% - 1rem));
    }

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

    .language-bar {
        align-items: flex-start;
    }

    .tool-card,
    .info-card,
    .detail-card,
    .example-card,
    .about-card,
    .faq-item,
    .related-card {
        padding: 1.1rem;
        border-radius: 22px;
    }

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

    .tabs {
        width: 100%;
    }

    .tab-button {
        flex: 1 1 0;
    }
}
