/* VinuRepublic-branded Mini App theme
   Mirrors https://vinurepublic.com: deep navy gradients, glass cards,
   blue/cyan accents, pill buttons and soft motion. */
:root {
    --bg: #0b1b6b;
    --bg-deep: #031022;
    --text: #ffffff;
    --hint: rgba(255, 255, 255, 0.64);
    --soft: rgba(255, 255, 255, 0.82);
    --card: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.03));
    --card-solid: rgba(12, 30, 78, 0.72);
    --accent: #4f7cff;
    --accent-2: #38bdf8;
    --accent-text: #0b1b6b;
    --border: rgba(255, 255, 255, 0.12);
    --border-strong: rgba(255, 255, 255, 0.22);
    --danger: #ff6b6b;
    --ok: #4ade80;
    --fire-a: #ffb35c;
    --fire-b: #ff5a5f;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; color: var(--text); }
body {
    background:
        radial-gradient(900px 520px at 82% -12%, rgba(79, 124, 255, 0.22), transparent 62%),
        radial-gradient(700px 420px at 6% 18%, rgba(56, 189, 248, 0.10), transparent 66%),
        linear-gradient(180deg, #0b1b6b 0%, #071a3a 58%, #031022 100%);
    background-attachment: fixed;
    font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    -webkit-font-smoothing: antialiased;
}
.app { max-width: 560px; margin: 0 auto; padding: 16px 14px 96px; }

h1 {
    font-size: 27px;
    line-height: 1.12;
    font-weight: 900;
    letter-spacing: -0.035em;
    margin: 6px 0 16px;
    color: #fff;
}
h2 {
    font-size: 18px;
    line-height: 1.25;
    font-weight: 800;
    letter-spacing: -0.015em;
    margin: 0 0 10px;
    color: #fff;
}
h3 {
    font-size: 11px;
    margin: 0 0 8px;
    color: rgba(157, 180, 255, 0.92);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.13em;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.24);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    animation: vin-rise 0.34s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--hint); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: -0.01em; }
.balance {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.2s ease;
}
.balance:hover { background: rgba(255, 255, 255, 0.035); }
.balance:last-child { border-bottom: 0; }
.ticker { font-weight: 700; letter-spacing: 0.02em; }
.balance.you { color: #8fb0ff; font-weight: 700; }

.btn {
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: var(--accent-text);
    padding: 12px 18px;
    font-weight: 800;
    font-size: 14px;
    line-height: 1.1;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.26); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.42; cursor: default; }
.btn.secondary {
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    border: 1px solid var(--border-strong);
    box-shadow: none;
}
.btn.secondary:hover:not(:disabled) {
    background: #fff;
    border-color: #fff;
    color: var(--accent-text);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}
.btn.danger { background: linear-gradient(92deg, var(--fire-a), var(--fire-b)); color: #2b0a00; }
.btn.tiny { width: auto; padding: 7px 12px; font-size: 12px; }

input, select, textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 11px 13px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: rgba(122, 158, 255, 0.62);
    box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.16);
    background: rgba(255, 255, 255, 0.07);
}
textarea { resize: vertical; font-family: inherit; }
label { display: block; font-size: 11px; color: rgba(157, 180, 255, 0.9); margin: 12px 0 5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.inline { display: flex; gap: 8px; }
.inline > * { flex: 1; }

.pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end; }
.pair .flip {
    width: 38px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-strong);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    font-size: 17px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}
.pair .flip:hover { background: #fff; color: var(--accent-text); transform: rotate(180deg); }
select option { background: #0c1e4e; color: #fff; }

.clickable { cursor: pointer; }
.clickable:hover { opacity: 0.88; }

.tabs {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    display: flex;
    gap: 2px;
    background: rgba(7, 20, 55, 0.72);
    border-top: 1px solid var(--border);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    max-width: 560px;
    margin: 0 auto;
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.32);
    z-index: 20;
}
.tabs button {
    flex: 1;
    background: none;
    border: 0;
    color: rgba(255, 255, 255, 0.5);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 6px 2px;
    cursor: pointer;
    border-radius: 12px;
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.tabs button:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.tabs button.active { color: #a9c2ff; background: rgba(79, 124, 255, 0.16); }
.tabs .ico { display: block; font-size: 19px; line-height: 1.25; transition: transform 0.2s ease; }
.tabs button.active .ico { transform: translateY(-2px); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.chip {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.68);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.chip:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.chip.active { background: #fff; color: var(--accent-text); border-color: #fff; font-weight: 800; }

.tx { padding: 11px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.tx:last-child { border-bottom: 0; }
.tx a { color: #8fb0ff; text-decoration: none; }
.tx a:hover { color: #fff; }

.qr { display: block; width: 180px; height: 180px; margin: 0 auto 10px; border-radius: 16px; background: #fff; padding: 8px; }
.addr { word-break: break-all; font-size: 12px; color: rgba(255, 255, 255, 0.78); }
.event {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.2s ease;
}
.event:hover { background: rgba(255, 255, 255, 0.035); }
.event:last-child { border-bottom: 0; }
.pill {
    display: inline-flex;
    align-items: center;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(122, 158, 255, 0.32);
    background: rgba(79, 124, 255, 0.16);
    color: #cfdcff;
}
.empty { text-align: center; color: var(--hint); padding: 32px 12px; }
.empty a { color: #8fb0ff; text-decoration: none; }
.toast {
    position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
    background: rgba(10, 25, 70, 0.94);
    border: 1px solid var(--border-strong);
    color: #fff;
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    max-width: 85%;
    text-align: center;
    z-index: 30;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    animation: vin-rise 0.22s ease both;
}
.loading { text-align: center; padding: 40px; color: var(--hint); }
.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes vin-rise {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Admin */
.admin-section { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.admin-section > summary {
    cursor: pointer;
    font-weight: 700;
    padding: 6px 0;
    list-style: none;
    color: #fff;
    transition: color 0.2s ease;
}
.admin-section > summary:hover { color: #a9c2ff; }
.admin-section > summary::-webkit-details-marker { display: none; }
.admin-section > summary::before { content: '▸ '; color: rgba(157, 180, 255, 0.9); }
.admin-section[open] > summary::before { content: '▾ '; }
.admin-section .audit-item { padding: 10px 0; }
.audit-item {
    padding: 9px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    line-height: 1.5;
}
.audit-item:last-child { border-bottom: none; }

/* Chatroom */
.chat-composer { margin-top: 2px; }
.chat-composer .btn { width: 100%; margin-top: 9px; }
.chat-free {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 9px;
    font-size: 12px;
    color: var(--hint);
}
.chat-free input { width: auto; flex: 0; }
.chat-note { margin: 9px 0 2px; }
.chat-list { display: flex; flex-direction: column; gap: 11px; margin-top: 12px; }
.chat-msg { display: flex; gap: 9px; align-items: flex-start; animation: vin-rise 0.25s ease both; }
.chat-msg.own { flex-direction: row-reverse; }
.chat-avatar {
    width: 32px; height: 32px; flex: 0 0 32px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--accent), var(--accent-2));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 13px;
    box-shadow: 0 6px 14px rgba(79, 124, 255, 0.28);
}
.chat-body {
    max-width: 82%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 9px 12px;
    transition: border-color 0.2s ease;
}
.chat-body:hover { border-color: rgba(255, 255, 255, 0.2); }
.chat-msg.own .chat-body {
    background: linear-gradient(160deg, rgba(79, 124, 255, 0.25), rgba(56, 189, 248, 0.08));
    border-color: rgba(122, 158, 255, 0.32);
}
.chat-head { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; font-size: 12px; }
.chat-head b { color: #fff; }
.chat-head span { color: var(--hint); font-size: 10.5px; white-space: nowrap; }
.chat-text { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; color: rgba(255, 255, 255, 0.92); }
.chat-actions { display: flex; gap: 12px; margin-top: 7px; flex-wrap: wrap; }
.chat-link {
    background: none; border: 0; padding: 0;
    color: #8fb0ff; font-size: 11px; font-weight: 600; cursor: pointer;
    transition: color 0.2s ease;
}
.chat-link:hover { color: #fff; }
.chat-link.danger { color: #ff8d8d; }
.chat-system {
    text-align: center;
    color: rgba(255, 255, 255, 0.58);
    font-size: 11px;
    padding: 8px 12px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
    white-space: pre-wrap;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
.chat-counter { text-align: right; font-size: 11px; color: var(--hint); margin-top: 4px; }
.menu { padding: 10px; }
.menu-item {
    display: flex; align-items: center; gap: 12px; width: 100%;
    background: transparent; border: 0; border-bottom: 1px solid rgba(255,255,255,.08);
    color: #fff; padding: 14px 8px; text-align: left; cursor: pointer;
    border-radius: 12px; transition: background .2s ease;
}
.menu-item:last-child { border-bottom: 0; }
.menu-item:hover { background: rgba(255,255,255,.05); }
.menu-ico { font-size: 22px; width: 30px; text-align: center; }
.menu-body { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.menu-body b { font-size: 15px; }
.menu-arrow { color: var(--hint); font-size: 22px; }
.chat-composer-card .btn { margin-top: 8px; }
.chat-mode { width: auto; }
.chat-mode:hover:not(:disabled) { transform: none; }
.chat-note { margin-top: 9px; line-height: 1.5; }
.chat-messages-card { margin-top: 0; }
a.btn { text-decoration: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.balance > span { min-width: 0; }
.balance > span:last-child { text-align: right; overflow-wrap: anywhere; }
.tx .row { align-items: flex-start; }
.tx .row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 380px) {
    .inline { flex-wrap: wrap; }
    .inline > * { min-width: 0; }
    .chat-body { max-width: 86%; }
    h1 { font-size: 24px; }
}
.proof-row {
    display: grid;
    grid-template-columns: 60px repeat(3, minmax(0, 1fr));
    gap: 4px 10px;
    padding: 9px 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
    align-items: baseline;
}
.proof-row:last-of-type { border-bottom: 0; }
.proof-row b { font-size: 13px; }
.proof-row span { font-size: 12px; color: rgba(255,255,255,.78); overflow-wrap: anywhere; }
@media (max-width: 380px) {
    .proof-row { grid-template-columns: 46px minmax(0, 1fr); }
    .proof-row b { grid-row: auto; }
}
.console-out {
    margin-top: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--border);
    border-radius: 10px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 11.5px;
    line-height: 1.45;
    max-height: 320px;
    overflow-y: auto;
}
.proof-item { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.proof-item:last-of-type { border-bottom: 0; }
.proof-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.proof-grid {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 3px 12px;
    margin-top: 5px;
    font-size: 12px;
}
.proof-grid > span:nth-child(odd) { color: var(--hint); }
.proof-grid > span:nth-child(even) { text-align: right; overflow-wrap: anywhere; }
