:root {
    --bg-page: #0b0f19;
    --bg-surface: #151c2c;
    --bg-surface-elevated: #1e283d;
    --bg-input: #0f1523;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-focus: #3b82f6;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-success: #059669;
    --color-success-hover: #047857;
    --color-danger: #dc2626;
    --color-danger-hover: #b91c1c;
    --color-secondary: #334155;
    --color-secondary-hover: #475569;

    --status-green: #10b981;
    --status-amber: #f59e0b;
    --status-red: #ef4444;
    --status-slate: #64748b;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --shadow-card: 0 12px 36px -8px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-stack);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    line-height: 1.5;
}

/* App Card Layout */
.app-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    width: 100%;
    max-width: 520px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (min-width: 640px) {
    .app-card {
        padding: 32px;
        gap: 24px;
    }
}

/* Header */
.app-header {
    text-align: center;
}

.app-title {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.app-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 400;
}

/* Security Banner */
.security-banner {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fde68a;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Section styling */
.section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.section-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Room Input Group */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 480px) {
    .input-group {
        flex-direction: row;
    }
}

input[type="text"] {
    background-color: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    padding: 10px 14px;
    min-height: 44px;
    flex: 1;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

input[type="text"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.room-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.room-gen-btn {
    min-height: 38px;
    padding: 6px 14px;
    font-size: 0.82rem;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
}

.room-gen-btn:hover:not(:disabled) {
    background-color: var(--color-secondary-hover);
}

.input-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    appearance: none;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    min-height: 44px;
    padding: 10px 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, transform 0.05s ease, opacity 0.15s ease;
    user-select: none;
}

.btn:active:not(:disabled) {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
}

.btn-success {
    background-color: var(--color-success);
    color: #ffffff;
}

.btn-success:hover:not(:disabled) {
    background-color: var(--color-success-hover);
}

.btn-secondary {
    background-color: var(--color-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--color-secondary-hover);
}

.btn-danger {
    background-color: var(--color-danger);
    color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
    background-color: var(--color-danger-hover);
}

/* Status Badges */
.status-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 480px) {
    .status-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.status-badge {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.badge-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.badge-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-value {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-subtext {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1.2;
    word-break: break-word;
}

.call-duration {
    font-variant-numeric: tabular-nums;
}

/* Colored Dots */
.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.dot-disconnected {
    background-color: var(--status-red);
}

.dot-connecting {
    background-color: var(--status-amber);
    animation: pulse 1.5s infinite;
}

.dot-connected {
    background-color: var(--status-green);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.dot-waiting {
    background-color: var(--status-amber);
}

.dot-joined {
    background-color: var(--status-green);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.dot-idle {
    background-color: var(--status-slate);
}

.dot-failed {
    background-color: var(--status-red);
}

.dot-ended {
    background-color: var(--status-slate);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.4;
        transform: scale(1.15);
    }
}

/* Incoming / Outgoing Ring Panel */
.ring-panel {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-surface-elevated);
    padding: 14px 16px;
    text-align: center;
}

.ring-panel.ringing-in {
    border-color: var(--status-green);
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.25);
    animation: pulse 1.5s infinite;
}

.ring-panel.ringing-out {
    border-color: var(--status-amber);
}

.ring-panel-text {
    margin: 0 0 12px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ring-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.ring-actions:has(#cancelCallBtn:only-child),
#outgoingActions.ring-actions {
    grid-template-columns: 1fr;
}

/* Call Actions */
.btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 480px) {
    .btn-group {
        display: grid;
        grid-template-columns: 2fr 1fr 1fr;
    }
}

/* Message Area */
.message-area {
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    line-height: 1.45;
    padding: 12px 14px;
    word-break: break-word;
    transition: all 0.2s ease;
}

.message-success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #6ee7b7;
}

.message-info {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: #93c5fd;
}

.message-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

/* Utilities */
.hidden {
    display: none !important;
}

.hidden-audio {
    display: none;
}

html.aneka-call,
html.aneka-call body {
    height: 100%;
    margin: 0;
    background: #07140f;
}
html.aneka-call .app-card {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}
.aneka-face {
    min-height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 28px 24px 32px;
    color: #fff;
    text-align: center;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(47, 122, 84, 0.45), transparent 55%),
        #07140f;
    font-family: "Segoe UI", sans-serif;
}
.aneka-id { margin-top: 12px; }
.aneka-brand {
    margin: 0 0 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #8fbfa6;
}
.aneka-who { margin: 0; font-size: 32px; line-height: 1.15; font-weight: 700; }
.aneka-detail { margin: 8px 0 0; color: #c5ddd0; font-size: 16px; }
.aneka-from { margin: 10px 0 0; font-size: 18px; font-weight: 700; }
.aneka-about {
    margin: 8px 0 0;
    color: #8fbfa6;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.aneka-facts { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.aneka-facts span {
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #d7efe4;
    font-size: 13px;
}
.aneka-mid { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.aneka-orb {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    background: #1f6b4a url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><path d='M6.6 10.8a15.1 15.1 0 0 0 6.6 6.6l2.2-2.2a1 1 0 0 1 1-.25 11.4 11.4 0 0 0 3.6.57 1 1 0 0 1 1 1V20a1 1 0 0 1-1 1A17 17 0 0 1 3 7a1 1 0 0 1 1-1h3.5a1 1 0 0 1 1 1 11.4 11.4 0 0 0 .57 3.6 1 1 0 0 1-.25 1L6.6 10.8z'/></svg>") center 46% / 42px no-repeat;
    box-shadow: 0 0 0 0 rgba(31, 107, 74, 0.55);
    animation: aneka-ring 1.6s ease-out infinite;
}
.aneka-face.is-live .aneka-orb { animation: none; box-shadow: 0 0 0 10px rgba(31, 107, 74, 0.28); }
.aneka-face.is-ended .aneka-orb { animation: none; background-color: #6b3a3a; }
.aneka-face.is-ended .aneka-dock { visibility: hidden; }
.aneka-timer {
    margin: 8px 0 0;
    font-size: 44px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
}
.aneka-caption { margin: 0; color: #8fbfa6; font-size: 14px; letter-spacing: 0.14em; text-transform: uppercase; }
.aneka-note { min-height: 1.2em; margin: 0; color: #fca5a5; font-size: 14px; }
.aneka-dock { display: flex; gap: 22px; margin-bottom: 8px; }
.aneka-mute,
.aneka-speaker,
.aneka-end {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: 0;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.aneka-round {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #1c3328 center / 28px no-repeat;
}
.aneka-mute .aneka-round {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><path d='M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h2v-3.08A7 7 0 0 0 19 11h-2z'/></svg>");
}
.aneka-mute.is-muted .aneka-round { background-color: #f4f7f5; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2307140f'><path d='M19 11h-1.7a5.2 5.2 0 0 1-.46 1.5l1.42 1.42A7 7 0 0 0 19 11zM4.3 3 3 4.3 8.7 10H5v4h4l5 5v-6.7l4.7 4.7 1.3-1.3L4.3 3zM15 7.8V4L10.2 8.8 15 13.6z'/></svg>"); }
.aneka-mute:disabled { opacity: 0.4; cursor: default; }
.aneka-speaker .aneka-round {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><path d='M3 9v6h4l5 5V4L7 9H3zm13.5 3a4.5 4.5 0 0 0-2.5-4.03v8.05A4.5 4.5 0 0 0 16.5 12zM14 3.23v2.06a7 7 0 0 1 0 13.42v2.06a9 9 0 0 0 0-17.54z'/></svg>");
}
.aneka-speaker.is-on .aneka-round {
    background-color: #f4f7f5;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2307140f'><path d='M3 9v6h4l5 5V4L7 9H3zm13.5 3a4.5 4.5 0 0 0-2.5-4.03v8.05A4.5 4.5 0 0 0 16.5 12zM14 3.23v2.06a7 7 0 0 1 0 13.42v2.06a9 9 0 0 0 0-17.54z'/></svg>");
}
.aneka-end .aneka-round {
    background-color: #d64545;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><path d='M12 9c-1.6 0-3.15.25-4.6.72v2.1c0 .4-.23.76-.59.93-1.32.62-2.5 1.42-3.5 2.36-.27.25-.67.27-.96.03L.7 13.5a.7.7 0 0 1-.04-1C2.4 10.3 6.9 8 12 8s9.6 2.3 11.34 4.5a.7.7 0 0 1-.04 1l-1.65 1.64c-.29.24-.69.22-.96-.03a12.4 12.4 0 0 0-3.5-2.36.99.99 0 0 1-.59-.93v-2.1A16.2 16.2 0 0 0 12 9z'/></svg>");
}
@keyframes aneka-ring {
    70% { box-shadow: 0 0 0 18px rgba(31, 107, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(31, 107, 74, 0); }
}
