:root {
    --page: #f4f6f9;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --ink: #17202a;
    --muted: #637083;
    --line: #d8dee8;
    --line-strong: #b9c3d2;
    --teal: #0f766e;
    --teal-dark: #0b5d57;
    --blue: #315efb;
    --danger: #b42318;
    --shadow: 0 18px 48px rgba(23, 32, 42, 0.12);
    --sans: Arial, Helvetica, sans-serif;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(244, 246, 249, 0.98)),
        radial-gradient(circle at 15% 8%, rgba(15, 118, 110, 0.16), transparent 28%),
        radial-gradient(circle at 88% 10%, rgba(49, 94, 251, 0.12), transparent 24%),
        var(--page);
    font-family: var(--sans);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button {
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 10px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    color: var(--ink);
    background: var(--surface);
    font-weight: 800;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}
button:hover {
    border-color: var(--line-strong);
    box-shadow: 0 8px 22px rgba(23, 32, 42, 0.09);
    transform: translateY(-1px);
}
button:disabled {
    opacity: 0.58;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

[hidden] {
    display: none !important;
}

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

.app-header .header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    width: auto;
}

.app-header .header-search {
    min-width: 250px;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
}

.app-header .header-search input {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    height: 100%;
    border: 0;
    outline: none;
    padding: 0 11px;
    color: var(--ink);
    background: transparent;
    font-size: 0.9rem;
    font-weight: 700;
}

.app-header .header-search input::placeholder {
    color: var(--muted);
}

.app-header .header-search .search-submit {
    width: 40px;
    min-height: 38px;
    padding: 0;
    color: var(--muted);
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    flex: 0 0 auto;
}

.app-header .header-search .search-submit:hover {
    color: var(--ink);
    background: var(--surface-soft);
    box-shadow: none;
    transform: none;
}

.tool-shell {
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: 22px 24px 32px;
}
.tool-hero,
.tool-card,
.tool-note {
    border-radius: 20px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background:
        radial-gradient(circle at top left, rgba(20, 184, 166, 0.14), transparent 34%),
        rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
}
.tool-hero {
    padding: clamp(22px, 4vw, 40px);
}
.tool-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.1);
    color: #0f766e;
    font-weight: 700;
    font-size: 0.84rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.tool-title {
    margin: 0;
    font-size: clamp(2rem, 6vw, 4rem);
    line-height: 0.98;
    letter-spacing: -0.05em;
}
.tool-lead {
    margin: 16px 0 0;
    max-width: 72ch;
    color: #475569;
    font-size: 1.02rem;
    line-height: 1.75;
}
.tool-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
}
.tool-card {
    overflow: hidden;
}
.tool-card__inner {
    padding: 20px;
    display: grid;
    gap: 14px;
}
.tool-card h2 {
    margin: 0;
    font-size: 1.08rem;
}
.tool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.tool-button {
    min-height: 48px;
    padding: 0 18px;
    border: 0;
    border-radius: 14px;
    font-weight: 800;
    cursor: pointer;
}
.tool-button.primary {
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    color: #fff;
    box-shadow: 0 14px 30px rgba(15, 118, 110, 0.28);
}
.tool-button.ghost {
    background: rgba(15, 118, 110, 0.08);
    color: #0f766e;
}
.tool-button.danger {
    background: #fff7f5;
    color: #b42318;
    border: 1px solid #f4c7c2;
}
.tool-field {
    display: grid;
    gap: 8px;
}
.tool-field label {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--ink);
}
.tool-field textarea,
.tool-field input,
.tool-field select {
    width: 100%;
    min-height: 50px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(15, 118, 110, 0.18);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
}
.tool-field textarea {
    min-height: 240px;
    resize: vertical;
    line-height: 1.65;
    font-family: var(--mono);
    font-size: 0.94rem;
}
.tool-field textarea.output-box { min-height: 320px; }
.dropzone {
    display: grid;
    gap: 8px;
    align-content: center;
    min-height: 180px;
    padding: 18px;
    border-radius: 18px;
    border: 1px dashed rgba(15, 118, 110, 0.28);
    background: rgba(15, 118, 110, 0.04);
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
    text-align: center;
}
.dropzone:hover {
    border-color: rgba(15, 118, 110, 0.46);
    transform: translateY(-1px);
}
.dropzone.is-dragover {
    border-color: var(--teal);
    background: rgba(20, 184, 166, 0.1);
}
.dropzone__eyebrow {
    color: var(--teal-dark);
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.dropzone strong {
    font-size: 1.04rem;
}
.dropzone__hint {
    color: var(--muted);
    line-height: 1.6;
}
.tool-status {
    display: grid;
    gap: 12px;
}
.tool-status-bar {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(15, 118, 110, 0.08);
    color: #0f172a;
    font-weight: 600;
}
.progress {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8edf3;
}
.progress > span {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0f766e, #14b8a6);
    transition: width 0.18s ease;
}
.preview-box {
    margin: 0;
    display: grid;
    gap: 12px;
}
.preview-box figcaption {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}
.preview-frame {
    min-height: 220px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(15, 118, 110, 0.16);
    background:
        radial-gradient(circle at top left, rgba(20, 184, 166, 0.1), transparent 30%),
        rgba(255, 255, 255, 0.82);
}
.preview-frame img,
.preview-frame canvas,
.preview-frame svg {
    display: block;
    max-width: 100%;
    max-height: 100%;
}
.preview-empty {
    color: var(--muted);
    text-align: center;
    line-height: 1.7;
    padding: 18px;
}
.tool-note {
    margin-top: 14px;
    padding: 18px 20px;
    display: grid;
    gap: 10px;
}
.tool-note strong { font-size: 1.02rem; }
.tool-note p { margin: 0; color: #475569; line-height: 1.7; }
.tool-table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(15, 118, 110, 0.12);
    background: rgba(255, 255, 255, 0.96);
}
.tool-table th,
.tool-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    text-align: left;
    vertical-align: top;
}
.tool-table th {
    width: 34%;
    color: #0f172a;
    background: rgba(15, 118, 110, 0.05);
}
.tool-table tr:last-child th,
.tool-table tr:last-child td { border-bottom: 0; }
.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.chip {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.72);
    font-size: 0.84rem;
    font-weight: 800;
}
.chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--teal);
}

@media (max-width: 1120px) {
    .tool-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1160px) {
    .app-header .header-actions {
        width: 100%;
        margin-left: 0;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 12px;
    }

    .app-header .header-search {
        min-width: min(100%, 320px);
        width: 100%;
    }

    .app-header .header-search input {
        width: 100%;
    }
}
@media (max-width: 760px) {
    .tool-shell { padding-left: 16px; padding-right: 16px; }
    .tool-title { font-size: clamp(1.9rem, 12vw, 3rem); }
}
