/* ═══════════════════════════════════════════════════════════════════
   Golden Pharaoh Tower — EagleE2E UI Theme
   Trump Tower opulence + Egyptian cryptographic mystique
   ═══════════════════════════════════════════════════════════════════ */

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

:root {
    --marble: #FAF9F6;
    --text-primary: #111111;
    --text-secondary: #6B6660;
    --gold: #D4AF37;
    --gold-light: #F4D03F;
    --gold-dark: #B38B2E;
    --gold-gradient: linear-gradient(135deg, #F4D03F, #D4AF37, #B38B2E);
    --gold-gradient-horizontal: linear-gradient(90deg, #F4D03F, #D4AF37, #B38B2E);
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-bg-strong: rgba(255, 255, 255, 0.88);
    --glass-blur: blur(32px);
    --glass-border: rgba(255, 255, 255, 0.5);
    --radius-panel: 24px;
    --radius-bubble: 20px;
    --radius-input: 16px;
    --radius-button: 16px;
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.14);
    --shadow-gold: 0 4px 20px rgba(212, 175, 55, 0.25);
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 250ms;
    --danger: #c0392b;
}

/* ── Marble background ────────────────────────────────────────────── */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-primary);
    min-height: 100dvh;
    overflow-x: hidden;
    background-color: var(--marble);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(212, 175, 55, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(244, 208, 63, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, rgba(179, 139, 46, 0.04) 0%, transparent 55%),
        radial-gradient(ellipse at 40% 30%, rgba(255, 255, 255, 0.8) 0%, transparent 40%);
    background-attachment: fixed;
}

/* ── App shell ────────────────────────────────────────────────────── */

#app {
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ── Header ───────────────────────────────────────────────────────── */

#app-header {
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 20;
    overflow: hidden;
    background: var(--glass-bg-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
}

#app-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gold-gradient-horizontal);
}

#app-header h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-tagline {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.3px;
    opacity: 0.75;
    background: inherit;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.version-display {
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.5;
    letter-spacing: 0.3px;
}

.header-btn {
    background: transparent;
    color: var(--gold);
    border: 2px solid var(--gold);
    padding: 6px 16px;
    border-radius: var(--radius-button);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all var(--duration) var(--ease);
}

.header-btn:hover {
    background: var(--gold-gradient);
    color: var(--text-primary);
    border-color: transparent;
    box-shadow: var(--shadow-gold);
}

.lang-picker {
    position: relative;
}

.lang-toggle {
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.lang-menu {
    display: none;
    position: fixed;
    background: var(--marble);
    border: 1px solid var(--gold);
    border-radius: var(--radius-button);
    overflow: hidden;
    z-index: 1000;
    min-width: 140px;
    box-shadow: var(--shadow-lg);
}

.lang-menu.open {
    display: flex;
    flex-direction: column;
}

.lang-option {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 8px 14px;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--duration) var(--ease);
}

.lang-option:hover {
    background: rgba(255, 215, 0, 0.15);
}

.lang-option.lang-active {
    color: var(--gold);
    font-weight: 600;
}

/* ── App body (sidebar + main) ────────────────────────────────────── */

#app-body {
    flex: 1;
    display: flex;
    flex-direction: row;
    min-height: 0;
    overflow: hidden;
}

#main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

/* ── Sidebar ──────────────────────────────────────────────────────── */

#sidebar {
    width: 340px;
    flex-shrink: 0;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--glass-border);
    position: relative;
    overflow-y: auto;
}

#sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 3px;
    background: var(--gold-gradient);
}

/* Mobile: hide sidebar, show hamburger menu */
@media (max-width: 768px) {
    #sidebar {
        display: none;
    }
}

/* Hamburger menu button (mobile only, shows when in chat) */
#menu-btn {
    font-size: 20px;
    padding: 4px 10px;
    border: none;
    background: none;
    color: var(--gold);
    cursor: pointer;
}

@media (min-width: 769px) {
    #menu-btn {
        display: none !important;
    }
}

/* ── Auth forms (login, register) ─────────────────────────────────── */

.auth-form {
    padding: 40px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 440px;
    margin: 40px auto;
    width: 100%;
    position: relative;
    background: var(--glass-bg-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-md);
}

.auth-form::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-panel);
    padding: 2px;
    background: var(--gold-gradient);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.auth-form h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 4px;
    text-align: center;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    padding: 12px 14px;
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: var(--radius-input);
    font-size: 16px;
    outline: none;
    background: var(--glass-bg);
    transition: border-color var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease);
}

.form-group input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15);
}

/* ── Buttons ──────────────────────────────────────────────────────── */

.btn {
    padding: 12px;
    border: none;
    border-radius: var(--radius-button);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--duration) var(--ease),
                transform 150ms var(--ease);
}

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

.btn-primary {
    background: var(--gold-gradient);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transition: left 0.5s var(--ease);
}

.btn-primary:hover::after {
    left: 100%;
}

.btn-primary:hover {
    box-shadow: var(--shadow-gold);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary:disabled::after {
    display: none;
}

.auth-link {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-link a {
    color: var(--gold);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--duration) var(--ease);
}

.auth-link a:hover {
    color: var(--gold-light);
}

.error-msg {
    color: var(--danger);
    font-size: 14px;
    padding: 10px 14px;
    background: rgba(192, 57, 43, 0.08);
    border-radius: 12px;
    border-left: 3px solid var(--danger);
    display: none;
}

.error-msg a {
    color: var(--gold);
    font-weight: 600;
}

.field-hint {
    color: var(--gold);
    font-size: 13px;
    margin-top: 4px;
}

.status-msg {
    color: var(--text-secondary);
    font-size: 14px;
    padding: 10px 14px;
    text-align: center;
}

/* Gold spinning ankh loader */
.gold-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.gold-loader .spinner {
    color: var(--gold);
    animation: ankhSpin 1.2s ease-in-out infinite;
}

@keyframes ankhSpin {
    0% { transform: rotate(0deg); opacity: 0.6; }
    50% { transform: rotate(180deg); opacity: 1; }
    100% { transform: rotate(360deg); opacity: 0.6; }
}

/* ── Conversation list ────────────────────────────────────────────── */

.conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.user-item {
    padding: 16px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    border-radius: var(--radius-bubble);
    transition: background var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease);
    margin-bottom: 4px;
}

.user-item:hover {
    background: rgba(212, 175, 55, 0.1);
    box-shadow: var(--shadow-sm);
}

.user-item:active {
    background: rgba(212, 175, 55, 0.18);
}

.user-name {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Gold dot — preserved for potential reuse, currently replaced by red-eye coin */
.unread-badge-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gold-gradient);
    box-shadow: 0 0 6px rgba(212, 175, 55, 0.5);
    flex-shrink: 0;
}

/* ── Welcome panel (desktop sidebar active, main shows this) ──────── */

.welcome-panel {
    flex: 1;
    background-image: url('bust-lobby.png?v=3');
    background-size: contain;
    background-position: center center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
}

/* ── Chat view ────────────────────────────────────────────────────── */

.chat-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--glass-bg-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
}

.chat-back {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--gold);
    padding: 4px 8px;
    border-radius: 8px;
    transition: background var(--duration) var(--ease);
}

.chat-back:hover {
    background: rgba(212, 175, 55, 0.12);
}

@media (min-width: 769px) {
    .chat-back {
        display: none;
    }
}

.chat-partner-name {
    font-size: 18px;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Message bubbles ──────────────────────────────────────────────── */

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: var(--radius-bubble);
    font-size: 15px;
    line-height: 1.45;
    word-wrap: break-word;
    position: relative;
}

.message-sent {
    align-self: flex-end;
    background: var(--gold-gradient);
    color: var(--text-primary);
    border-bottom-right-radius: 6px;
    box-shadow: var(--shadow-sm);
}

.message-sent::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(ellipse at 30% 40%, rgba(255, 255, 255, 0.2), transparent 70%);
    pointer-events: none;
}

.message-received {
    align-self: flex-start;
    background: var(--glass-bg-strong);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--text-primary);
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(212, 175, 55, 0.25);
    box-shadow: var(--shadow-sm);
}

/* ── Collapsible long messages ────────────────────────────────────── */

.msg-content {
    position: relative;
}

.msg-content.msg-collapsed {
    max-height: 80px;
    overflow: hidden;
}

.msg-content.msg-collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    pointer-events: none;
}

.message-sent .msg-content.msg-collapsed::after {
    background: linear-gradient(transparent, #c5a028);
}

.message-received .msg-content.msg-collapsed::after {
    background: linear-gradient(transparent, rgba(30, 30, 30, 0.95));
}

.msg-expand-btn {
    display: block;
    background: none;
    border: none;
    color: var(--gold);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 0 0;
    font-family: inherit;
}

.message-sent .msg-expand-btn {
    color: rgba(17, 17, 17, 0.7);
    text-align: right;
    width: 100%;
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.message-sent .message-time {
    text-align: right;
    color: rgba(17, 17, 17, 0.55);
}

/* ── Copy message button ─────────────────────────────────────────── */

.copy-msg-btn {
    position: absolute;
    top: 6px;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    opacity: 0.35;
    transition: opacity 200ms ease;
    color: inherit;
    line-height: 0;
    z-index: 1;
}

.copy-msg-btn svg {
    width: 14px;
    height: 14px;
}

.copy-msg-btn:hover,
.copy-msg-btn:active {
    opacity: 0.8;
}

.copy-msg-done {
    opacity: 0.8;
}

.message-sent .copy-msg-btn {
    left: 6px;
}

.message-sent .msg-content {
    padding-left: 22px;
}

.message-received .copy-msg-btn {
    right: 6px;
}

.message-received .msg-content {
    padding-right: 22px;
}

/* ── Delete message button ──────────────────────────────────────── */

.delete-msg-btn {
    position: absolute;
    top: 24px;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    opacity: 0.35;
    transition: opacity 200ms ease;
    color: inherit;
    line-height: 0;
    z-index: 1;
}

.delete-msg-btn:hover,
.delete-msg-btn:active {
    opacity: 0.8;
}

.delete-msg-btn svg {
    width: 14px;
    height: 14px;
}

.message-sent .delete-msg-btn {
    left: 6px;
}

.message-received .delete-msg-btn {
    right: 6px;
}

/* ── Date separators ──────────────────────────────────────────────── */

.date-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 8px;
    user-select: none;
}

.date-separator::before,
.date-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.35), transparent);
}

.date-separator span {
    font-size: 12px;
    font-weight: 600;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* ── Message grouping ─────────────────────────────────────────────── */

.message-grouped {
    margin-top: -6px;
}

.message-sent.message-grouped {
    border-top-right-radius: 6px;
}

.message-received.message-grouped {
    border-top-left-radius: 6px;
}

/* Message slide-up animation */
.animate-in {
    animation: messageSlideUp 300ms var(--ease) both;
}

@keyframes messageSlideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Compose bar ──────────────────────────────────────────────────── */

.chat-compose {
    padding: 14px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--glass-bg-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--glass-border);
    position: relative;
}

.chat-compose::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gold-gradient-horizontal);
}

.chat-compose textarea {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid rgba(212, 175, 55, 0.25);
    border-radius: 24px;
    font-size: 16px;
    outline: none;
    background: var(--glass-bg);
    transition: border-color var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease);
    resize: none;
    max-height: 120px;
    overflow-y: auto;
    font-family: inherit;
    line-height: 1.4;
}

.chat-compose textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.12);
}

.chat-compose button#chat-send {
    background: none;
    color: var(--text-primary);
    border: none;
    border-radius: 0;
    width: auto;
    height: auto;
    padding: 4px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    position: relative;
    overflow: visible;
}

.send-scarab-img {
    width: 36px;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
    transition: box-shadow var(--duration) var(--ease),
                transform 150ms var(--ease);
}

.chat-compose button#chat-send::after {
    display: none;
}

.chat-compose button#chat-send:hover .send-scarab-img {
    transform: scale(1.1);
    filter: brightness(1.15);
}

.chat-compose button#chat-send:active:not(:disabled) {
    transform: scale(0.92);
}

.chat-compose button#chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-compose button#chat-send:disabled::after {
    display: none;
}

/* ── Attach button ────────────────────────────────────────────────── */

.compose-attach-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 6px 8px;
    flex-shrink: 0;
    color: var(--gold);
    opacity: 0.65;
    border-radius: 8px;
    transition: opacity var(--duration) var(--ease),
                background var(--duration) var(--ease);
}

.compose-attach-btn:hover {
    opacity: 1;
    background: none;
}

.compose-attach-btn:hover .attach-icon-img {
    transform: scale(1.1);
    filter: brightness(1.15);
}

/* ── Voice record button ─────────────────────────────────────────── */

.compose-voice-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    flex-shrink: 0;
    color: var(--gold);
    opacity: 0.65;
    border-radius: 50%;
    transition: opacity var(--duration) var(--ease),
                background var(--duration) var(--ease),
                transform 150ms var(--ease);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

.compose-voice-btn:hover {
    opacity: 1;
}

.compose-voice-btn:active,
.compose-voice-btn.recording {
    opacity: 1;
    background: rgba(192, 57, 43, 0.15);
    transform: scale(1.15);
}

.voice-mic-icon {
    width: 28px;
    height: 28px;
    display: block;
}

.compose-voice-btn.recording .voice-mic-icon {
    color: var(--danger);
    animation: micPulse 1s ease-in-out infinite;
}

@keyframes micPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── Recording indicator ─────────────────────────────────────────── */

.voice-recording-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--glass-bg-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-sm);
}

.recording-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--danger);
    animation: pulseGlow 1s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.4); }
    50% { opacity: 0.6; box-shadow: 0 0 8px 4px rgba(192, 57, 43, 0.2); }
}

.recording-timer {
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--danger);
    min-width: 32px;
}

.recording-label {
    font-size: 13px;
    color: var(--text-secondary);
    flex: 1;
}

.recording-cancel-btn {
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: none;
    border: none;
    flex-shrink: 0;
}

/* ── Browser context warning ──────────────────────────────────────── */

.context-warning {
    background: rgba(254, 249, 231, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #7d6608;
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.4;
    border-bottom: 2px solid var(--gold);
}

.context-warning strong {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

.context-warning p {
    margin: 0;
}

/* ── iOS non-Safari warning (Chrome, Firefox, etc.) ──────────────── */

.ios-chrome-warning {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: iosFlash 2s ease-in-out infinite;
}

@keyframes iosFlash {
    0%, 100% { background: #000; }
    50% { background: var(--gold); }
}

.ios-chrome-warning-inner {
    background: #fff;
    color: #000;
    border: 4px solid var(--gold);
    border-radius: 16px;
    padding: 24px 20px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.ios-chrome-warning-title {
    display: block;
    font-size: 22px;
    color: #000;
    margin-bottom: 12px;
    line-height: 1.3;
}

.ios-chrome-warning p {
    font-size: 15px;
    line-height: 1.5;
    margin: 0 0 16px;
    color: #333;
}

.ios-chrome-steps {
    text-align: left;
    padding-left: 24px;
    margin: 0 0 16px;
    font-size: 16px;
    line-height: 1.8;
    color: #000;
    font-weight: 600;
}

.ios-chrome-steps li {
    margin-bottom: 4px;
}

.ios-chrome-copy-btn {
    display: block;
    width: 100%;
    background: #f5f0e0;
    border: 3px solid var(--gold);
    border-radius: 12px;
    padding: 14px 12px 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(184, 134, 11, 0.3);
}

.ios-chrome-copy-btn:active {
    background: var(--gold);
}

.ios-chrome-copy-url {
    display: block;
    font-size: 17px;
    font-weight: 700;
    color: #000;
    word-break: break-all;
    line-height: 1.3;
}

.ios-chrome-copy-hint {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gold);
    margin-top: 6px;
}

/* ── Info notes ───────────────────────────────────────────────────── */

.info-note {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ── Key actions (conversations footer) ───────────────────────────── */

.key-actions {
    padding: 20px 16px;
    text-align: center;
    border-top: 1px solid rgba(212, 175, 55, 0.2);
}

.btn-link {
    background: none;
    border: none;
    color: var(--gold);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 16px;
    transition: color var(--duration) var(--ease);
}

.btn-link:hover {
    color: var(--gold-light);
    text-decoration: underline;
}

.import-instructions {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ── Modals / overlays ────────────────────────────────────────────── */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.transfer-overlay,
.recovery-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn var(--duration) var(--ease);
}

.transfer-card,
.recovery-card {
    background: var(--glass-bg-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-panel);
    padding: 36px 28px;
    text-align: center;
    max-width: 360px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: slideUp 350ms var(--ease);
    position: relative;
}

.transfer-card::before,
.recovery-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-panel);
    padding: 2px;
    background: var(--gold-gradient);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.transfer-card h2,
.recovery-card h2 {
    font-size: 20px;
    margin-bottom: 16px;
}

.transfer-code {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: 8px;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding: 16px;
    margin-bottom: 16px;
    font-family: monospace;
}

.transfer-card p,
.recovery-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

/* ── Device manager ──────────────────────────────────────────────── */

.device-manager-card {
    max-width: 440px;
    width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}

.device-list {
    margin-bottom: 20px;
}

.device-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--radius-input);
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.15);
    transition: background var(--duration) var(--ease);
}

.device-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.device-current {
    border-color: rgba(212, 175, 55, 0.4);
    background: rgba(212, 175, 55, 0.08);
}

.device-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.device-badge {
    color: var(--gold);
    font-weight: 500;
    font-size: 13px;
}

.device-meta {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.btn-revoke {
    background: none;
    border: 1px solid var(--danger);
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--radius-button);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}

.btn-revoke:hover {
    background: var(--danger);
    color: white;
}

.btn-revoke:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Lock screen ─────────────────────────────────────────────────── */

.lock-info {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* ── Recovery partner selection ───────────────────────────────────── */

.partner-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0;
}

.partner-checkbox-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 2px solid rgba(212, 175, 55, 0.25);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color var(--duration) var(--ease),
                background var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease);
}

.partner-checkbox-item:hover {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.06);
    box-shadow: var(--shadow-sm);
}

.partner-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--gold);
}

.partner-checkbox-item .partner-name {
    font-size: 15px;
    font-weight: 500;
}

/* ── Threshold selector ───────────────────────────────────────────── */

.threshold-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.threshold-selector label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.threshold-selector select {
    padding: 8px 12px;
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    background: var(--glass-bg);
    transition: border-color var(--duration) var(--ease);
}

.threshold-selector select:focus {
    border-color: var(--gold);
}

/* ── Recovery status ──────────────────────────────────────────────── */

.recovery-status {
    text-align: center;
    padding: 24px;
}

.recovery-status .transfer-code {
    margin: 16px auto;
    max-width: 280px;
}

.recovery-status .partner-list {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 12px 0;
}

.recovery-status .contribution-count {
    font-size: 18px;
    font-weight: 600;
    color: var(--gold);
    margin: 8px 0;
}

/* ── File attachments ─────────────────────────────────────────────── */

.attachment-bubble {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    cursor: default;
}

.message-sent .attachment-bubble {
    background: rgba(255, 255, 255, 0.18);
}

.attachment-icon {
    font-size: 24px;
    flex-shrink: 0;
    color: var(--gold);
}

.attachment-info {
    flex: 1;
    min-width: 0;
}

.attachment-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-size {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.attachment-download-btn {
    background: var(--gold-gradient);
    color: var(--text-primary);
    border: none;
    border-radius: 10px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--duration) var(--ease),
                opacity var(--duration) var(--ease);
}

.attachment-download-btn:hover {
    box-shadow: var(--shadow-gold);
}

.attachment-download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Voice message inline player ─────────────────────────────────── */

.voice-bubble {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    min-width: 200px;
}

.message-sent .voice-bubble {
    background: rgba(255, 255, 255, 0.18);
}

.voice-play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gold-gradient);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: box-shadow var(--duration) var(--ease),
                transform 150ms var(--ease);
}

.voice-play-btn:hover {
    box-shadow: var(--shadow-gold);
    transform: scale(1.05);
}

.voice-play-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.voice-play-btn svg {
    width: 16px;
    height: 16px;
    fill: var(--text-primary);
}

.voice-info {
    flex: 1;
    min-width: 0;
}

.voice-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.voice-duration {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.voice-progress {
    height: 3px;
    background: rgba(212, 175, 55, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.voice-progress-fill {
    height: 100%;
    background: var(--gold-gradient-horizontal);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

/* ── Upload progress ──────────────────────────────────────────────── */

.progress-bar {
    height: 4px;
    background: rgba(212, 175, 55, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
}

.progress-fill {
    height: 100%;
    background: var(--gold-gradient-horizontal);
    border-radius: 2px;
    transition: width 0.2s;
    width: 0%;
}

.upload-progress {
    padding: 12px 16px;
    background: var(--glass-bg-strong);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-sm);
}

.upload-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.upload-filename {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 12px;
}

.upload-cancel-btn {
    color: var(--danger);
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
}

.upload-progress .progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ── Shine sweep animation ────────────────────────────────────────── */

@keyframes shineSweep {
    from { left: -100%; }
    to { left: 100%; }
}

/* ── Sidebar conversation list active state ───────────────────────── */

#sidebar .user-item.active {
    background: rgba(212, 175, 55, 0.15);
    box-shadow: var(--shadow-sm);
}

/* ── Desktop depth ────────────────────────────────────────────────── */

@media (min-width: 769px) {
    #app {
        box-shadow: none;
    }
}

/* ── Mobile auth form spacing ─────────────────────────────────────── */

@media (max-width: 480px) {
    .auth-form {
        margin: 16px;
        padding: 28px 20px;
    }
}

/* ── Header shimmer (one-time on page load) ───────────────────────── */

@keyframes headerShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

#app-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(244, 208, 63, 0.12), rgba(255, 255, 255, 0.18), rgba(244, 208, 63, 0.12), transparent);
    animation: headerShimmer 1.5s var(--ease) 0.3s 1 forwards;
    pointer-events: none;
    z-index: 1;
}

/* ── Gold scrollbar (WebKit/Blink) ────────────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--gold-light), var(--gold-dark));
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}

/* ── Brand image assets ───────────────────────────────────────────── */

/* Chest attachment icon (compose bar) */
.attach-icon-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    transition: transform var(--duration) var(--ease), filter var(--duration) var(--ease);
}

/* Chest attachment icon (message bubble) */
.attach-icon-img-bubble {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

/* Octagonal coin avatar */
.avatar-coin-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter var(--duration) var(--ease), transform var(--duration) var(--ease);
}

/* Unread state: eagle landing on coin — taller image, coin at bottom */
/* Width > 100% breaks out of the 44px container so the coin portion
   matches the read coin size. height: auto preserves aspect ratio.
   Negative margins center and position the coin where the read coin sits. */
.avatar-coin-img.unread {
    object-fit: initial;
    width: 110%;
    height: auto;
    margin-left: -5%;
    margin-top: -34%;
}

.user-item:hover .avatar-coin-img {
    filter: brightness(1.15);
    transform: scale(1.1);
}

.user-avatar {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    outline: none;
    overflow: visible;
    padding: 0;
    border-radius: 0;
}

/* Welcome panel bust — no longer used as <img>, now a background-image on .welcome-panel */

/* Welcome text overlay on cover image */
.welcome-text {
    position: absolute;
    bottom: 24px;
    left: 0;
    right: 0;
    margin: 0;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.55);
    color: var(--gold);
    font-size: 1rem;
    letter-spacing: 0.05em;
    backdrop-filter: blur(6px);
}

/* Auth hero (octagonal coin) */
.auth-hero {
    width: 160px;
    height: auto;
    margin: 0 auto 12px;
    border-radius: 0;
    object-fit: contain;
    border: none;
    outline: none;
    box-shadow: none;
    background: transparent;
}

/* Empty chat state */
.empty-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.empty-chat-icon {
    width: 100px;
    height: auto;
    margin-bottom: 16px;
    opacity: 0.7;
}

.empty-chat p {
    font-size: 15px;
    color: var(--text-secondary);
}

/* ── Gesture feedback ────────────────────────────────────────────── */

.user-item {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.user-item-held {
    transform: scale(1.02);
    box-shadow: 0 2px 12px rgba(212, 175, 55, 0.3);
    transition: transform 150ms var(--ease), box-shadow 150ms var(--ease);
}

/* ── Multi-select mode ───────────────────────────────────────────── */

.user-avatar {
    position: relative;
}

.user-item-selected {
    background: rgba(212, 175, 55, 0.15);
    outline: 2px solid var(--gold);
    outline-offset: -2px;
}

.user-item-selected .user-avatar::after {
    content: '\2713';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: var(--gold-gradient);
    border-radius: 50%;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.multiselect-bar {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--glass-bg-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-top: 2px solid var(--gold);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
    animation: slideUp 250ms var(--ease);
    z-index: 30;
}

.multiselect-count {
    font-size: 15px;
    font-weight: 600;
    color: var(--gold-dark);
}

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

/* ── Compose overlay (multi-recipient) ───────────────────────────── */

.compose-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn var(--duration) var(--ease);
}

.compose-card {
    background: var(--glass-bg-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-panel);
    padding: 28px 24px;
    max-width: 440px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: slideUp 350ms var(--ease);
    position: relative;
}

.compose-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-panel);
    padding: 2px;
    background: var(--gold-gradient);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.compose-card h2 {
    font-size: 20px;
    margin-bottom: 4px;
}

.compose-recipients {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 16px;
}

.broadcast-header-recipients {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
}

.broadcast-label {
    font-weight: 700;
    font-size: 15px;
    color: var(--gold-dark);
    flex-shrink: 0;
}

.broadcast-header-recipients .compose-recipients {
    margin: 0;
    flex-wrap: nowrap;
}

.compose-recipient-chip {
    padding: 4px 12px;
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gold-dark);
}

.compose-card textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: var(--radius-input);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    background: var(--glass-bg);
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
    transition: border-color var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease);
}

.compose-card textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15);
}

.compose-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
    align-items: center;
}

.compose-progress {
    margin-top: 12px;
}

.compose-progress-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 6px;
    text-align: center;
}

/* ── Drag-to-reorder ─────────────────────────────────────────────── */

.user-item-drag-clone {
    position: fixed;
    z-index: 200;
    pointer-events: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 4px 20px rgba(212, 175, 55, 0.3);
    transform: scale(1.04);
    opacity: 0.95;
    background: var(--glass-bg-strong);
    border-radius: var(--radius-bubble);
}

.user-item-placeholder {
    opacity: 0.25;
    border: 2px dashed rgba(212, 175, 55, 0.4);
    background: transparent !important;
    pointer-events: none;
}

.user-item-shifting {
    transition: transform 200ms var(--ease);
}
