:root {
    --bg: #070b14;
    --bg-2: #0c1220;
    --panel: rgba(16, 24, 38, 0.86);
    --line: rgba(148, 163, 184, 0.16);
    --text: #e8eef7;
    --muted: #8b9bb4;
    --accent: #3ee0c6;
    --accent-2: #7c9cff;
    --danger: #fb7185;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    --radius: 18px;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
}

body {
    background:
        radial-gradient(1200px 500px at 10% -10%, rgba(62, 224, 198, 0.12), transparent 55%),
        radial-gradient(900px 420px at 100% 0%, rgba(124, 156, 255, 0.14), transparent 50%),
        linear-gradient(180deg, var(--bg-2), var(--bg) 40%);
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.app {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: calc(18px + env(safe-area-inset-top)) 20px calc(16px + env(safe-area-inset-bottom));
    max-width: 1180px;
    margin: 0 auto;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

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

.logo {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background:
        linear-gradient(135deg, var(--accent), #1aa58f 48%, var(--accent-2));
    box-shadow: 0 0 0 4px rgba(62, 224, 198, 0.12);
    position: relative;
}

.logo::after {
    content: "";
    position: absolute;
    inset: 10px 9px 10px 18px;
    border: 2px solid #071018;
    border-left: 0;
    border-radius: 0 8px 8px 0;
}

.brand strong {
    display: block;
    font-size: 18px;
    letter-spacing: 0.04em;
}

.brand span {
    color: var(--muted);
    font-size: 12px;
}

.clock {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 14px;
    white-space: nowrap;
}

.shell {
    display: grid;
    grid-template-columns: 188px 1fr;
    gap: 18px;
    align-items: start;
    flex: 1;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: sticky;
    top: 16px;
}

.nav-item, .chip, .btn {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    cursor: pointer;
    transition: 0.18s ease;
}

.nav-item {
    text-align: left;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
}

.nav-item:hover, .chip:hover, .btn:hover {
    border-color: rgba(62, 224, 198, 0.45);
    transform: translateY(-1px);
}

.nav-item.is-active, .chip.is-active {
    background: linear-gradient(180deg, rgba(62, 224, 198, 0.16), rgba(62, 224, 198, 0.05));
    border-color: rgba(62, 224, 198, 0.55);
    color: #d7fff6;
    box-shadow: inset 3px 0 0 var(--accent);
}

.main { min-width: 0; }

.panel[hidden], .codec-pane[hidden], .toast[hidden], #bytesCustomWrap[hidden] {
    display: none !important;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

h1 {
    margin: 0 0 6px;
    font-size: 26px;
    letter-spacing: 0.02em;
}

.lead {
    margin: 0 0 22px;
    color: var(--muted);
    line-height: 1.6;
}

.label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
}

.ip-hero {
    padding: 20px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(62, 224, 198, 0.1), rgba(124, 156, 255, 0.08));
    border: 1px solid rgba(62, 224, 198, 0.18);
    margin-bottom: 18px;
}

.ip-value {
    font-family: var(--mono);
    font-size: clamp(28px, 5vw, 42px);
    letter-spacing: 0.06em;
    margin: 4px 0 16px;
    word-break: break-all;
}

.meta {
    display: grid;
    gap: 14px;
    margin: 0;
}

.meta div {
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
}

.meta dt {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
}

.meta dd {
    margin: 0;
    line-height: 1.5;
    word-break: break-all;
}

.ua { font-size: 13px; color: #c9d4e5; }

.live-stamps {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}

.live-stamps > div {
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.live-stamps code {
    display: block;
    font-family: var(--mono);
    font-size: 18px;
    margin: 4px 0 10px;
    word-break: break-all;
}

.field {
    display: block;
    margin-bottom: 14px;
}

.field > span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
}

input, select, textarea {
    width: 100%;
    background: #0a101b;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 16px;
    outline: none;
}

textarea {
    min-height: 150px;
    resize: vertical;
    font-family: var(--mono);
    line-height: 1.55;
}

input:focus, select:focus, textarea:focus {
    border-color: rgba(62, 224, 198, 0.7);
    box-shadow: 0 0 0 4px rgba(62, 224, 198, 0.12);
}

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

.wrap { flex-wrap: wrap; margin-bottom: 14px; }

.grid3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.chip {
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
}

.btn {
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
}

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

.btn-primary {
    background: linear-gradient(180deg, #4aead2, #1fbfa8);
    color: #06221c;
    border-color: transparent;
    font-weight: 650;
}

.btn-danger {
    color: var(--danger);
    border-color: rgba(251, 113, 133, 0.35);
}

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

.hash-grid {
    display: grid;
    gap: 12px;
}

.with-copy {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.hint {
    min-height: 1.4em;
    margin: 0;
    color: var(--accent);
    font-size: 13px;
}

.hint.is-error { color: var(--danger); }

.foot {
    margin-top: 22px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
    padding: 0 4px;
}

.foot strong {
    color: #c5d0e0;
    margin-right: 6px;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    background: #10231e;
    color: #d7fff6;
    border: 1px solid rgba(62, 224, 198, 0.4);
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 13px;
    z-index: 20;
}

@media (max-width: 760px) {
    .app { padding-left: 12px; padding-right: 12px; }
    .shell { grid-template-columns: 1fr; }
    .nav {
        position: static;
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    .nav-item {
        flex: 0 0 auto;
        white-space: nowrap;
        box-shadow: none;
    }
    .nav-item.is-active { box-shadow: inset 0 -3px 0 var(--accent); }
    .card { padding: 18px 16px; }
    .live-stamps, .grid3 { grid-template-columns: 1fr; }
    .clock { font-size: 12px; padding: 6px 10px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
