*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #5b5ef4;
    --primary-dark: #4346d0;
    --primary-light: #eeeeff;
    --accent: #f5576c;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --border: #e2e6ef;
    --text: #1a1d2e;
    --text-muted: #6b7280;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --error: #dc2626;
    --error-bg: #fee2e2;
    --radius: 14px;
    --shadow: 0 8px 32px rgba(80, 80, 160, 0.12);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.18);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    padding: 20px 16px 60px;
    color: var(--text);
}

/* ── NAV ── */
.top-nav {
    max-width: 1000px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    backdrop-filter: blur(10px);
    transition: background 0.2s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
}

.breadcrumb a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    opacity: 0.5;
}

/* ── TOOL SWITCHER ── */
.tool-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    padding: 10px 16px;
    margin: 0 auto 16px;
    max-width: 1000px;
}

.tool-switcher-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
    white-space: nowrap;
}

.tool-switch-btn {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-block;
}

.tool-switch-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.tool-switch-btn.active {
    background: white;
    color: #667eea;
    font-weight: 700;
    border-color: white;
    pointer-events: none;
}

/* ── FOOTER ── */
.site-footer {
    max-width: 1000px;
    margin: 30px auto 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    text-align: center;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
}

.site-footer a {
    color: white;
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    .tool-switcher {
        gap: 6px;
        padding: 8px 12px;
    }

    .tool-switch-btn {
        font-size: 0.78rem;
        padding: 5px 10px;
    }
}

/* ── HEADER ── */
.page-header {
    text-align: center;
    margin-bottom: 28px;
}

.page-header h1 {
    color: white;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 10px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.page-header p {
    color: rgba(255, 255, 255, 0.88);
    font-size: 1.05rem;
    max-width: 540px;
    margin: 0 auto;
}

.pro-badge {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    margin-left: 8px;
    vertical-align: middle;
    letter-spacing: 0.5px;
}

/* ── CARD ── */
.card {
    background: var(--surface);
    border-radius: 22px;
    padding: 28px;
    box-shadow: var(--shadow-lg);
    max-width: 1000px;
    margin: 0 auto 28px;
}

/* ── FEATURE BADGES ── */
.features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 26px;
}

.feature-tag {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
}

.feature-tag.green {
    background: #dcfce7;
    color: #15803d;
}

.feature-tag.blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.feature-tag.orange {
    background: #fef3c7;
    color: #92400e;
}

/* ── TOOL GRID ── */
.tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.panel {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
}

.panel h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--border);
    border-radius: 9px;
    font-size: 0.97rem;
    font-family: inherit;
    color: var(--text);
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91, 94, 244, 0.12);
}

.field textarea {
    resize: vertical;
    min-height: 78px;
}

.validation-msg {
    margin-top: 6px;
    padding: 8px 12px;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Preview */
.preview-panel {
    background: linear-gradient(135deg, #f0f2ff 0%, #e8ecf8 100%);
    border: 1px solid #d6dbf5;
    border-radius: var(--radius);
    padding: 22px;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.barcode-box {
    background: white;
    border-radius: 12px;
    padding: 24px 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
    margin: 10px 0;
    overflow-x: auto;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
}

#barcode-output {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

#barcode-output svg,
#barcode-output canvas {
    max-width: 100%;
    height: auto;
}

.stats-box {
    background: white;
    border-radius: 9px;
    padding: 10px 14px;
    margin-top: 10px;
    text-align: left;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 16px;
}

.stats-box strong {
    color: var(--text);
}

/* Customization */
.custom-panel {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 24px;
}

.custom-panel h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.custom-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 18px;
}

.color-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-row input[type="color"] {
    width: 44px;
    height: 38px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
}

.color-hex {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-family: monospace;
}

.range-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.range-row input[type="range"] {
    flex: 1;
    accent-color: var(--primary);
}

.range-val {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 42px;
}

.checkbox-row {
    display: flex;
    gap: 18px;
    margin-top: 6px;
}

.checkbox-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
    accent-color: var(--primary);
    width: 15px;
    height: 15px;
}

/* Buttons */
.action-row {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.btn {
    flex: 1;
    padding: 13px 16px;
    border: none;
    border-radius: 10px;
    font-size: 0.97rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 14px rgba(91, 94, 244, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(91, 94, 244, 0.45);
}

.btn-secondary {
    background: white;
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-2);
    transform: translateY(-2px);
}

/* Tip Box */
.tip-box {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    border-radius: 0 10px 10px 0;
    padding: 14px 18px;
    font-size: 0.9rem;
    color: #1e3a5f;
    margin-bottom: 28px;
    line-height: 1.7;
}

.tip-box strong {
    color: #1d4ed8;
}

/* ── SEO CONTENT SECTIONS ── */
.seo-section {
    background: white;
    border-radius: 22px;
    padding: 40px 36px;
    box-shadow: var(--shadow);
    max-width: 1000px;
    margin: 0 auto 28px;
}

.seo-section h2 {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 14px;
}

.seo-section h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin: 20px 0 6px;
}

.seo-section p {
    font-size: 0.97rem;
    color: var(--text-muted);
    line-height: 1.75;
    margin-bottom: 8px;
}

.seo-section ul {
    padding-left: 20px;
    color: var(--text-muted);
    font-size: 0.96rem;
    line-height: 1.8;
}

/* Format Table */
.format-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    font-size: 0.9rem;
}

.format-table th {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 10px 14px;
    text-align: left;
    font-weight: 700;
}

.format-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
}

.format-table tr:last-child td {
    border-bottom: none;
}

.format-table tr:hover td {
    background: var(--surface-2);
}

/* FAQ */
.faq-list {
    margin-top: 10px;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}

.faq-q {
    padding: 14px 18px;
    font-weight: 700;
    font-size: 0.97rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-2);
    user-select: none;
}

.faq-q:hover {
    background: #f0f2ff;
}

.faq-a {
    padding: 0 18px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s;
    font-size: 0.93rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.faq-item.open .faq-a {
    max-height: 300px;
    padding: 12px 18px 16px;
}

.faq-icon {
    transition: transform 0.3s;
    font-style: normal;
}

.faq-item.open .faq-icon {
    transform: rotate(45deg);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 28px;
    right: 24px;
    padding: 13px 22px;
    border-radius: 10px;
    font-size: 0.93rem;
    font-weight: 600;
    color: white;
    background: #1a1d2e;
    transform: translateY(80px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: #16a34a;
}

.toast.error {
    background: #dc2626;
}

/* Responsive */
@media (max-width: 720px) {
    .tool-grid {
        grid-template-columns: 1fr;
    }

    .action-row {
        flex-direction: column;
    }

    .breadcrumb {
        display: none;
    }

    .seo-section {
        padding: 26px 18px;
    }

    .card {
        padding: 18px;
    }
}