/* ================= Sessiz Sınıf – Gürültü Ölçer ================= */
:root {
  --calm: #34d399;
  --alert: #fbbf24;
  --loud: #f87171;
  --ink: #0f172a;
  --card: rgba(255, 255, 255, 0.96);
  --glass: rgba(255, 255, 255, 0.10);
  --glass-b: rgba(255, 255, 255, 0.22);
  --state: var(--calm);
}
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  color: #fff;
  user-select: none;
  background: #0b1437;
  transition: background 0.8s ease;
}
body.state-alert { --state: var(--alert); }
body.state-loud { --state: var(--loud); }

/* ---------- Gökyüzü ---------- */
.ss-sky {
  position: fixed; inset: 0; z-index: 0;
  background: radial-gradient(ellipse at 50% 120%, #312e81 0%, #1e1b4b 40%, #0b1437 75%);
  transition: filter 0.6s ease;
}
body.state-alert .ss-sky { filter: hue-rotate(-25deg) saturate(1.2); }
body.state-loud .ss-sky { filter: hue-rotate(-70deg) saturate(1.5) brightness(1.15); }
.ss-stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(2px 2px at 10% 20%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 30% 70%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 55% 15%, #fde68a 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 80% 40%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 90% 80%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 20% 90%, #c7d2fe 50%, transparent 51%),
    radial-gradient(2px 2px at 65% 60%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 42% 38%, #fff 50%, transparent 51%);
  background-size: 420px 420px;
  animation: twinkle 4s ease-in-out infinite alternate;
}
.ss-moon {
  position: absolute; top: 9%; right: 7%;
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fefce8, #fde68a 60%, #facc15);
  box-shadow: 0 0 60px 20px rgba(253, 230, 138, 0.25);
}
.ss-moon::after {
  content: ''; position: absolute; width: 90px; height: 90px; border-radius: 50%;
  top: -12px; left: 32px; background: #1e1b4b; opacity: 0.85;
}

/* ---------- Yerleşim ---------- */
.ss-app { position: relative; z-index: 1; height: 100vh; display: flex; flex-direction: column; }
.ss-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px;
  background: var(--glass); border-bottom: 1px solid var(--glass-b);
  backdrop-filter: blur(10px);
}
.ss-bar-right { display: flex; align-items: center; gap: 8px; }
.ss-timer {
  font-family: 'Fredoka', sans-serif; font-weight: 700;
  font-size: clamp(1.4rem, 3vw, 2.2rem); letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
}
.ss-timer.ending { color: var(--alert); animation: pulse 1s infinite; }
.ss-mic { font-weight: 800; font-size: 0.95rem; padding: 6px 12px; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-b); }

.ss-main {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 140px 1fr 220px; gap: 24px;
  padding: 20px 28px; align-items: center;
}
.ss-foot { display: flex; justify-content: center; gap: 12px; padding: 0 20px 18px; flex-wrap: wrap; }

/* ---------- Düğmeler ---------- */
.ss-btn {
  font-family: inherit; font-weight: 800; font-size: 1.05rem;
  padding: 11px 18px; border-radius: 14px; border: none; cursor: pointer;
  color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  transition: transform 0.1s, background 0.2s;
}
.ss-btn:active { transform: scale(0.95); }
.ss-btn-ghost { background: var(--glass); border: 1px solid var(--glass-b); }
.ss-btn-ghost:hover { background: rgba(255, 255, 255, 0.2); }
.ss-btn-go { background: linear-gradient(135deg, #34d399, #059669); box-shadow: 0 8px 20px rgba(5, 150, 105, 0.4); font-size: 1.2rem; padding: 14px 26px; }
.ss-btn-warn { background: linear-gradient(135deg, #fb923c, #ea580c); box-shadow: 0 6px 16px rgba(234, 88, 12, 0.35); }

/* ---------- Gürültü ölçer ---------- */
.ss-meter-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; height: 100%; max-height: 520px; }
.ss-meter-label { font-weight: 900; text-transform: uppercase; letter-spacing: 2px; opacity: 0.8; }
.ss-meter {
  position: relative; flex: 1; width: 62px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.1); border: 2px solid var(--glass-b); overflow: hidden;
}
.ss-meter-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 0%;
  background: linear-gradient(to top, #34d399 0%, #a3e635 45%, #fbbf24 70%, #f87171 100%);
  background-size: 100% var(--meter-h, 400px); background-position: bottom;
  border-radius: 999px; transition: height 0.12s linear;
}
.ss-meter-limit {
  position: absolute; left: -2px; right: -2px; height: 4px; background: #fff;
  box-shadow: 0 0 10px #fff; bottom: 60%;
}
.ss-meter-limit span {
  position: absolute; left: 50%; transform: translate(-50%, -120%);
  font-size: 0.7rem; font-weight: 900; text-transform: uppercase; opacity: 0.85;
}
.ss-meter-emo { font-size: 2.6rem; transition: transform 0.2s; }

/* ---------- Karakter sahnesi ---------- */
.ss-stage { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; }
.ss-char-wrap {
  position: relative; cursor: pointer;
  width: min(42vh, 380px); aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, rgba(255,255,255,0.18), rgba(255,255,255,0.03) 70%);
  border: 3px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 0 var(--state), inset 0 0 60px rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: center;
  transition: box-shadow 0.4s, border-color 0.4s;
}
body.state-calm .ss-char-wrap { animation: breathe 4s ease-in-out infinite; }
body.state-alert .ss-char-wrap { border-color: var(--alert); box-shadow: 0 0 50px 6px rgba(251, 191, 36, 0.45); }
body.state-loud .ss-char-wrap { border-color: var(--loud); box-shadow: 0 0 70px 14px rgba(248, 113, 113, 0.6); animation: shake 0.45s ease-in-out 3; }
.ss-char { font-size: min(24vh, 210px); line-height: 1; filter: drop-shadow(0 12px 20px rgba(0,0,0,0.35)); transition: transform 0.3s; }
body.state-calm .ss-char { transform: rotate(-8deg) translateY(6%); }
body.state-loud .ss-char { transform: scale(1.1); }
.ss-face {
  position: absolute; right: 8%; bottom: 10%;
  font-size: min(9vh, 80px); background: #fff; border-radius: 50%;
  width: 1.35em; height: 1.35em; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}
.ss-face span, .ss-face { line-height: 1; }
.ss-blanket {
  position: absolute; left: 12%; right: 12%; bottom: 8%; height: 22%;
  border-radius: 40% 40% 30% 30%;
  background: repeating-linear-gradient(45deg, #818cf8 0 14px, #6366f1 14px 28px);
  opacity: 0.9; transition: transform 0.4s, opacity 0.4s;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.2);
}
body.state-loud .ss-blanket { transform: translateY(40%) rotate(8deg); opacity: 0.5; }

.ss-zzz { position: absolute; top: 6%; right: 14%; font-family: 'Fredoka', sans-serif; font-weight: 700; color: #c7d2fe; pointer-events: none; }
.ss-zzz span { position: absolute; opacity: 0; animation: zfloat 3s ease-in infinite; }
.ss-zzz span:nth-child(1) { font-size: 2rem; animation-delay: 0s; }
.ss-zzz span:nth-child(2) { font-size: 1.6rem; animation-delay: 1s; }
.ss-zzz span:nth-child(3) { font-size: 1.2rem; animation-delay: 2s; }
body:not(.state-calm) .ss-zzz { display: none; }

.ss-status {
  font-family: 'Fredoka', sans-serif; font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 3rem); margin: 22px 0 6px;
  text-shadow: 0 4px 18px rgba(0,0,0,0.35);
}
.ss-sub { margin: 0 0 16px; font-size: clamp(1rem, 1.8vw, 1.35rem); opacity: 0.85; font-weight: 700; }
.ss-next { width: min(520px, 90%); display: flex; flex-direction: column; gap: 6px; font-weight: 800; opacity: 0.95; }
.ss-next-bar { height: 16px; border-radius: 999px; background: rgba(255,255,255,0.12); border: 1px solid var(--glass-b); overflow: hidden; }
.ss-next-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #fde68a, #facc15); border-radius: 999px; transition: width 0.25s linear; box-shadow: 0 0 12px rgba(250, 204, 21, 0.6); }

/* ---------- Yıldız kavanozu ---------- */
.ss-jar-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ss-jar-title { font-weight: 900; text-transform: uppercase; letter-spacing: 2px; opacity: 0.8; }
.ss-jar {
  width: 180px; min-height: 260px; padding: 16px 12px;
  border-radius: 26px 26px 40px 40px;
  background: linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.05));
  border: 3px solid rgba(255,255,255,0.35);
  border-top: 10px solid rgba(255,255,255,0.45);
  display: flex; flex-wrap: wrap-reverse; align-content: flex-start; justify-content: center; gap: 4px;
  box-shadow: inset 0 0 30px rgba(255,255,255,0.08);
}
.ss-jar .st { font-size: 1.9rem; line-height: 1; filter: drop-shadow(0 0 6px rgba(250, 204, 21, 0.7)); animation: dropIn 0.6s cubic-bezier(.3,1.6,.5,1); }
.ss-jar .st.empty { opacity: 0.18; filter: grayscale(1); animation: none; }
.ss-jar-count { font-family: 'Fredoka', sans-serif; font-size: 2rem; font-weight: 700; }
.ss-jar-count strong { color: #fde68a; }
.ss-warn { font-weight: 800; opacity: 0.85; }
.ss-warn strong { color: var(--loud); }

/* ---------- Katmanlar ---------- */
.ss-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(8, 12, 40, 0.72); backdrop-filter: blur(6px);
}
.ss-card {
  background: var(--card); color: var(--ink);
  border-radius: 28px; padding: 34px; width: 100%; max-width: 560px; text-align: center;
  box-shadow: 0 30px 60px -15px rgba(0,0,0,0.5); animation: popIn 0.35s ease;
  max-height: 92vh; overflow: auto;
}
.ss-card-wide { max-width: 680px; text-align: left; }
.ss-card h2 { font-family: 'Fredoka', sans-serif; font-size: 2rem; margin: 6px 0 10px; }
.ss-card p { font-size: 1.1rem; line-height: 1.55; color: #334155; margin: 0 0 16px; }
.ss-card-emoji { font-size: 4rem; }
.ss-card-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.ss-card .ss-btn-ghost { color: #1e293b; background: #f1f5f9; border: 2px solid #cbd5e1; }
.ss-hint { font-size: 0.9rem !important; color: #64748b !important; margin-top: 16px !important; }
kbd { background: #e2e8f0; border-radius: 6px; padding: 1px 7px; font-family: inherit; font-weight: 800; border-bottom: 2px solid #94a3b8; }
.ss-mic-info { font-size: 0.95rem; font-weight: 700; border-radius: 14px; padding: 0; margin-bottom: 12px; text-align: left; }
.ss-mic-info.warn { padding: 12px 14px; background: #fff7ed; color: #9a3412; border: 2px solid #fdba74; }
.ss-mic-info.ok { padding: 10px 14px; background: #ecfdf5; color: #065f46; border: 2px solid #6ee7b7; }

.ss-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; margin: 10px 0 18px; }
.ss-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 800; color: #1e293b; }
.ss-form label:first-child { grid-column: 1 / -1; }
.ss-form small { font-weight: 600; color: #64748b; }
.ss-form select { font-family: inherit; font-size: 1rem; font-weight: 700; padding: 10px 12px; border-radius: 12px; border: 2px solid #cbd5e1; background: #fff; }
.ss-form input[type=range] { width: 100%; accent-color: #059669; height: 28px; }
.ss-check { flex-direction: row !important; align-items: center; gap: 10px !important; }
.ss-check input { width: 22px; height: 22px; accent-color: #059669; }
.ss-chars { display: flex; gap: 10px; flex-wrap: wrap; }
.ss-chars button {
  font-size: 2.4rem; width: 70px; height: 70px; border-radius: 18px;
  border: 3px solid #e2e8f0; background: #f8fafc; cursor: pointer; transition: all 0.15s;
}
.ss-chars button.active { border-color: #059669; background: #ecfdf5; transform: translateY(-3px); box-shadow: 0 8px 16px rgba(5,150,105,0.25); }

.ss-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.ss-fly-star {
  position: fixed; z-index: 9999; font-size: 2.8rem; pointer-events: none;
  filter: drop-shadow(0 0 16px rgba(250, 204, 21, 0.95));
  transition: left 0.5s cubic-bezier(0.25, 0.9, 0.25, 1),
              top 0.5s cubic-bezier(0.2, 0.8, 0.3, 1),
              transform 0.5s ease-out,
              opacity 0.5s ease-out;
}

/* Sayı patlama / büyüme efekti */
.ss-jar-count strong { display: inline-block; transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s; }
.ss-jar-count strong.pop { transform: scale(1.45); color: #fff !important; text-shadow: 0 0 20px #facc15; }

/* Buton parıldama efekti */
.ss-btn-bonus-active { transform: scale(0.92) !important; background: rgba(255, 255, 255, 0.35) !important; }

/* ---------- Animasyonlar ---------- */
@keyframes twinkle { from { opacity: 0.55; } to { opacity: 1; } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
@keyframes shake { 0%, 100% { transform: translateX(0) rotate(0); } 20% { transform: translateX(-14px) rotate(-3deg); } 40% { transform: translateX(14px) rotate(3deg); } 60% { transform: translateX(-10px) rotate(-2deg); } 80% { transform: translateX(10px) rotate(2deg); } }
@keyframes zfloat { 0% { opacity: 0; transform: translate(0, 0) scale(0.6); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(40px, -90px) scale(1.3); } }
@keyframes dropIn { 0% { transform: translateY(-40px) scale(0.3); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes popIn { 0% { transform: scale(0.85); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ---------- Duyarlı ---------- */
@media (max-width: 900px) {
  .ss-main { grid-template-columns: 80px 1fr; grid-template-rows: 1fr auto; gap: 14px; padding: 14px; }
  .ss-jar-wrap { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .ss-jar { width: auto; min-height: 0; max-width: 100%; }
  .ss-meter { width: 44px; }
  .ss-moon { width: 70px; height: 70px; }
  .ss-moon::after { width: 58px; height: 58px; left: 20px; }
  .ss-form { grid-template-columns: 1fr; }
  .ss-mic { display: none; }
}
@media (max-height: 620px) {
  .ss-char-wrap { width: min(34vh, 300px); }
  .ss-status { margin-top: 10px; }
}
