/* --- css/style.css --- */

/* --- CSS RESET & BASE --- */
* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; -webkit-tap-highlight-color: transparent; outline: none; }
body { 
    background: #000; color: #fff; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    overflow: hidden; position: fixed; width: 100%; height: 100%;
}
input, button, textarea { user-select: auto; font-family: inherit; }

/* --- APP CONTAINER --- */
#app { 
    position: relative; width: 100%; height: 100%; margin: 0 auto;
    background: #000; display: flex; flex-direction: column; overflow: hidden;
    max-width: 600px;
}

.view { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; display: none; background: #000; z-index: 1; }
.view.active { display: block; }
.scroll-view { overflow-y: auto; padding: 20px; padding-bottom: 90px; -webkit-overflow-scrolling: touch; }

h2 { font-size: 24px; margin-bottom: 20px; font-weight: 800; letter-spacing: -0.5px; }
.section-title { font-size: 14px; text-transform: uppercase; color: #666; margin-top: 30px; margin-bottom: 10px; font-weight: bold; letter-spacing: 1px; }

.list-item { 
    display: flex; align-items: center; gap: 15px; 
    background: #111; padding: 12px; margin-bottom: 12px; 
    border-radius: 12px; cursor: pointer; transition: background 0.2s;
    border: 1px solid #222;
}
.list-item:active { background: #222; }
.list-thumb { width: 50px; height: 50px; object-fit: cover; border-radius: 8px; background: #333; }
.unread-dot { width: 10px; height: 10px; background: #007bff; border-radius: 50%; margin-left: auto; }

.btn-action-small { background: #333; border: 1px solid #444; color: #fff; padding: 5px 10px; border-radius: 6px; font-size: 12px; margin-left: auto; }

/* --- AUTH --- */
#auth-modal { 
    position: absolute; top:0; left:0; width:100%; height:100%; z-index: 5000; 
    background: rgba(0,0,0,0.95); display: none; backdrop-filter: blur(10px);
    flex-direction: column; justify-content: center; align-items: center; padding: 30px; 
}
.auth-input { width: 100%; padding: 16px; margin: 8px 0; background: #222; border: 1px solid #333; color: #fff; border-radius: 12px; font-size: 16px; }
.auth-btn { width: 100%; padding: 16px; margin-top: 15px; background: #fff; color: #000; font-weight: 800; border: none; border-radius: 12px; font-size: 16px; cursor: pointer; }
.auth-link { margin-top: 25px; color: #888; font-size: 14px; text-decoration: underline; cursor: pointer; }
.auth-close { position: absolute; top: 30px; right: 30px; font-size: 30px; cursor: pointer; padding: 10px; }

.file-upload-label { display: block; width: 100%; padding: 15px; background: #222; border: 1px dashed #555; text-align: center; border-radius: 12px; margin: 10px 0; color: #aaa; cursor: pointer; }

/* --- NAVBAR --- */
#navbar {
    position: absolute; bottom: 0; width: 100%; height: 70px; 
    background: rgba(0,0,0,0.95); backdrop-filter: blur(20px);
    display: flex; justify-content: space-around; align-items: center;
    border-top: 1px solid black; z-index: 1000; padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn { color: #555; font-size: 10px; display: flex; flex-direction: column; align-items: center; cursor: pointer; transition: color 0.2s; width: 20%; }
.nav-btn.active { color: #fff; }
.nav-btn span { font-size: 24px; margin-bottom: 4px; display: block; }
#btn-new {
    width: 52px; height: 52px; background: #fff; border-radius: 18px; 
    display: flex; align-items: center; justify-content: center;
    color: #000; font-weight: 900; font-size: 30px; 
    margin-top: -30px; border: 4px solid #000; 
    box-shadow: 0 4px 15px rgba(255,255,255,0.2);
}

/* --- CARDS & SWIPE INDICATORS (Kohta 2 & 3) --- */
#feed-stack { width: 100%; height: 100%; position: relative; }
.card {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    background-repeat: no-repeat; background-position: center; 
    background-color: #000; background-size: cover;
    transform-origin: 50% 100%;
    display: flex; flex-direction: column; justify-content: flex-end;
    cursor: pointer; border-radius: 0; overflow: hidden;
    z-index: 10;
}

/* Uudet swaippaus-indikaattorit */
.card-swipe-indicator {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 80px; opacity: 0; z-index: 100; pointer-events: none;
    transition: opacity 0.1s ease;
    text-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.card-overlay {
    padding: 20px;
    padding-bottom: 95px;
    width: 100%;
    pointer-events: none; /* Lisätty, jotta ei estä klikkauksia */
    background: linear-gradient(to top, black 36%, transparent 96%);
}
.hollow-text {
    position: absolute; top: 10%; left: 5%; width: 90%; 
    font-size: 3rem; font-weight: 900; line-height: 1; text-align: center;
    pointer-events: none; word-wrap: break-word;
    text-shadow: 0 2px 4px #000;
    white-space: pre-wrap;
}
.user-pill { display: flex; align-items: center; gap: 12px; pointer-events: auto; margin-left: 10px; }
.user-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; background: #333; }
.user-name { font-weight: 800; font-size: 1.2rem; text-shadow: 0 2px 4px rgba(0,0,0,1); }
.action-icons { 
    position: absolute; right: 20px; bottom: 100px; 
    display: flex; flex-direction: column; gap: 30px; z-index: 10; align-items: center; 
    pointer-events: auto;
}
.icon-btn { font-size: 2rem; filter: drop-shadow(0 0px 1px rgba(0,0,0,0.4)); cursor: pointer; transition: transform 0.2s; }
.icon-btn:active { transform: scale(0.8); }

/* Toimintonapit soittimessa (Kohta 14) */
#player-actions {
    display: flex; justify-content: center; gap: 25px; margin-top: 15px; bottom: 170px !important; 
    position: absolute; right: 20px; 
    display: flex; flex-direction: column; gap: 30px; z-index: 10; align-items: center; 
    pointer-events: auto;
}
.player-action-btn { font-size: 24px; cursor: pointer; filter: drop-shadow(0 2px 4px #000); }

#player-close { position: absolute; top: 40px; left: 20px; font-size: 24px; cursor: pointer; z-index: 10; width: 40px; height: 40px; background: rgba(255,255,255,0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(5px); }


/* --- PLAYER (Kohta 12, 14 & 15) --- */
#view-player { z-index: 2000; background: #000; display: none; flex-direction: column; }
#player-bg { position: absolute; width: 100%; height: 100%; opacity: 0.4; background-size: cover; background-position: center; filter: blur(30px); transform: scale(1.1); }
#player-content { position: relative; z-index: 2; flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 20px; }

#audio-visualizer { 
    width: 200px; height: 200px; border-radius: 50%; 
    background: #111; border: 3px solid #ffcc1ade; 
    display: flex; align-items: center; justify-content: center; margin-bottom: 40px; 
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
    transition: 0.41s ease-out; position: relative;
}
#audio-visualizer.playing { animation: pulseBeat 0.6s infinite alternate cubic-bezier(0.4, 0, 0.2, 1); border-color: #00ff88; }
@keyframes pulseBeat { from { transform: scale(1); box-shadow: 0 0 20px rgba(0,255,136,0.2); } to { transform: scale(1.05); box-shadow: 0 0 50px rgba(0,255,136,0.6); } }

.player-info { text-align: center; margin-bottom: 30px; }

/* Selauspainikkeet emojivapaana (Kohta 15) */
.player-controls { display: flex; gap: 30px; align-items: center; }
.ctrl-btn { 
    font-size: 35px; cursor: pointer; color: #fff; transition: opacity 0.2s;
    font-family: "Segoe UI Symbol", "Symbola", sans-serif;
    font-variant-emoji: text;
}
.ctrl-btn:active { transform: scale(0.9); }


.reply-bar {
    position: absolute; bottom: 0; width: 100%; min-height: 100px;
    background: black; backdrop-filter: blur(20px); border-top: 1px solid #333;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    padding: 15px; padding-bottom: calc(15px + env(safe-area-inset-bottom));
    z-index: 99;
}
.mini-btn { font-size: 14px; background: #333; padding: 8px 16px; border-radius: 20px; cursor: pointer; font-weight: 600; color:#fff; border:1px solid #444; }

/* --- CREATOR & RECORDING UI (Kohta 10 & 16) --- */
#creator-ui { 
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #000; z-index: 3000; 
    display: none; flex-direction: column; 
}
#preview-container { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; background: #111; overflow: hidden; }
#preview-img { width: 100%; height: 100%; object-fit: cover;}

.creator-controls { min-height: 220px; background: #000; border-top: 1px solid #222; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; padding: 20px; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }

/* Uusi äänitysliittymä visualisoinnilla */
#recording-ui {
    width: 100%; text-align: center; display: none; margin-bottom: 10px;
}
#visualizer-canvas {
    width: 100%; height: 40px; background: rgba(255,255,255,0.05); border-radius: 8px; margin-top: 10px;
}
.recording-text { color: #ff3b30; font-weight: bold; font-size: 14px; margin-bottom: 5px; }
.recording-timer { font-size: 12px; color: #888; margin-top: 5px; }

#record-btn { width: 80px; height: 80px; border-radius: 50%; border: 4px solid #fff; background: transparent; display: flex; align-items: center; justify-content: center; font-size: 30px; cursor: pointer; transition: all 0.2s; }
#record-btn.recording { background: #ff3b30; border-color: #ff3b30; transform: scale(1.1); }
#creator-text-input { 
    position: absolute; 
    top: 0%; /* Säädetty hieman alemmas, jotta ei karkaa yläreunasta */
    left: 50%; 
    transform: translateX(-50%); /* Vain vaakasuora keskitys, top hoitaa pystyn */
    
    background: transparent; 
    border: none; 
    color: #fff; 
    font-size: 2.5rem; /* Hieman pienempi, jotta useat rivit mahtuvat paremmin */
    font-weight: 900; 
    text-align: center; 
    width: 90%; 
    height: 100%; /* Pakotettu korkeus, jotta se ei ole nollan kokoinen */
    
    display: none; 
    z-index: 20; 
    text-shadow: 0 2px 4px #000;
    
    resize: none; 
    outline: none;
    overflow: hidden;
    padding: 20px;
    line-height: 1.2;
}

.toggle-private { display:flex; align-items:center; gap:8px; font-size:12px; color:#888; border:1px solid #333; padding:5px 10px; border-radius:20px; margin-top:5px; cursor:pointer;}
.toggle-private.active { color:#0f0; border-color:#0f0; background:rgba(0,255,0,0.1); }

/* --- PROFILE & SETTINGS (Kohta 8 & 13) --- */
.profile-tabs { display: flex; margin-bottom: 20px; gap:10px; overflow-x:auto; }
.tab-btn { flex:0 0 auto; padding: 10px 15px; background: #222; text-align: center; border-radius: 8px; font-size: 13px; cursor: pointer; color: #888; }
.tab-btn.active { background: #fff; color: #000; font-weight: bold; }

.settings-btn { width: 100%; padding: 15px; text-align: left; background: #1a1a1a; border: none; border-bottom: 1px solid #222; color: #fff; font-size: 16px; cursor: pointer; display: flex; justify-content: space-between; }
.settings-btn:first-child { border-top-left-radius: 12px; border-top-right-radius: 12px; }
.settings-btn:last-child { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; border-bottom: none; }
.btn-danger { color: #ff3b30; }

#my-pfp-container { position:relative; display:inline-block; }
#my-pfp-edit { position:absolute; bottom:0; right:0; background:#fff; color:#000; border-radius:50%; width:24px; height:24px; font-size:14px; display:flex; align-items:center; justify-content:center; border:2px solid #000; }

/* Kohta 13: Piilotettujen vastausten listan tyyli */
#list-hidden-comments { border-top: 1px solid #222; padding: 5px 0; }
.hidden-comment-item {
    display: flex; align-items: center; gap: 10px; background: #080808; padding: 10px; border-bottom: 1px solid #111;
}

/* --- ONBOARDING --- */
#onboarding-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
    z-index: 500; display: none; flex-direction: column;
    justify-content: center; align-items: center; pointer-events: none;
}
.onboarding-hint {
    display: flex; flex-direction: column; align-items: center;
    position: absolute; gap: 5px; animation: bounce 2s infinite;
}
.onboarding-hint span { font-size: 32px; }
.onboarding-hint p { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }

.hint-up { top: 15%; }
.hint-down { bottom: 25%; }
.hint-left { left: 5%; top: 45%; }
.hint-right { right: 5%; top: 45%; }

#close-onboarding {
    pointer-events: auto; background: #fff; color: #000;
    padding: 12px 24px; border-radius: 30px; font-weight: 900;
    position: absolute; bottom: 120px; cursor: pointer;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.2); opacity: 1; }
}

/* Profiilinäkymän lisäykset */
#view-user-profile { background: #000; z-index: 1000; }
.profile-header { padding: 40px 20px; text-align: center; border-bottom: 1px solid #222; }
.profile-tabs-scroll { display: flex; overflow-x: auto; padding: 10px; gap: 10px; border-bottom: 1px solid #111; }
.tab-btn-profile { white-space: nowrap; padding: 8px 16px; border-radius: 20px; background: #111; color: #666; font-weight: bold; cursor: pointer; }
.tab-btn-profile.active { background: #fff; color: #000; }
.grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px; }
.grid-item { aspect-ratio: 1/1; background: #111; background-size: cover; background-position: center; cursor: pointer; }
.defame-btn { color: #ff3b30; font-weight: bold; font-size: 12px; border: 1px solid #ff3b30; padding: 4px 8px; border-radius: 4px; background:transparent; }

.profile-actions button {
    transition: all 0.2s;
    font-size: 13px;
    font-weight: 600;
}

.profile-actions button:active {
    transform: scale(0.95);
}

/* Varmistetaan että user-pill tuntuu klikattavalta */
.user-pill {
    cursor: pointer;
    transition: transform 0.2s;
}
.user-pill:active {
    transform: scale(0.95);
}

.player-starter-style {
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: center !important;
    position: absolute;
    bottom: 120px; /* Sopivasti alareunan yläpuolelle */
    left: 20px;
    text-align: left !important;
    background: rgba(0,0,0,0.4);
    padding: 10px 20px;
    border-radius: 50px;
    backdrop-filter: blur(5px);
}

.player-starter-style img {
    width: 60px !important;
    height: 60px !important;
    margin-bottom: 0 !important;
    margin-right: 15px;
    border: 2px solid white;
}

/* Lisää nämä tyyleihin */
#player-content {
    transition: all 0.4s ease; /* Pehmeä siirtymä tyylien välillä */
}

/* Tyyli, kun näytetään ketjun aloittaja */
.player-starter-active #player-content {
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: center !important;
    position: absolute;
    bottom: 140px;
    left: 20px;
    width: auto;
    padding: 10px 20px;
    border-radius: 50px;
    background: #0000002e;
    backdrop-filter: blur(7px);
}

.player-starter-active #audio-visualizer {
    margin: 0 !important;
    width: 60px !important;
    height: 60px !important;
}

.player-starter-active #player-avatar {
    width: 60px !important;
    height: 60px !important;
    border: 2px solid white !important;
}

.player-starter-active .player-info {
    text-align: left !important;
    margin-left: 15px;
}

.player-starter-active #player-actions {
    display: block !important;
    font-size: 12px;
    color: #ccc;
    margin-top: 2px;
}

/* Säädetään käyttäjänimen kokoa pillerissä, jotta status mahtuu alle */
.player-starter-active #player-user {
    font-size: 16px;
    display: block;
}

/* Varmistetaan, että ikonit näkyvät selkeästi taustaa vasten */
.btn-interact, #btn-delete-own {
    font-size: 28px;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.8));
    cursor: pointer;
}

/* Piilotetaan pillerin sisäiset säädöt, jotta ne eivät sotke pystyasettelua */
.player-starter-active #player-actions {
    display: flex !important; /* Pidetään näkyvissä myös aloittajalla */
}

div#profile-grid .grid-item {
    border-radius: 12px;
}

#creator-text-input::placeholder {
    color: white;
    opacity: 0.8;
}

.user-avatar, #player-avatar {
    cursor: pointer;
    transition: transform 0.1s active;
}

.user-avatar:active, #player-avatar:active {
    transform: scale(0.95);
    opacity: 0.8;
}

.profile-skeleton {
    padding: 20px;
    text-align: center;
}
.skeleton-avatar {
    width: 100px; height: 100px;
    background: #222;
    border-radius: 50%;
    margin: 0 auto 10px;
    animation: skeleton-pulse 1.5s infinite;
}
.skeleton-text {
    width: 150px; height: 20px;
    background: #222;
    margin: 0 auto 20px;
    animation: skeleton-pulse 1.5s infinite;
}
@keyframes skeleton-pulse {
    0% { opacity: 0.3; }
    50% { opacity: 0.6; }
    100% { opacity: 0.3; }
}

/* Piilotetaan hollow text oletuksena */
#player-hollow-text {
    display: none;
}

/* Näytetään se vain silloin, kun soitin on "aloittaja"-tilassa (ei sumennusta) */
.player-starter-active #player-hollow-text {
    display: block;
}

reply-visualizer {
    position: absolute;
    bottom: 0;
    background: transparent !important;
    z-index: 1;
}

#reply-confirm .mini-btn {
    z-index: 9;
}

















@media all and (min-width:0px)  {
    
    
#btn-new {
    padding-bottom: 7px;
}
    
    
}