:root {
    --text: #1f2937;
    --text-muted: #6b7280;
    --accent: #ef4444;
    --accent-hover: #dc2626;
    --radius: 12px;
    --radius-btn: 9999px;
    --border: #ececec;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'DM Sans', -apple-system, sans-serif;
    background: #fff;
    min-height: 100vh;
    color: #121212;
}
.page-wrap {
    max-width: 430px;
    margin: 0 auto;
    padding: 0 12px 20px;
}
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0 10px;
}
.site-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #111827;
    font-weight: 700;
    font-size: 1.1rem;
}
.site-logo-mark {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.88rem;
    margin-bottom: 12px;
    font-weight: 600;
}
.back-link:hover { color: var(--accent); }
.tool-hero {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}
.tool-hero-icon {
    width: 32px;
    height: 32px;
    color: var(--accent);
    font-size: 1.6rem;
    line-height: 1;
    flex-shrink: 0;
}
.tool-hero h1 {
    font-size: 1.25rem;
    line-height: 1.3;
    color: #111827;
    margin-bottom: 6px;
}
.tool-hero p {
    color: var(--text-muted);
    font-size: 0.86rem;
    line-height: 1.45;
}
.panel {
    border: 1px solid #d1d5db;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 14px;
    background: #fff;
}
.panel-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 10px;
}
.dropzone {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 22px 14px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent);
    background: #fff5f5;
}
.dropzone i {
    font-size: 1.6rem;
    color: var(--accent);
    margin-bottom: 8px;
}
.dropzone p {
    font-size: 0.88rem;
    color: #374151;
    font-weight: 600;
}
.dropzone small {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.78rem;
}
.file-input { display: none; }
.file-list {
    list-style: none;
    margin-top: 10px;
}
.file-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.file-list li:last-child { border-bottom: 0; }
.file-list .remove-btn {
    border: 0;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
}
.field {
    margin-bottom: 12px;
}
.field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    font-size: 0.9rem;
}
.field textarea { min-height: 100px; resize: vertical; }
.markdown-or {
    text-align: center;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #9ca3af;
    margin: 4px 0 14px;
}
.markdown-paste-panel {
    margin-bottom: 0;
}
.markdown-options {
    border: 0;
    padding: 0;
    background: transparent;
    margin-bottom: 14px;
}
.markdown-options .field textarea {
    min-height: 160px;
}
.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    border: 0;
    border-radius: var(--radius-btn);
    padding: 14px 20px;
    background: var(--accent);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.status-box {
    border-radius: 12px;
    padding: 12px;
    font-size: 0.86rem;
    line-height: 1.45;
    margin-bottom: 14px;
    display: none;
}
.status-box.show { display: block; }
.status-box.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.status-box.error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.status-box.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.result-box {
    display: none;
    border: 1px solid #d1d5db;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 14px;
    text-align: center;
}
.result-box.show { display: block; }
.result-box a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}
.page-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 10px;
}
.page-thumb {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 6px;
    text-align: center;
    font-size: 0.75rem;
    background: #f9fafb;
    cursor: grab;
}
.page-thumb.selected { border-color: var(--accent); background: #fff5f5; }
.signature-pad {
    width: 100%;
    height: 120px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    touch-action: none;
}
.ad-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-align: left;
}
.bottom-ad-wrap,
.ad-between-tools {
    min-height: 0;
}
.bottom-ad-wrap {
    margin: 20px 0 8px;
    padding: 10px 0 4px;
    text-align: center;
}
.bottom-ad-wrap .adsbygoogle {
    display: block;
    width: 100%;
}
ins.adsbygoogle[data-ad-status="unfilled"] {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}
.top-ad-wrap:has(ins.adsbygoogle[data-ad-status="unfilled"]),
.bottom-ad-wrap:has(ins.adsbygoogle[data-ad-status="unfilled"]),
.ad-between-tools:has(ins.adsbygoogle[data-ad-status="unfilled"]) {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}
.top-ad-wrap {
    width: 100%;
    margin-bottom: 14px;
    display: flex;
    justify-content: center;
    overflow: hidden;
    border-radius: 12px;
}
.top-ad-wrap .adsbygoogle { display: block; width: 100%; }
.tools-panel { margin-top: 8px; }
.tools-list { display: flex; flex-direction: column; }
.tool-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 14px;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border-bottom: 1px solid var(--border);
}
.tool-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
    font-size: 1.55rem;
}
.tool-body { flex: 1; min-width: 0; }
.tool-name {
    font-size: 1.02rem;
    margin: 0 0 6px;
    font-weight: 500;
    color: #111827;
}
.tool-desc {
    margin: 0;
    color: #6b7280;
    font-size: 0.86rem;
    line-height: 1.45;
}
.tool-arrow { color: #9ca3af; font-size: 1.1rem; }
.hidden { display: none !important; }
.footer-links {
    text-align: center;
    padding: 16px 0 8px;
    font-size: 0.78rem;
    color: #6b7280;
    line-height: 1.8;
}
.footer-links a {
    color: #6b7280;
    text-decoration: none;
    margin: 0 4px;
}
.footer-links a:hover { color: var(--accent); }
.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 8px;
    color: #111827;
    font-weight: 700;
    font-size: 1rem;
}
.footer-logo .site-logo-mark {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
}
.footer-copy {
    font-size: 0.75rem;
    color: #9ca3af;
}

.pdf-viewer-hero {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.pdf-viewer-hero h1 {
    font-size: 1.1rem;
    line-height: 1.3;
    color: #111827;
    margin-bottom: 4px;
    word-break: break-word;
}
.pdf-viewer-summary {
    font-size: 0.88rem;
    color: var(--text-muted);
}
.pdf-viewer-actions {
    margin-bottom: 16px;
}
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-btn);
    background: #fff;
    color: #374151;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.btn-secondary:hover {
    border-color: #d1d5db;
    color: #111827;
}
.pdf-viewer-loading {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 24px 12px;
}
.pdf-viewer-empty {
    text-align: center;
    padding: 28px 16px;
    border: 1px dashed #e5e7eb;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}
.pdf-viewer-empty a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}
.pdf-pages-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}
.pdf-page-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: #f9fafb;
}
.pdf-page-label {
    padding: 10px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #374151;
    background: #fff;
    border-bottom: 1px solid var(--border);
}
.pdf-page-card canvas {
    display: block;
    width: 100%;
    height: auto;
    background: #fff;
}
