* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", Roboto, Arial, sans-serif;
    color: #fff;
}

.theme-dark {
    background-color: #0a0a0d;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* glass look */
.glass {
    background: rgba(20,20,28,0.6);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    border: 1px solid rgba(255,255,255,0.07);
    box-shadow:
        0 24px 60px rgba(0,0,0,0.8),
        0 2px 3px rgba(255,255,255,0.05) inset;
    border-radius: 16px;
}

/* PERMISSION OVERLAY */
.perm-banner {
    position: fixed;
    z-index: 9999;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(70,70,255,0.22) 0%, rgba(0,0,0,0.9) 60%);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}
.perm-card {
    max-width: 360px;
    width: 100%;
    padding: 24px 20px;
    text-align: center;
}
.perm-card h2 {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
}
.perm-card p {
    font-size: 14px;
    color: #cfcfe8;
    margin-bottom: 16px;
}

/* HEADER */
.topbar {
    width: 100%;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    background: rgba(15,15,22,0.6);
}

.left-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 13px;
    line-height: 1.4;
}
.chip {
    display: flex;
    background: rgba(255,255,255,0.07);
    border-radius: 10px;
    padding: 6px 10px;
    align-items: baseline;
    gap: 6px;
}
.chip .label {
    font-size: 11px;
    color: #9da0ff;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.chip .value {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    word-break: break-all;
}

.right-group {
    display: none;
}
.call-controls-desktop {
    display: none;
}

/* BUTTONS */
.btn {
    border: 0;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
    transition: all .15s linear;
}
.btn-primary {
    background: linear-gradient(135deg,#4f4fff 0%,#6536ff 100%);
    box-shadow: 0 15px 40px rgba(94,74,255,.5);
}
.btn-primary:active {
    transform: scale(0.97);
}
.btn-lg {
    width: 100%;
    font-size: 15px;
    padding: 12px 16px;
}
.w-full { width:100%; }

.ctl-btn {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    color: #fff;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1;
}
.ctl-btn .ctl-icon { font-size:15px; line-height:1; }
.ctl-btn .ctl-text { display:none; line-height:1; }

.ctl-btn.danger {
    background: rgba(255,50,80,0.18);
    border-color: rgba(255,50,80,0.4);
    color: #ff647c;
}

/* aktif durumda (ör: mic kapalıysa kırmızı tonla göster) */
.ctl-btn.active {
    background: rgba(0,200,140,0.18);
    border-color: rgba(0,200,140,0.4);
    color: #5bffc9;
}
.ctl-btn.danger-state {
    background: rgba(255,50,80,0.3);
    border-color: rgba(255,50,80,0.6);
    color: #ff6f88;
}

/* LAYOUT ROOT */
.layout-root {
    flex: 1;
    width: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 12px;
}

/* VIDEO / GRID */
.video-shell {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
}
.video-stage {
    position: relative;
    background: #000;
    border-radius: 16px;
    flex: 1;
    min-height: 240px;
    max-height: 60vh;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.07);
    box-shadow: 0 30px 60px rgba(0,0,0,0.8);
    padding: 8px;
    display: flex;
}
.video-grid {
    flex: 1;
    width: 100%;
    height: 100%;
    display: grid;
    grid-gap: 8px;
    /* varsayılan mobil: 2 sütun, ama 1 kişi varsa tek kutu zaten genişler */
    grid-template-columns: repeat(auto-fit, minmax(min(45%,300px), 1fr));
    align-content: flex-start;
    justify-items: center;
    overflow-y: auto;
}

/* her katılımcı kutusu */
.video-tile {
    position: relative;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.15);
    min-height: 140px;
    max-height: 240px;
    width: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 40px rgba(0,0,0,0.8);
}

.video-wrapper {
    position: relative;
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.video-wrapper video {
    width: 100%;
    height: 100%;
    background: #000;
    object-fit: cover; /* burada ölçeklenebilir görüntü */
}

.tile-overlay {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    padding: 6px 8px;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    line-height: 1.2;
    background: linear-gradient(to top, rgba(0,0,0,0.6), rgba(0,0,0,0));
}
.peer-name {
    font-weight: 600;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}
.status-badges {
    display: flex;
    flex-direction: row;
    gap: 4px;
}
.badge {
    border-radius: 6px;
    padding: 2px 4px;
    font-size: 11px;
    min-width: 22px;
    text-align: center;
    background: rgba(255,255,255,0.15);
    color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.7);
}
.badge.off {
    background: rgba(255,50,80,0.4);
}
.badge.on {
    background: rgba(0,200,140,0.4);
}

/* mobil alt kontrol barı */
.floating-controls {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 14px;
    background: rgba(20,20,28,0.6);
    border: 1px solid rgba(255,255,255,0.07);
    box-shadow: 0 24px 60px rgba(0,0,0,0.8),0 2px 3px rgba(255,255,255,0.05) inset;
}
.call-controls-mobile .ctl-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    font-size: 16px;
    border-radius: 14px;
}

/* SIDE PANEL */
.side-shell {
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.07);
    box-shadow: 0 30px 60px rgba(0,0,0,0.8);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 220px;
    max-height: 40vh;
    overflow-y: auto;
}
.panel-block h3 {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
}

.participants-list {
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    padding: 8px 10px;
    max-height: 120px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.4;
}
.participants-list .person {
    padding: 6px 0;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-weight: 500;
}
.participants-list .person:last-child {
    border-bottom: 0;
}

/* chat */
.chat-block {
    display: flex;
    flex-direction: column;
}
.chat-box {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 8px 10px;
    min-height: 100px;
    max-height: 180px;
    overflow-y: auto;
    font-size: 13px;
}
.chat-line {
    margin-bottom: 6px;
    word-wrap: break-word;
    color: #fff;
}
.chat-who {
    font-weight: 600;
    color: #8cc4ff;
}
.chat-who.me {
    color: #a8ffa8;
}
.chat-text {
    color: #fff;
}
.chat-input-row {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}
.chat-input {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    color: #fff;
}
.send-btn {
    font-size: 13px;
    padding: 10px 12px;
    min-width: 70px;
    border-radius: 10px;
}

/* FOOTER */
.footer-hint {
    margin-top: auto;
    width: 100%;
    border-radius: 0;
    padding: 10px 16px;
    font-size: 12px;
    text-align: center;
    color: #a0a0c8;
    background: rgba(15,15,22,0.6);
    border-top: 1px solid rgba(255,255,255,0.07);
}

/* DESKTOP / LARGE VIEW */
@media(min-width:768px){
    .layout-root{
        flex-direction: row;
        min-height: 0;
        padding: 16px;
        gap:16px;
    }
    .video-shell{
        flex: 1 1 auto;
        min-height: calc(100vh - 170px);
    }
    .video-stage{
        height: 100%;
        max-height: none;
    }
    .video-grid{
        grid-template-columns: repeat(auto-fit, minmax(min(200px,22%), 1fr));
        max-height: 100%;
    }
    .video-tile{
        min-height: 160px;
        max-height: 220px;
    }

    .side-shell{
        flex: 0 0 320px;
        min-height: calc(100vh - 170px);
        max-height: calc(100vh - 170px);
        overflow-y: auto;
    }

    .call-controls-mobile{
        display:none;
    }

    .call-controls-desktop{
        display:flex;
        gap:8px;
    }
    .ctl-btn .ctl-text{
        display:inline;
    }
}
