:root {
    color-scheme: light;
    --page-bg: radial-gradient(circle at 0% 0%, #e0edff, #f6f8fb 55%);
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-subtle: rgba(255, 255, 255, 0.88);
    --border: #d8deeb;
    --text: #1f2933;
    --muted: #6b7280;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --danger: #ef4444;
    --input-bg: #f9fbff;
    --shadow: 0 25px 60px rgba(15, 32, 80, 0.08);
    --tooltip-shadow: 0 18px 40px rgba(15, 32, 80, 0.18);
}

body[data-theme="dark"] {
    color-scheme: dark;
    --page-bg: radial-gradient(circle at 0% 0%, #1e293b, #0f172a 55%);
    --bg: #0f172a;
    --surface: #111c34;
    --surface-subtle: rgba(17, 28, 52, 0.92);
    --border: #1f2a44;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #60a5fa;
    --accent-hover: #3b82f6;
    --danger: #f87171;
    --input-bg: #0f172a;
    --shadow: 0 25px 60px rgba(8, 16, 32, 0.55);
    --tooltip-shadow: 0 18px 40px rgba(8, 16, 32, 0.55);
}

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    color: var(--text);
    background: var(--page-bg);
    background-color: var(--bg);
    display: flex;
    justify-content: center;
    padding: 3rem 1.5rem;
    transition: background-color 0.3s ease, color 0.3s ease, background 0.3s ease;
}

.app {
    width: min(960px, 100%);
    background: var(--surface);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 2.75rem clamp(1.5rem, 2vw, 3rem);
    display: flex;
    flex-direction: column;
    gap: 2rem;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.app__header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.app__header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.app__header h1 {
    margin: 0;
    font-size: clamp(2rem, 3vw, 2.8rem);
}

.app__header p {
    margin: 0;
    color: var(--muted);
    font-size: 1.05rem;
}

.app__controls {
    display: flex;
    justify-content: flex-end;
}

.button {
    border: none;
    border-radius: 12px;
    padding: 0.65rem 1.2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.button--primary {
    background: linear-gradient(135deg, var(--accent), #5b21b6);
    color: #fff;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
}

body[data-theme="dark"] .button--primary {
    box-shadow: 0 10px 25px rgba(96, 165, 250, 0.28);
}

.button--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(37, 99, 235, 0.28);
}

.button--ghost {
    background: transparent;
    color: var(--muted);
    padding-inline: 0.75rem;
}

.button--ghost:hover {
    color: var(--danger);
}

.button--theme {
    border: 1px solid transparent;
    padding-inline: 0.9rem;
}

.button--theme:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.button--copy {
    padding: 0.45rem 0.85rem;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.button--copy:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.button--copy:disabled {
    cursor: default;
    opacity: 0.7;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field--with-tooltip {
    position: relative;
}

.field__label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--muted);
    font-size: 0.95rem;
}

.field__label span {
    flex: 1;
}

.tooltip__trigger {
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 1.8rem;
    height: 1.8rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-subtle);
    color: var(--muted);
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.field--tooltip-open .tooltip__trigger,
.tooltip__trigger:hover,
.tooltip__trigger:focus-visible {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(37, 99, 235, 0.12);
}

.tooltip__trigger:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

body[data-theme="dark"] .tooltip__trigger:focus-visible {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.tooltip {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 0;
    width: min(320px, calc(100vw - 3rem));
    padding: 1rem 1.1rem;
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--tooltip-shadow);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-0.5rem);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    z-index: 20;
}

.field--tooltip-open .tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.tooltip__content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    font-size: 0.92rem;
}

.tooltip__content p {
    margin: 0;
}

.tooltip__hint {
    font-size: 0.85rem;
    color: var(--muted);
}

.tooltip__close {
    margin-top: 0.75rem;
    align-self: flex-start;
    border: none;
    background: none;
    color: var(--accent);
    font-weight: 600;
    padding: 0;
    cursor: pointer;
}

.tooltip__close:hover {
    color: var(--accent-hover);
}

.field__value {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.field__value output {
    flex: 1;
    display: block;
    overflow-wrap: anywhere;
}

.field input {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.6rem 0.75rem;
    font-size: 1rem;
    background: var(--input-bg);
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
}

.field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

body[data-theme="dark"] .field input:focus {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25);
}

.entries {
    display: grid;
    gap: 1.5rem;
}

.entry {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background: var(--surface-subtle);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.entry__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.entry__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem 1.5rem;
}

.field--output output {
    font-size: 1.25rem;
    font-weight: 700;
}

.app__footer {
    border-top: 1px solid var(--border);
    padding-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.app__footer h2 {
    margin: 0;
    font-size: 1.5rem;
}

.app__footer p {
    margin: 0;
    color: var(--muted);
}

.wallets {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.wallet {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-subtle);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.wallet__text {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.wallet__label {
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.wallet__address {
    font-family: "Fira Code", "Source Code Pro", Consolas, monospace;
    font-size: 0.95rem;
    word-break: break-all;
    color: var(--text);
}

.wallet__copy {
    padding-inline: 1rem;
    white-space: nowrap;
}

.wallet__copy:focus-visible {
    outline: none;
    border: 1px solid var(--accent);
    border-radius: 12px;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

body[data-theme="dark"] .wallet__copy:focus-visible {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25);
}

code {
    font-family: "Fira Code", "Source Code Pro", Consolas, monospace;
    background: rgba(148, 163, 184, 0.15);
    padding: 0.15rem 0.3rem;
    border-radius: 6px;
}

@media (max-width: 600px) {
    body {
        padding: 2rem 1rem;
    }

    .app__header-top {
        flex-direction: column;
        align-items: stretch;
    }

    .button--theme {
        align-self: flex-end;
    }

    .entry {
        padding: 1.1rem;
    }

    .entry__top {
        flex-direction: column;
        align-items: stretch;
    }

    .button--ghost {
        align-self: flex-end;
    }

    .wallet {
        flex-direction: column;
        align-items: stretch;
    }

    .wallet__copy {
        align-self: flex-end;
    }
}
