@font-face{
  font-family:'Inter'; font-style:normal; font-weight:400; font-display:swap;
  src: url('fonts/inter-latin-400-normal.woff2') format('woff2');
}
@font-face{
  font-family:'Inter'; font-style:normal; font-weight:500; font-display:swap;
  src: url('fonts/inter-latin-500-normal.woff2') format('woff2');
}
@font-face{
  font-family:'Inter'; font-style:normal; font-weight:600; font-display:swap;
  src: url('fonts/inter-latin-600-normal.woff2') format('woff2');
}
@font-face{
  font-family:'Baloo 2'; font-style:normal; font-weight:600; font-display:swap;
  src: url('fonts/baloo-2-latin-600-normal.woff2') format('woff2');
}
@font-face{
  font-family:'Baloo 2'; font-style:normal; font-weight:700; font-display:swap;
  src: url('fonts/baloo-2-latin-700-normal.woff2') format('woff2');
}
@font-face{
  font-family:'Baloo 2'; font-style:normal; font-weight:800; font-display:swap;
  src: url('fonts/baloo-2-latin-800-normal.woff2') format('woff2');
}

:root{
  --bg-canvas:#14171f;
  --bg-panel:#1d212c;
  --text-primary:#f5f6fa;
  --text-muted:#8a90a3;
  --accent-ready:#4ce0d2;
  --accent-record:#ff5c5c;
  --border-empty:#2e3340;
}
*{
  box-sizing:border-box;
  -webkit-tap-highlight-color: transparent;
  user-select:none;
  -webkit-user-select:none;
  -moz-user-select:none;
  -ms-user-select:none;
  -webkit-touch-callout:none;
  -webkit-user-drag:none;
}
html,body{
  margin:0; padding:0; height:100%;
  background:var(--bg-canvas);
  color:var(--text-primary);
  font-family:'Inter', system-ui, sans-serif;
  overflow:hidden;
  touch-action:none;
  overscroll-behavior:none;
}
.app{
  display:flex; flex-direction:column;
  height:100vh; height:100dvh;
  padding: max(14px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom));
}
header{
  display:flex; align-items:center; justify-content:space-between;
  padding: 4px 4px 14px;
}
.brand{ display:flex; align-items:baseline; gap:10px; }
.brand h1{
  font-family:'Baloo 2', sans-serif;
  font-weight:800;
  font-size:22px;
  margin:0;
  letter-spacing:0.2px;
}
.brand .status{
  font-size:12px;
  color:var(--text-muted);
  font-weight:500;
}
.reset-btn{
  position:relative;
  appearance:none; border:none; cursor:pointer;
  width:52px; height:52px;
  border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  background: linear-gradient(180deg, #2a2f3d, #1c2027);
  box-shadow:
    0 4px 0 rgba(0,0,0,0.4),
    0 6px 10px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.18);
  transition: transform .08s ease, box-shadow .08s ease;
  flex-shrink:0;
  overflow:hidden;
}
.reset-btn svg{
  position:relative;
  z-index:1;
  width:22px; height:22px;
  fill: var(--text-muted);
  pointer-events:none;
  transition: fill .3s ease;
}
.reset-btn::after{
  content:"";
  position:absolute; inset:0;
  border-radius:50%;
  background: radial-gradient(circle, var(--accent-record) 0%, var(--accent-record) 100%);
  transform: scale(0);
  transform-origin:center;
}
.reset-btn.holding::after{
  transform: scale(1);
  transition: transform 0.65s linear;
}
.reset-btn.holding svg{ fill:#2a0a0a; }
.reset-btn:active{
  transform: translateY(3px) scale(0.95);
  box-shadow:
    0 1px 0 rgba(0,0,0,0.4),
    inset 0 3px 6px rgba(0,0,0,0.5);
}

.hint-bar{
  display:flex; align-items:center; justify-content:center;
  gap:14px; flex-wrap:wrap;
  padding: 8px 4px 0;
  font-size:12px;
  color:var(--text-muted);
}
.hint-bar b{ color:var(--text-primary); font-weight:600; }

.install-link{
  display:inline-flex; align-items:center; gap:5px;
  cursor:pointer;
  color:var(--accent-ready);
  padding:4px 10px;
  border-radius:10px;
  background:rgba(76,224,210,0.12);
}
.install-link svg{
  width:14px; height:14px;
  fill: var(--accent-ready);
}
.install-link b{ color:var(--accent-ready); font-weight:600; }
.install-link:active{ background:rgba(76,224,210,0.25); }

.install-steps{
  display:flex; flex-direction:column; gap:14px;
  text-align:left;
  max-width:320px;
  margin:4px 0;
}
.install-step{
  display:flex; align-items:flex-start; gap:12px;
  font-size:14px;
  color:var(--text-primary);
  line-height:1.4;
}
.install-step .num{
  flex-shrink:0;
  width:24px; height:24px;
  border-radius:50%;
  background:var(--accent-ready);
  color:#0a1f1c;
  font-weight:700;
  font-size:13px;
  display:flex; align-items:center; justify-content:center;
}
.install-step svg{
  flex-shrink:0;
  width:20px; height:20px;
  fill: var(--accent-ready);
  margin-top:1px;
}

.copyright{
  text-align:center;
  padding-top:10px;
  font-size:11px;
}
.copyright a{
  color:var(--text-muted);
  text-decoration:none;
}
.copyright a:active{ color:var(--text-primary); }

.grid{
  flex:1;
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  grid-template-rows:repeat(4, 1fr);
  gap:12px;
  min-height:0;
}
.tile{
  position:relative;
  border-radius:20px;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
  overflow:hidden;
  transform: translateZ(0) scale(1) translateY(0);
  transition: transform .08s ease, box-shadow .15s ease;
  box-shadow: inset 0 0 0 0 rgba(255,255,255,0);
}
.tile.empty{
  background:transparent;
  box-shadow:
    inset 0 0 0 2px var(--border-empty),
    inset 0 -4px 8px rgba(0,0,0,0.25),
    inset 0 3px 0 rgba(255,255,255,0.03);
}
.tile.filled, .tile.playing{
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.45),
    inset 0 -6px 14px rgba(0,0,0,0.28),
    0 0 26px 4px var(--glow-strong, transparent),
    0 0 54px 16px var(--glow-soft, transparent);
}
.tile.recording{
  box-shadow:
    inset 0 0 0 3px var(--accent-record),
    0 0 30px 6px rgba(255,92,92,0.45);
}
.tile:active{
  transform: scale(0.94) translateY(2px);
  box-shadow:
    inset 0 6px 14px rgba(0,0,0,0.45),
    inset 0 0 0 2px rgba(0,0,0,0.15);
}
.tile .icon{
  width:38%; height:38%;
  opacity:0.9;
  pointer-events:none;
  display:none;
}
.tile.empty .mic-icon{ display:block; opacity:0.4; }
.tile.filled .play-icon{ width:54%; height:54%; display:block; opacity:0.98; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4)); }
.tile.playing .stop-icon{ width:54%; height:54%; display:block; opacity:0.98; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4)); }

.record-anim, .play-anim{
  position:absolute; inset:0;
  display:none;
  align-items:center; justify-content:center;
  pointer-events:none;
}
.tile.recording .record-anim{ display:flex; }
.tile.playing .play-anim{ display:flex; }

.wave{
  position:absolute;
  width:64%; height:64%;
  border-radius:50%;
  background:#ffffff;
  opacity:0;
}
.record-anim .wave{
  animation: wave-converge 1.3s ease-out infinite;
}
.record-anim .wave.w2{ animation-delay:0.4s; }
.record-anim .wave.w3{ animation-delay:0.8s; }
@keyframes wave-converge{
  0%{ transform:scale(1.7); opacity:0; }
  35%{ opacity:0.6; }
  100%{ transform:scale(0.12); opacity:0; }
}

.play-anim .wave{
  animation: wave-expand 1.3s ease-out infinite;
}
.play-anim .wave.w2{ animation-delay:0.4s; }
.play-anim .wave.w3{ animation-delay:0.8s; }
@keyframes wave-expand{
  0%{ transform:scale(0.12); opacity:0; }
  35%{ opacity:0.6; }
  100%{ transform:scale(1.7); opacity:0; }
}

.rec-mic{
  position:relative;
  width:34%; height:34%;
  opacity:1;
  display:block !important;
  animation: mic-breathe 0.9s ease-in-out infinite;
}
@keyframes mic-breathe{
  0%,100%{ transform:scale(1); }
  50%{ transform:scale(1.22); }
}

.tile.just-recorded{
  animation: pop 0.5s ease-out;
}
@keyframes pop{
  0%{ box-shadow: 0 0 0 0 rgba(76,224,210,0.55); }
  60%{ box-shadow: 0 0 0 18px rgba(76,224,210,0); }
  100%{ box-shadow: 0 0 0 0 rgba(76,224,210,0); }
}

.tile.reset-anim{
  animation: reset-pulse 0.55s ease-out;
}
@keyframes reset-pulse{
  0%{ filter:brightness(1); transform:scale(1) translateY(0); }
  30%{ filter:brightness(1.7); transform:scale(1.04) translateY(0); }
  65%{ filter:brightness(1); transform:scale(0.92) translateY(2px); }
  100%{ filter:brightness(1); transform:scale(1) translateY(0); }
}

footer{
  padding-top:14px;
  text-align:center;
  font-size:12px;
  color:var(--text-muted);
}
.hint b{ color:var(--text-primary); font-weight:600; }

.permission-overlay{
  position:fixed; inset:0;
  background:rgba(20,23,31,0.92);
  display:flex; align-items:center; justify-content:center;
  flex-direction:column; gap:16px;
  text-align:center; padding:32px;
  z-index:10;
}
.permission-overlay h2{
  font-family:'Baloo 2', sans-serif;
  font-size:20px; margin:0;
}
.permission-overlay p{
  color:var(--text-muted); font-size:14px; max-width:320px; margin:0;
}
.permission-overlay button{
  appearance:none; border:none; cursor:pointer;
  background:var(--accent-ready); color:#0a1f1c;
  font-family:'Inter', sans-serif; font-weight:600; font-size:15px;
  padding:12px 22px; border-radius:14px;
}
.hidden{ display:none !important; }

/* ---- Modi, Looper, Tiere (01.12.2026) ---- */
header{ gap:10px; flex-wrap:wrap; }
.brand{ flex:1 1 auto; min-width:0; flex-direction:column; align-items:flex-start; gap:0; line-height:1.15; }
.brand .status{ white-space:nowrap; }
.mode-btn{
  appearance:none; border:none; cursor:pointer; padding:0;
  width:48px; height:48px; border-radius:50%; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  background:linear-gradient(180deg, #2a2f3d, #1c2027);
  box-shadow:0 4px 0 rgba(0,0,0,.4), 0 6px 10px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.18);
  touch-action:none;
}
.mode-btn svg{ width:24px; height:24px; fill:var(--text-muted); pointer-events:none; }
.mode-btn:active{ transform:translateY(3px) scale(.95); }
.mode-btn[aria-pressed="true"]{
  background:var(--accent-ready);
  box-shadow:0 0 16px 2px rgba(76,224,210,.45), inset 0 2px 0 rgba(255,255,255,.45);
}
.mode-btn[aria-pressed="true"] svg{ fill:#0a1f1c; }
.farm-btn{ font-size:26px; line-height:1; filter:grayscale(1); opacity:.7; }
.farm-btn[aria-pressed="true"]{ filter:none; opacity:1; }
#looperBtn .drum{ width:28px; height:28px; fill:none; stroke:var(--text-muted); stroke-width:1.9; stroke-linejoin:round; stroke-linecap:round; }
#looperBtn[aria-pressed="true"] .drum{ fill:none; stroke:#0a1f1c; }
body[data-mode="looper"] .farm-btn{ display:none; }

.transport{ display:none; align-items:center; gap:12px; order:5; flex:1 0 100%; }
body[data-mode="looper"] .transport{ display:flex; }
.dots{ display:flex; gap:7px; flex-shrink:0; }
.dots i{ width:16px; height:16px; border-radius:50%; background:#333949; }
.dots i:first-child{ width:20px; height:20px; margin:-2px 0; }
.dots i.on{ background:var(--accent-ready); box-shadow:0 0 12px 2px rgba(76,224,210,.6); transform:scale(1.15); }
.transport.rec .dots i.on{ background:var(--accent-record); box-shadow:0 0 12px 2px rgba(255,92,92,.7); }
.bpm{ flex:1; min-width:70px; height:44px; display:flex; align-items:center; padding:0 13px; cursor:pointer; touch-action:none; }
.bpm-track{ position:relative; width:100%; height:8px; border-radius:4px;
  background:linear-gradient(90deg, var(--accent-ready) var(--pos,27%), #333949 var(--pos,27%)); }
.bpm-knob{ position:absolute; left:var(--pos,27%); top:50%; width:26px; height:26px; margin:-13px; border-radius:50%;
  background:var(--text-primary); box-shadow:0 2px 6px rgba(0,0,0,.5); }
.bpm-value{ width:68px; flex-shrink:0; font-size:12px; color:var(--text-muted); font-variant-numeric:tabular-nums; }
.bpm-value b{ font-family:'Baloo 2',sans-serif; font-size:18px; color:var(--text-primary); }
.transport.busy .bpm{ opacity:.35; pointer-events:none; }
.play-btn .s, .play-btn[aria-pressed="true"] .p{ display:none; }
.play-btn[aria-pressed="true"] .s{ display:block; }
@media (min-width:700px){
  .transport{ order:0; flex:1 1 320px; max-width:620px; }
  body[data-mode="looper"] .brand{ flex-grow:0; }
}

.count{ display:none; position:absolute; pointer-events:none;
  font:800 clamp(28px, 9vmin, 64px)/1 'Baloo 2', sans-serif; color:#fff; text-shadow:0 2px 6px rgba(0,0,0,.4); }
.tile.armed{ box-shadow:inset 0 0 0 3px var(--accent-record); }
.tile.armed .count{ display:block; }
body[data-mode="looper"] .tile.filled{ filter:brightness(.5) saturate(.8); box-shadow:none; }
body[data-mode="looper"].paused .tile.playing .wave{ animation:none; }

.animal{ display:none; position:absolute; inset:6% 8% 34%; pointer-events:none; }
.animal svg{ position:absolute; inset:0; width:100%; height:100%; }
.animal .shade{ fill:rgba(0,0,0,.42); }
.animal .light{ fill:#fffdf0; filter:drop-shadow(0 0 5px rgba(255,255,255,.7)); }
body[data-mode="farm"] .animal{ display:block; }
body[data-mode="farm"] .wave{ display:none; }
/* Steuer-Icon als Plakette in der Ecke, damit Tier und Bedienung beide sichtbar bleiben */
body[data-mode="farm"] .tile .icon{
  position:absolute; right:5%; bottom:5%; width:auto; height:27%; min-height:30px; aspect-ratio:1; padding:4px;
  border-radius:50%; background:rgba(12,15,22,.72); opacity:1; filter:none; animation:none;
}
body[data-mode="farm"] .tile.recording .rec-mic{ background:var(--accent-record); }
.credit{ display:none; font-size:11px; color:var(--text-muted); margin-left:8px; }
body[data-mode="farm"] .credit{ display:inline; }
@media (orientation:landscape){ .animal{ inset:8% 24% 8% 10%; } }
@media (max-height:480px){
  header{ padding-bottom:8px; flex-wrap:nowrap; }
  .grid{ gap:7px; }
  .hint-bar, footer.copyright{ display:none; }
}
@media (max-width:360px){
  .mode-btn, .reset-btn{ width:42px; height:42px; }
  header{ gap:8px; }
  .brand h1{ font-size:18px; }
  .transport{ gap:8px; }
  .dots{ gap:4px; }
  .bpm{ min-width:50px; }
  .credit{ display:none !important; }
}
