:root {
    --bg-primary: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent: #a78bfa;
    --accent-hover: #8b5cf6;
    --border: #475569;
    --success: #22c55e;
    --warn: #f59e0b;
    --danger: #ef4444;
}

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

body {
    font-family: 'Noto Sans SC', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 24px 16px;
    background-image:
        radial-gradient(ellipse at top, #1e293b 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(167, 139, 250, 0.08) 0%, transparent 40%);
}

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

header {
    text-align: center;
    margin-bottom: 24px;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent), #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Tabs */
.tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.tab {
    padding: 8px 18px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

.tab.active {
    background: rgba(167, 139, 250, 0.15);
    border-color: var(--accent);
    color: var(--text-primary);
    font-weight: 600;
}

.tab-hint {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Card */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px 24px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title::before {
    content: '';
    width: 4px;
    height: 18px;
    background: var(--accent);
    border-radius: 2px;
}

/* Result */
.result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.result-actions {
    display: flex;
    gap: 8px;
}

.password-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.pw-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
}

.pw-text {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    word-break: break-all;
    user-select: all;
}

/* Strength */
.strength-track {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0;
    border-radius: 4px;
    background: var(--danger);
    transition: width 0.3s ease, background 0.3s ease;
}

.strength-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 10px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.strength-meta span:first-child {
    font-weight: 600;
}

/* Options panels */
.panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 18px;
}

.panel[hidden] {
    display: none !important;
}

@media (max-width: 768px) {
    .panel {
        grid-template-columns: 1fr;
        gap: 18px;
    }
}

.panel-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.field-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.field-value {
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

.row {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Range */
input[type="range"] {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-input);
    border-radius: 4px;
    outline: none;
    min-width: 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 3px solid var(--bg-card);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

/* Inputs */
.num-input,
.text-input,
.select {
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    padding: 9px 12px;
    transition: border-color 0.2s;
    min-width: 0;
}

.num-input {
    width: 84px;
    text-align: center;
}

.text-input {
    width: 100%;
}

.text-input::placeholder {
    font-family: 'Noto Sans SC', sans-serif;
    color: #64748b;
}

.num-input:focus,
.text-input:focus,
.select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Checks */
.checks {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.check:hover {
    color: var(--text-primary);
}

.hint {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn:hover {
    border-color: var(--accent);
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #1e1b4b;
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-copy {
    padding: 6px 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-copy.copied {
    background: var(--success);
    border-color: var(--success);
    color: #052e16;
}

/* History */
.history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 14px 0 12px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(51, 65, 85, 0.5);
    border-radius: 8px;
}

.history-value {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    word-break: break-all;
    color: var(--text-secondary);
    user-select: all;
}

.history-time {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
}

.empty {
    font-size: 0.85rem;
    color: #64748b;
}

footer {
    text-align: center;
    margin-top: 24px;
    color: #64748b;
    font-size: 0.78rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--success);
    color: #052e16;
    padding: 10px 22px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    z-index: 1000;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.6rem;
    }

    .card {
        padding: 16px;
    }

    .result-head {
        flex-direction: column;
        align-items: flex-start;
    }
}
