/* PassAfer — MVP 样式 */

:root {
    --bg: #0f172a;
    --bg-elevated: #1e293b;
    --bg-input: #0c1222;
    --border: #334155;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --accent: #22d3ee;
    --accent-dim: rgba(34, 211, 238, 0.15);
    --success: #34d399;
    --danger: #f87171;
    --radius: 10px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    --mono: ui-monospace, "Cascadia Code", "Roboto Mono", monospace;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

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

html { font-size: 16px; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

.grid-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(34, 211, 238, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 211, 238, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent);
}

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

.is-hidden { display: none !important; }

/* ── Topbar ── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
}

.topbar-inner {
    position: relative;
    max-width: 1180px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), #0891b2);
    color: var(--bg);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 1rem; }
.brand-sub { font-size: 0.7rem; color: var(--text-muted); letter-spacing: 0.04em; }

.tagline {
    flex: 1;
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: none;
}

@media (min-width: 640px) {
    .tagline { display: block; }
}

/* ── Top navigation ── */
/* Flex middle slot (not absolute center) so long EN/JA labels cannot overlap brand / user. */
.topnav {
    position: static;
    left: auto;
    transform: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    gap: 2px;
    min-width: 0;
    margin-left: 0;
}

.topnav-link {
    padding: 8px 10px;
    border-radius: 7px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.topnav-link:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}

.topnav-link.is-active {
    color: var(--accent);
    background: var(--accent-dim);
}

.topbar-spacer { display: none; }

/* ── Main ── */
.main {
    max-width: 880px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 24px;
    background: var(--bg-elevated);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

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

.tab.is-active {
    background: var(--bg);
    color: var(--accent);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* ── Panel ── */
.panel { display: none; }
.panel.is-active { display: block; }

.panel-head { margin-bottom: 20px; }

.panel-head h1,
.crypto-gate h1 {
    margin: 0 0 6px;
    font-size: 1.5rem;
    font-weight: 700;
}

.panel-desc {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ── Mode switch ── */
.mode-switch {
    display: flex;
    gap: 8px;
    margin: 0 0 20px;
    padding: 0;
    border: none;
}

.mode-option {
    flex: 1;
    cursor: pointer;
}

.mode-option input { position: absolute; opacity: 0; pointer-events: none; }

.mode-option span {
    display: block;
    padding: 10px 14px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: border-color 0.15s, background 0.15s;
}

.mode-option input:checked + span {
    border-color: var(--accent);
    background: var(--accent-dim);
    color: var(--accent);
}

/* ── Config ── */
.config-block {
    padding: 20px;
    margin-bottom: 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.config-block.is-hidden { display: none; }

.field-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.field-row:last-child { margin-bottom: 0; }

.field-row label {
    min-width: 88px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.field-inline {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

.field-inline input[type="range"] {
    flex: 1;
    accent-color: var(--accent);
}

.input-num,
.input-text {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
}

.input-num { width: 72px; }
.input-text { flex: 1; min-width: 120px; }
.input-short { max-width: 80px; }

.input-num:focus,
.input-text:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}

.check input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

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

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

.btn-primary:hover { background: #06b6d4; }

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

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

.btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text-muted);
    padding: 8px 16px;
}

.btn-ghost:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

#btn-login { margin-left: 0; }

.user-area {
    margin-left: 0;
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.user-menu.is-hidden { display: none; }

#btn-login.is-hidden { display: none; }

.user-avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 2px solid var(--accent);
    border-radius: 50%;
    background: var(--accent-dim);
    color: var(--accent);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.user-avatar:hover { background: rgba(34, 211, 238, 0.25); }
.user-avatar:active { transform: scale(0.96); }

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    padding: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 150;
}

.user-dropdown-email {
    margin: 4px 10px 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    word-break: break-all;
}

.user-dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.user-dropdown-item:hover { background: var(--bg); }
.user-dropdown-danger { color: var(--danger); }

.tab-auth-only.is-hidden { display: none; }

.tabs:has(.tab-auth-only:not(.is-hidden)) .tab:not(.tab-auth-only) {
    flex: 1;
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-overlay[hidden] { display: none; }

.modal {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 28px 24px 24px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.modal-sm { max-width: 380px; }

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.modal-close:hover { color: var(--text); background: var(--bg); }

.modal-title {
    margin: 0 0 8px;
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-desc {
    margin: 0 0 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    padding: 4px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.auth-tab.is-active {
    background: var(--bg-elevated);
    color: var(--accent);
}

.auth-form.is-hidden { display: none; }

.field-col {
    flex-direction: column;
    align-items: stretch;
}

.field-col label { min-width: unset; margin-bottom: 4px; }

.auth-error {
    margin: 0 0 12px;
    font-size: 0.85rem;
    color: var(--danger);
}

.auth-error[hidden] { display: none; }

.btn-block { width: 100%; }

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}

.vault-add-preview {
    margin: 0 0 16px;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.vault-add-preview code {
    font-family: var(--mono);
    font-size: 0.9rem;
    color: var(--accent);
    word-break: break-all;
}

/* ── Vault ── */
.vault-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.vault-empty-hint {
    font-size: 0.85rem;
    margin-top: 8px;
}

.vault-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vault-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.vault-pwd-mask,
.vault-pwd-text {
    flex: 1;
    font-family: var(--mono);
    font-size: 0.9rem;
    word-break: break-all;
}

.vault-pwd-mask { color: var(--text-muted); letter-spacing: 0.12em; }
.vault-pwd-text { color: var(--accent); }

.vault-meta {
    flex: 0 0 auto;
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 72px;
}

.vault-label {
    display: inline-block;
    padding: 2px 8px;
    margin-right: 8px;
    border-radius: 4px;
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 0.75rem;
}

.vault-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ── Crypto tool ── */
.crypto-gate-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.crypto-tool .crypto-algo {
    margin: 0 0 16px;
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
}

.crypto-key-switch,
.crypto-mode-switch,
.crypto-input-switch {
    margin-bottom: 16px;
}

.crypto-hint {
    margin: -8px 0 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.crypto-hint.is-hidden { display: none; }

.field-secret { position: relative; }

.field-secret .input-text { padding-right: 44px; }

.field-secret .toggle-secret {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    min-width: 36px;
}

.crypto-import-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.crypto-import-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-right: 4px;
}

.crypto-keep-empty {
    margin-left: auto;
    font-size: 0.85rem;
}

.crypto-io {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.crypto-io-col label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.crypto-textarea {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.85rem;
    line-height: 1.5;
    resize: vertical;
}

.crypto-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.crypto-stats {
    margin: 0 0 8px;
    font-size: 0.9rem;
    color: var(--success);
    font-weight: 600;
}

.crypto-errors {
    margin: 0 0 16px;
    padding: 12px;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 8px;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--danger);
    white-space: pre-wrap;
}

.crypto-export-bar {
    margin-top: 8px;
}

.crypto-file-zone {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
}

.crypto-file-hint {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.crypto-file-hint code {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--accent);
}

.crypto-file-list {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.crypto-file-list:empty { display: none; }

.crypto-file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}

.crypto-file-item:last-child { border-bottom: none; }

.crypto-file-name {
    flex: 1;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crypto-file-size {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--mono);
    flex-shrink: 0;
}

.crypto-file-remove {
    min-width: 28px;
    padding: 2px 8px;
    font-size: 1.1rem;
    line-height: 1;
}

.result-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

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

.btn-add:hover {
    background: var(--accent-dim);
}

@media (max-width: 640px) {
    .crypto-io { grid-template-columns: 1fr; }
    .crypto-keep-empty { margin-left: 0; width: 100%; }
    .vault-item { flex-wrap: wrap; }
    .vault-actions { width: 100%; justify-content: flex-end; }
}

/* ── Strength ── */
.strength-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.strength-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 32px;
}

.strength-track {
    flex: 1;
    height: 8px;
    background: var(--bg-elevated);
    border-radius: 4px;
    overflow: hidden;
}

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

.strength-fill.weak { background: var(--danger); }
.strength-fill.medium { background: #fbbf24; }
.strength-fill.strong { background: var(--success); }
.strength-fill.very-strong { background: var(--accent); }

.strength-text {
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 36px;
}

.hint {
    margin: 0 0 16px;
    font-size: 0.85rem;
    color: #fbbf24;
}

/* ── Password Audit ── */
.audit-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.audit-input-wrap .input-text {
    flex: 1;
}

.audit-placeholder {
    margin: 8px 0 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.audit-alert {
    margin: 12px 0;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #fca5a5;
    font-size: 0.9rem;
}

/* ── Results ── */
.results {
    padding: 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.results-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.results-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

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

.result-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.result-pwd {
    flex: 1;
    font-family: var(--mono);
    font-size: 0.9rem;
    word-break: break-all;
    color: var(--accent);
}

/* ── Crypto gate ── */
.crypto-gate {
    text-align: center;
    padding: 48px 20px;
}

.crypto-gate-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.crypto-gate .panel-desc {
    max-width: 480px;
    margin: 0 auto 28px;
}

.crypto-gate-box {
    max-width: 400px;
    margin: 0 auto;
    padding: 28px 24px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.crypto-gate-box p { margin: 0 0 10px; }

.crypto-gate-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px !important;
}

/* ── Footer ── */
.footer {
    margin-top: 72px;
    border-top: 1px solid rgba(51, 65, 85, 0.85);
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0) 0%, rgba(12, 18, 34, 0.55) 28%, #0b1220 100%);
    text-align: left;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 56px 28px 28px;
}

.footer-main {
    display: grid;
    grid-template-columns: minmax(220px, 1.45fr) repeat(3, minmax(120px, 1fr));
    gap: 40px 36px;
    padding-bottom: 44px;
}

.footer-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.footer-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.footer-brand-name {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.footer-brand-sub {
    margin-top: 2px;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.footer-desc {
    max-width: 280px;
    margin: 18px 0 0;
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-col-title {
    margin: 0 0 4px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #64748b;
}

.footer-col a {
    color: var(--text);
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.45;
    transition: color 0.15s;
}

.footer-col a:hover {
    color: var(--accent);
}

.footer-mail {
    color: var(--text-muted) !important;
    word-break: break-all;
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 22px;
    border-top: 1px solid rgba(51, 65, 85, 0.7);
}

.footer-copy {
    margin: 0;
    font-size: 0.82rem;
    color: #64748b;
}

.footer-bottom .footer-mail {
    font-size: 0.82rem;
    text-decoration: none;
}

.footer-bottom .footer-mail:hover {
    color: var(--accent) !important;
}

@media (max-width: 900px) {
    .footer-main {
        grid-template-columns: 1fr 1fr;
        gap: 32px 28px;
    }

    .footer-brand {
        grid-column: 1 / -1;
    }

    .footer-desc { max-width: 420px; }
}

@media (max-width: 560px) {
    .footer-inner { padding: 44px 20px 24px; }

    .footer-main {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    padding: 10px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 200;
    pointer-events: none;
}

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

/* ── Responsive ── */
@media (max-width: 1100px) {
    .topnav-link { padding: 7px 7px; font-size: 0.8rem; }
}

/* Wrap nav early enough for longer EN/JA labels + language switcher. */
@media (max-width: 920px) {
    .topbar-inner { flex-wrap: wrap; row-gap: 10px; }
    .topnav {
        order: 3;
        flex: 1 1 100%;
        width: 100%;
        margin-left: 0;
        padding-top: 4px;
        border-top: 1px solid var(--border);
        justify-content: center;
    }
    .topnav-link { flex: 1; text-align: center; font-size: 0.8rem; padding: 8px 6px; }
}

@media (max-width: 480px) {
    .user-area { margin-left: 0; width: 100%; display: flex; justify-content: flex-end; }
    #btn-login { width: auto; }
    .field-row { flex-direction: column; align-items: stretch; }
    .field-row label { min-width: unset; }
}

/* ── Language switcher ── */
.lang-switcher {
    position: relative;
    margin-right: 10px;
    flex-shrink: 0;
}

.lang-switcher-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 28px 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(12, 18, 34, 0.72);
    color: var(--text-muted);
    font: inherit;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
}

.lang-switcher-trigger:hover {
    border-color: rgba(34, 211, 238, 0.45);
    color: var(--text);
    background: var(--accent-dim);
}

.lang-switcher.is-open .lang-switcher-trigger,
.lang-switcher-trigger:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
    outline: none;
}

.lang-switcher-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.lang-switcher-icon svg { display: block; }

.lang-switcher-label {
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.2;
    white-space: nowrap;
}

.lang-switcher-chevron {
    position: absolute;
    right: 10px;
    top: 50%;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
    opacity: 0.85;
    color: inherit;
    transition: transform 0.15s;
}

.lang-switcher.is-open .lang-switcher-chevron {
    transform: translateY(-20%) rotate(225deg);
}

.lang-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 160;
    min-width: 100%;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.lang-menu[hidden] { display: none; }

.lang-menu-item {
    display: block;
    padding: 9px 12px;
    border-radius: 6px;
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.lang-menu-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.lang-menu-item.is-active {
    color: var(--accent);
    background: var(--accent-dim);
}


/* ── Privacy / Link cleaner ── */
.link-results { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.link-result-item {
    padding: 12px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.link-clean code { font-family: var(--mono); font-size: 0.85rem; color: var(--accent); word-break: break-all; }
.link-removed { margin-top: 6px; font-size: 0.8rem; color: var(--text-muted); }
.link-error { color: var(--danger); font-size: 0.9rem; }
.redact-type-switch {
    flex-wrap: wrap;
}
.redact-type-switch .mode-option {
    flex: 1 1 auto;
    min-width: 88px;
}

/* ── Audit extras ── */
.audit-meta { margin: 8px 0; font-size: 0.85rem; color: var(--text-muted); }
.audit-risks, .audit-suggestions {
    margin: 12px 0;
    padding-left: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.audit-risks li { color: #fbbf24; margin-bottom: 4px; }

/* ── Filebox / Dropzone ── */
.dropzone {
    text-align: center;
    padding: 36px 20px;
    margin-bottom: 16px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.is-dragover {
    border-color: var(--accent);
    background: var(--accent-dim);
}
.dropzone-icon { font-size: 2rem; margin: 0 0 8px; }
.dropzone-hint { font-size: 0.85rem; color: var(--text-muted); margin: 4px 0 0; }
.file-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.progress-wrap { margin: 16px 0; }
.progress-text { margin: 8px 0 0; font-size: 0.85rem; color: var(--text-muted); font-family: var(--mono); }

/* ── Burn-Link ── */
.burn-link-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
}
.burn-link-box code {
    flex: 1;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--accent);
    word-break: break-all;
}
.burn-result h2 { font-size: 1rem; margin: 20px 0 10px; }
.main-narrow { max-width: 640px; }
.burn-read { text-align: center; padding: 48px 20px; }
.burn-read h1 { margin: 0 0 12px; font-size: 1.4rem; }
.burn-plaintext-box {
    text-align: left;
    padding: 20px;
    margin: 20px 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.burn-plaintext-box pre {
    margin: 0;
    font-family: var(--mono);
    font-size: 0.9rem;
    color: var(--accent);
    white-space: pre-wrap;
    word-break: break-all;
}
.burn-read-burned .panel-desc { max-width: 420px; margin: 0 auto 8px; }


/* ── Home ── */
.main-home {
    max-width: 960px;
    padding-top: 32px;
    padding-bottom: 72px;
}

.home-hero {
    text-align: center;
    padding: 64px 12px 48px;
    margin: 0 0 8px;
    border-bottom: 1px solid var(--border);
    background:
        radial-gradient(ellipse 70% 55% at 50% -10%, rgba(34, 211, 238, 0.12), transparent 55%);
}

.home-brand {
    margin: 0;
    font-size: clamp(2.8rem, 8vw, 4.2rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.02;
    color: var(--text);
}

.home-brand-en {
    margin: 10px 0 0;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
}

.home-slogan {
    margin: 28px 0 0;
    font-size: clamp(1.3rem, 3.2vw, 1.75rem);
    font-weight: 600;
    color: var(--text);
}

.home-lead {
    max-width: 560px;
    margin: 16px auto 0;
    font-size: 1.02rem;
    line-height: 1.65;
    color: var(--text-muted);
}

.home-cta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 28px;
}

.home-trust {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 18px;
    margin: 36px 0 0;
    padding: 0;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.home-trust span {
    position: relative;
    padding: 0 0 0 14px;
}

.home-trust span::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 6px;
    height: 6px;
    margin-top: -3px;
    border-radius: 1px;
    background: var(--accent);
    opacity: 0.75;
}

.home-anim {
    opacity: 0;
    transform: translateY(12px);
    animation: home-fade-up 0.7s ease forwards;
}

.home-anim-delay-1 { animation-delay: 0.08s; }
.home-anim-delay-2 { animation-delay: 0.16s; }
.home-anim-delay-3 { animation-delay: 0.24s; }
.home-anim-delay-4 { animation-delay: 0.32s; }

@keyframes home-fade-up {
    to { opacity: 1; transform: translateY(0); }
}

.home-principles,
.home-audience,
.home-tools,
.home-stack,
.home-faq,
.home-closing {
    padding: 56px 0 8px;
}

.home-section-title {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.home-section-desc {
    margin: 10px 0 0;
    max-width: 640px;
    color: var(--text-muted);
    font-size: 0.98rem;
    line-height: 1.6;
}

.home-principle-list {
    list-style: none;
    margin: 28px 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 28px;
}

.home-principle-list h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: var(--accent);
}

.home-principle-list p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

.home-audience-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 28px;
    margin-top: 28px;
}

.home-audience-item h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.home-audience-item p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

.home-tool-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.home-tool {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(30, 41, 59, 0.45);
    transition: border-color 0.18s, background 0.18s, transform 0.18s;
}

.home-tool:hover {
    border-color: rgba(34, 211, 238, 0.65);
    background: var(--accent-dim);
    transform: translateY(-2px);
}

.home-tool-wide { grid-column: 1 / -1; }

.home-tool-kicker {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

.home-tool-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
}

.home-tool-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.home-stack-list {
    margin: 28px 0 0;
    padding: 0;
    display: grid;
    gap: 0;
    border-top: 1px solid var(--border);
}

.home-stack-list > div {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.home-stack-list dt {
    margin: 0;
    font-weight: 650;
    color: var(--text);
}

.home-stack-list dd {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

.home-faq-list {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.home-faq-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(12, 18, 34, 0.55);
    overflow: hidden;
}

.home-faq-item summary {
    cursor: pointer;
    list-style: none;
    padding: 14px 16px;
    font-weight: 600;
    color: var(--text);
}

.home-faq-item summary::-webkit-details-marker { display: none; }

.home-faq-item summary::after {
    content: '+';
    float: right;
    color: var(--accent);
    font-weight: 500;
}

.home-faq-item[open] summary::after { content: '–'; }

.home-faq-item p {
    margin: 0;
    padding: 0 16px 16px;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
    border-top: 1px solid transparent;
}

.home-closing {
    margin-top: 24px;
    padding: 40px 24px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background:
        radial-gradient(ellipse 80% 100% at 50% 0%, rgba(34, 211, 238, 0.1), transparent 60%),
        rgba(30, 41, 59, 0.4);
}

.home-closing-title {
    margin: 0;
    font-size: clamp(1.25rem, 3vw, 1.55rem);
    font-weight: 700;
}

.home-closing-desc {
    max-width: 520px;
    margin: 12px auto 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.55;
}

.home-closing .home-cta { margin-top: 22px; }

@media (max-width: 720px) {
    .home-principle-list,
    .home-audience-grid,
    .home-tool-grid { grid-template-columns: 1fr; }
    .home-tool-wide { grid-column: auto; }
    .home-stack-list > div { grid-template-columns: 1fr; gap: 6px; }
}

@media (max-width: 640px) {
    .main-home { padding-top: 16px; }
    .home-hero {
        min-height: auto;
        padding: 36px 4px 64px;
    }
    .home-principles,
    .home-audience,
    .home-tools,
    .home-stack,
    .home-faq { padding-top: 40px; }
}

@media (prefers-reduced-motion: reduce) {
    .home-anim {
        animation: none !important;
        opacity: 1;
        transform: none;
    }
}

/* ── Blog ── */
.main-blog {
    max-width: 720px;
    padding-top: 40px;
    padding-bottom: 48px;
}

.blog-head {
    margin-bottom: 36px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.blog-title {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.blog-lead {
    margin: 12px 0 0;
    font-size: 1.02rem;
    line-height: 1.65;
    color: var(--text-muted);
}

.blog-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.blog-item {
    padding: 28px 0;
    border-bottom: 1px solid rgba(51, 65, 85, 0.65);
}

.blog-item:last-child { border-bottom: none; }

.blog-date {
    display: block;
    margin-bottom: 8px;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: #64748b;
}

.blog-item-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.35;
}

.blog-item-desc {
    margin: 10px 0 0;
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--text-muted);
}
