@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');
:root {
  --bg: #0b0b0f; --surf: #14141c; --surf-sec: #1e1e28;
  --primary: #1DB954; --primary-hov: #1ed760;
  --danger: #e91429; --danger-hov: #ff2b41;
  --text: #ffffff; --text-sec: #a0a0b0;
  --border: rgba(255, 255, 255, 0.08); --shadow: rgba(0, 0, 0, 0.6);
  --success: #1db954; --warning: #ffa429;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background-color: var(--bg); color: var(--text); font-family: 'Inter', sans-serif;
  min-height: 100vh; display: flex; justify-content: center; align-items: center;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
.app-container {
  width: 100%; max-width: 480px; min-height: 100vh; display: flex; flex-direction: column; padding: 1.5rem; background-color: var(--bg);
}
@media (min-width: 500px) {
  body { background: radial-gradient(circle at 50% 50%, #1c1c28 0%, #0b0b0f 100%); }
  .app-container {
    min-height: 820px; height: 90vh; border-radius: 24px; background-color: var(--surf);
    border: 1px solid var(--border); box-shadow: 0 20px 50px var(--shadow); margin: 2rem 0; overflow-y: auto;
  }
}

.app-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 1.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; }
.app-header h1 {
  font-size: 1.4rem; font-weight: 800; background: linear-gradient(135deg, #fff 0%, var(--text-sec) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; display: flex; align-items: center; gap: 0.5rem;
}
.btn {
  font-size: 0.95rem; font-weight: 700; padding: 0.8rem 1.5rem; border-radius: 50px; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; transition: all 0.2s ease; width: 100%;
}
.btn-primary { background-color: var(--primary); color: #000; }
.btn-primary:hover { background-color: var(--primary-hov); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(29,185,84,0.3); }
.btn-secondary { background-color: var(--surf-sec); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); border-color: var(--text-sec); }
.btn-outline { background-color: transparent; border: 1px solid var(--border); color: var(--text-sec); padding: 0.5rem 1rem; font-size: 0.8rem; width: auto; }
.btn-outline:hover { color: var(--text); border-color: var(--text-sec); background: rgba(255,255,255,0.05); }
.btn-danger { background-color: var(--danger); color: white; }
.btn-danger:hover { background-color: var(--danger-hov); transform: translateY(-2px); box-shadow: 0 8px 25px rgba(233,20,41,0.4); }
.btn-huge { font-size: 1.25rem; padding: 1.4rem 2rem; border-radius: 16px; text-transform: uppercase; letter-spacing: 1px; }

.card { background-color: var(--surf-sec); border: 1px solid var(--border); border-radius: 16px; padding: 1.25rem; margin-bottom: 1.25rem; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
.card-login { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 2.5rem 1.25rem; margin-top: 1.5rem; }
.logo-icon { font-size: 4rem; margin-bottom: 1.25rem; animation: float 4s ease-in-out infinite; }
@keyframes float { 0%,100% {transform:translateY(0);} 50% {transform:translateY(-8px);} }
.card-login h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 0.6rem; }
.card-login p { color: var(--text-sec); font-size: 0.9rem; line-height: 1.5; margin-bottom: 1.25rem; }
.info-box { background: rgba(255,164,41,0.08); border-left: 3px solid var(--warning); padding: 0.9rem; border-radius: 8px; text-align: left; font-size: 0.8rem; line-height: 1.5; margin-bottom: 1.5rem; color: #ffb752; }

.player-status-card { background: rgba(255,255,255,0.02); border: 1px solid var(--border); border-radius: 12px; padding: 0.7rem 1rem; margin-bottom: 1.25rem; }
.status-indicator { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; font-weight: 600; color: var(--text-sec); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; box-shadow: 0 0 6px currentColor; }
.dot.online { background-color: var(--success); color: var(--success); }
.dot.offline { background-color: var(--text-sec); color: transparent; box-shadow: none; }
.dot.error { background-color: var(--danger); color: var(--danger); }

.scanner-card { text-align: center; }
.scanner-card h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.2rem; }
.subtitle { color: var(--text-sec); font-size: 0.8rem; margin-bottom: 1.25rem; }
.status-subtext { font-size: 0.75rem; color: var(--text-sec); margin-top: 0.8rem; }

.scanner-wrapper { position: relative; width: 100%; max-width: 260px; aspect-ratio: 1; margin: 0 auto; border-radius: 16px; overflow: hidden; border: 2px solid var(--border); box-shadow: 0 0 15px rgba(0,0,0,0.4); }
.scanner-wrapper.active { border-color: var(--primary); box-shadow: 0 0 20px rgba(29,185,84,0.2); }
#reader { width: 100% !important; height: 100% !important; background: #000; }
#reader video { object-fit: cover !important; }
.scanner-overlay { position: absolute; top:0; left:0; right:0; bottom:0; pointer-events: none; }
.laser-line { position: absolute; top:0; left:0; width: 100%; height: 3px; background: linear-gradient(90deg, rgba(29,185,84,0) 0%, rgba(29,185,84,1) 50%, rgba(29,185,84,0) 100%); box-shadow: 0 0 8px var(--primary); animation: scan 2.5s linear infinite; opacity: 0; }
.scanner-wrapper.active .laser-line { opacity: 1; }
@keyframes scan { 0% {top:0%;} 50% {top:100%;} 100% {top:0%;} }

.manual-card h4 { font-size: 1rem; font-weight: 700; }
.manual-input-row { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.manual-input-row input { flex-grow: 1; background: var(--surf); border: 1px solid var(--border); border-radius: 50px; padding: 0.7rem 1.1rem; color: var(--text); font-size: 0.85rem; outline: none; transition: all 0.2s; }
.manual-input-row input:focus { border-color: var(--primary); box-shadow: 0 0 8px rgba(29,185,84,0.15); }
.manual-input-row .btn { width: auto; white-space: nowrap; }

.playback-card { text-align: center; padding: 2.5rem 1.25rem; display: flex; flex-direction: column; align-items: center; }
.playback-card h3 { font-size: 1.3rem; font-weight: 800; margin-bottom: 0.4rem; }
.visualizer-container { position: relative; width: 180px; height: 180px; margin: 2.5rem 0; display: flex; justify-content: center; align-items: center; }
.pulse-ring { position: absolute; width: 100%; height: 100%; border-radius: 50%; border: 1px solid rgba(233,20,41,0.25); animation: pulse-out 3s ease-out infinite; opacity: 0; }
.pulse-ring.delay-1 { animation-delay: 1s; }
.pulse-ring.delay-2 { animation-delay: 2s; }
@keyframes pulse-out { 0% {transform: scale(0.6); opacity: 1;} 100% {transform: scale(1.4); opacity: 0;} }

.sound-wave { display: flex; align-items: flex-end; justify-content: center; gap: 5px; height: 60px; z-index: 10; }
.sound-wave .bar { width: 5px; height: 12px; background: linear-gradient(180deg, var(--danger) 0%, #ff5c6a 100%); border-radius: 3px; animation: equalize 1.2s ease-in-out infinite alternate; }
.sound-wave .bar:nth-child(1) { height: 30px; animation-delay: -0.4s; }
.sound-wave .bar:nth-child(2) { height: 12px; animation-delay: -0.2s; }
.sound-wave .bar:nth-child(3) { height: 50px; animation-delay: -0.7s; }
.sound-wave .bar:nth-child(4) { height: 22px; animation-delay: -0.1s; }
.sound-wave .bar:nth-child(5) { height: 40px; animation-delay: -0.5s; }
.sound-wave .bar:nth-child(6) { height: 18px; animation-delay: -0.3s; }
.sound-wave .bar:nth-child(7) { height: 30px; animation-delay: -0.6s; }
@keyframes equalize { 0% {height: 10px;} 100% {height: 60px;} }

.alert-container { display: flex; align-items: center; justify-content: space-between; background: rgba(233,20,41,0.08); border: 1px solid rgba(233,20,41,0.2); border-radius: 12px; padding: 0.8rem 1rem; margin-bottom: 1.25rem; }
.alert { font-size: 0.8rem; line-height: 1.4; color: #ff6b7a; text-align: left; }
.alert-close { background: none; border: none; color: var(--text-sec); font-size: 1rem; cursor: pointer; padding: 0 0.2rem; }
.alert-close:hover { color: var(--text); }

.hidden { display: none !important; }
.app-footer { margin-top: auto; text-align: center; padding-top: 1.5rem; }
.app-footer p { font-size: 0.7rem; color: var(--text-sec); }

.loading-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(11,11,15,0.9); display: flex; justify-content: center; align-items: center; z-index: 2000; backdrop-filter: blur(5px); animation: fadeIn 0.2s ease; }
.spinner-container { display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; }
.spinner { width: 44px; height: 44px; border: 4px solid rgba(29,185,84,0.1); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite; }
@keyframes spin { to {transform: rotate(360deg);} }
@keyframes fadeIn { from {opacity: 0;} to {opacity: 1;} }
