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

:root {
    --green:    #38a169; --green-l:  #f0fff4; --green-b:  #9ae6b4;
    --red:      #e53e3e; --red-l:    #fff5f5; --red-b:    #fc8181;
    --yellow:   #d69e2e; --yellow-l: #fffff0; --yellow-b: #f6e05e;
    --blue:     #3182ce; --blue-l:   #ebf8ff; --blue-b:   #90cdf4;
    --gray:     #718096; --gray-l:   #f7fafc; --gray-b:   #e2e8f0;
    --radius: 10px;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #edf2f7;
    color: #2d3748;
    min-height: 100vh;
    padding: 30px 20px 60px;
}

.container { max-width: 900px; margin: 0 auto; }

h1 { font-size: 1.9rem; font-weight: 800; color: #1a202c; margin-bottom: 4px; }
.subtitle { color: var(--gray); margin-bottom: 28px; font-size: .95rem; }

/* Card */
.card {
    background: white;
    border-radius: var(--radius);
    padding: 26px;
    box-shadow: 0 2px 10px rgba(0,0,0,.07);
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Badges */
.badge { font-size: .72rem; padding: 2px 9px; border-radius: 20px; font-weight: 600; }
.badge-blue   { background: var(--blue-l);   color: var(--blue); }
.badge-green  { background: var(--green-l);  color: var(--green); }
.badge-red    { background: var(--red-l);    color: var(--red); }
.badge-yellow { background: var(--yellow-l); color: var(--yellow); }
.badge-gray   { background: var(--gray-l);   color: var(--gray); }

/* Textarea */
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--gray-b);
    border-radius: 8px;
    font-size: .88rem;
    font-family: 'Courier New', monospace;
    resize: vertical;
    line-height: 1.7;
    transition: border-color .2s;
}
textarea:focus { outline: none; border-color: var(--blue); }

.hint { font-size: .8rem; color: #a0aec0; margin-top: 8px; }

.counter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    gap: 10px;
}

#liveCount {
    font-size: .82rem;
    color: var(--gray);
    background: var(--gray-l);
    padding: 3px 10px;
    border-radius: 20px;
    transition: all .2s;
    white-space: nowrap;
}
#liveCount.warn { background: #fffbeb; color: #b7791f; }
#liveCount.over { background: var(--red-l); color: var(--red); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    border: none;
    border-radius: 8px;
    font-size: .93rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    line-height: 1;
}
.btn-primary { background: var(--blue);  color: white; }
.btn-primary:hover { background: #2b6cb0; }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #2f855a; }
.btn-ghost {
    background: var(--gray-l);
    color: #4a5568;
    border: 1px solid var(--gray-b);
}
.btn-ghost:hover { background: #e2e8f0; }
.btn-sm { padding: 5px 12px; font-size: .8rem; }

.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; align-items: center; }

/* Stats grid */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}
.stat { border-radius: 8px; padding: 14px 16px; text-align: center; }
.stat .num { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat .lbl { font-size: .78rem; margin-top: 4px; font-weight: 500; }
.stat-blue   { background: var(--blue-l);   color: var(--blue); }
.stat-green  { background: var(--green-l);  color: var(--green); }
.stat-red    { background: var(--red-l);    color: var(--red); }
.stat-yellow { background: var(--yellow-l); color: var(--yellow); }
.stat-gray   { background: var(--gray-l);   color: var(--gray); }

/* Email grid (valid chips) */
.email-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 8px;
    margin-top: 10px;
}
.email-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: .82rem;
    overflow: hidden;
    cursor: pointer;
}
.email-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.chip-valid {
    background: var(--green-l);
    border: 1px solid var(--green-b);
    color: #276749;
}
.chip-valid input[type=checkbox] { accent-color: var(--green); flex-shrink: 0; }

/* Correction sections */
.correction-section { border-radius: 8px; padding: 18px; margin-top: 10px; }
.cs-red    { background: var(--red-l);    border: 1px solid var(--red-b); }
.cs-yellow { background: var(--yellow-l); border: 1px solid var(--yellow-b); }
.cs-gray   { background: var(--gray-l);   border: 1px solid var(--gray-b); }

.correction-section h3 { font-size: .93rem; font-weight: 700; margin-bottom: 14px; }
.cs-red h3    { color: #9b2c2c; }
.cs-yellow h3 { color: #744210; }
.cs-gray h3   { color: #4a5568; }

.correction-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.correction-row:last-of-type { margin-bottom: 0; }

.correction-row input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 7px 10px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: .85rem;
    border: 1px solid var(--red-b);
    transition: border-color .2s;
    background: white;
}
.correction-row input[type="text"].dns-field { border-color: var(--yellow-b); }
.correction-row input[type="text"]:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(66,153,225,.25);
}

.reason-tag {
    font-size: .72rem;
    padding: 2px 7px;
    border-radius: 10px;
    white-space: nowrap;
    font-weight: 600;
}
.rt-format { background: #fed7d7; color: #9b2c2c; }
.rt-dns    { background: #feebc8; color: #7b341e; }
.rt-dup    { background: #e2e8f0; color: #4a5568; }
.rt-disp   { background: #fefcbf; color: #744210; }

.check-label {
    font-size: .83rem;
    color: var(--gray);
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    white-space: nowrap;
}

/* Separator chooser */
.sep-group { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.sep-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 2px solid var(--gray-b);
    border-radius: 8px;
    cursor: pointer;
    font-size: .88rem;
    transition: all .15s;
    user-select: none;
}
.sep-option.active {
    border-color: var(--blue);
    background: var(--blue-l);
    color: var(--blue);
}
.sep-option input { display: none; }

/* Result box */
.result-box {
    background: var(--green-l);
    border: 2px solid var(--green-b);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 14px;
}
.result-label {
    font-size: .78rem;
    font-weight: 700;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 8px;
}
.result-text {
    font-family: 'Courier New', monospace;
    font-size: .86rem;
    word-break: break-all;
    line-height: 1.7;
    color: #1a202c;
    max-height: 220px;
    overflow-y: auto;
    white-space: pre-wrap;
}

.copy-success {
    display: none;
    margin-top: 10px;
    color: var(--green);
    font-size: .88rem;
    font-weight: 700;
}

/* Error box */
.error-box {
    background: var(--red-l);
    border: 1px solid var(--red-b);
    border-radius: 8px;
    padding: 14px 18px;
    color: var(--red);
    font-weight: 600;
    margin-bottom: 18px;
}

/* Divider */
.divider { height: 1px; background: var(--gray-b); margin: 18px 0; }

/* Collapsible sections */
.section-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}
.section-toggle .chevron { transition: transform .2s; display: inline-block; }
.section-toggle.collapsed .chevron { transform: rotate(-90deg); }
.collapsible { overflow: hidden; transition: max-height .35s ease; }

/* Sel count */
#selCount { margin-top: 10px; font-size: .82rem; color: var(--gray); }

@media (max-width: 600px) {
    h1 { font-size: 1.4rem; }
    .correction-row { flex-direction: column; align-items: flex-start; }
    .correction-row input[type="text"] { width: 100%; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .sep-group { flex-direction: column; }
}

/* ---- Lade-Overlay (vorher doppelt inline in input.php/review.php) ---- */
.loading-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.75); backdrop-filter: blur(4px); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.loading-overlay[hidden] { display: none; }
.loading-box { background: #fff; border-radius: 16px; padding: 40px 48px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.3); max-width: 360px; width: 90%; }
.dns-dots { display: flex; align-items: center; justify-content: center; gap: 10px; height: 52px; margin-bottom: 20px; }
.dns-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: #4299e1; animation: dns-bounce 1.2s ease-in-out infinite; }
.dns-dot:nth-child(2) { animation-delay: .2s; } .dns-dot:nth-child(3) { animation-delay: .4s; }
@keyframes dns-bounce { 0%,100% { transform: translateY(0); background: #4299e1; } 40%,60% { transform: translateY(-18px); background: #38a169; } }
.loading-title { font-size: 1.15rem; font-weight: 700; color: #1a202c; margin-bottom: 6px; }
.loading-sub { font-size: .9rem; color: var(--gray); margin-bottom: 18px; min-height: 1.3em; }
.loading-bar-track { background: var(--gray-b); border-radius: 99px; height: 6px; overflow: hidden; margin-bottom: 16px; }
.loading-bar-fill { background: linear-gradient(90deg, #4299e1, #38a169); height: 6px; width: 0%; border-radius: 99px; transition: width .4s ease; }
.loading-note { font-size: .75rem; color: #a0aec0; }

/* ---- Ausgabe-Modus / Ergebnis ---- */
.block-group { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.block-option { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border: 2px solid var(--gray-b); border-radius: 10px; cursor: pointer; background: #fff; font-size: .9rem; }
.block-option.active { border-color: #4299e1; background: #ebf8ff; color: #2b6cb0; }
.block-size-input { width: 60px; padding: 4px 6px; border: 1px solid #cbd5e0; border-radius: 6px; font-size: .95rem; font-weight: 700; text-align: center; }
.readonly-field { opacity: .65; cursor: default; }
.result-meta { color: var(--gray); font-size: .9rem; margin-bottom: 16px; }
.result-meta strong { color: #2d3748; }
.result-count { font-size: .8rem; color: var(--gray); text-transform: none; letter-spacing: 0; font-weight: 400; }
.copy-block-btn { float: right; margin-top: -4px; }
.section-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 6px; }
