:root{
  --bg1:#060b14;
  --bg2:#0b1220;
  --card: rgba(255,255,255,.08);
  --text:#eaf0ff;
  --muted: rgba(234,240,255,.72);
  --accent:#4dd4ff;
  --accent2:#a78bfa;
  --danger:#ff4d6d;
  --ok:#48f0a3;
  --shadow: 0 20px 60px rgba(0,0,0,.45);
  --radius: 22px;
  --safeTop: env(safe-area-inset-top);
  --safeBottom: env(safe-area-inset-bottom);
}

*{
  box-sizing:border-box;
  -webkit-tap-highlight-color: transparent;
}
html,body{ height:100%; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, "SF Pro", "Segoe UI", Roboto, Arial, sans-serif;
  color:var(--text);
  background:
    radial-gradient(1200px 600px at 10% 10%, rgba(77,212,255,.18), transparent 60%),
    radial-gradient(900px 500px at 90% 20%, rgba(167,139,250,.16), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
  overflow:hidden;
}

.app{
  height:100%;
  display:flex;
  flex-direction:column;
  padding: calc(14px + var(--safeTop)) 16px calc(14px + var(--safeBottom));
  gap:14px;
}

/* ----------------- TOPBAR ----------------- */
.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
}

.dot{
  width:14px;
  height:14px;
  border-radius:50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 0 18px rgba(77,212,255,.45);
}

.title{ font-weight:800; font-size:18px; }
.subtitle{ font-size:12px; color:var(--muted); }

.iconBtn{
  background: rgba(255,255,255,.08);
  color:var(--text);
  border:0;
  border-radius:14px;
  padding:10px 12px;
  font-size:18px;
  box-shadow:0 10px 20px rgba(0,0,0,.25);
}

/* ----------------- TIMER CARD ----------------- */
.timerCard{
  position:relative;
  flex:1;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  gap:18px;
  padding:22px 18px;
  border-radius:var(--radius);
  background: linear-gradient(180deg, var(--card), rgba(255,255,255,.04));
  box-shadow:var(--shadow);
  border:1px solid rgba(255,255,255,.10);
  backdrop-filter:blur(14px);
}

.ring{
  position:absolute;
  inset:18px;
  border-radius: calc(var(--radius) - 6px);
  background:
    radial-gradient(circle at 50% 40%, rgba(255,255,255,.08), transparent 55%),
    conic-gradient(from 180deg, rgba(77,212,255,.35), rgba(167,139,250,.28), rgba(255,77,109,.20), rgba(77,212,255,.35));
  opacity:.20;
  pointer-events:none;
}

.timeWrap{
  text-align:center;
  z-index:2;
}

.time{
  font-size: clamp(64px, 10vw, 92px);
  font-weight:900;
  text-shadow:0 18px 55px rgba(0,0,0,.4);
}

.status{
  margin-top:8px;
  font-size:14px;
  color:var(--muted);
}

/* ----------------- PROGRESS RING ----------------- */
.progress{
  position:absolute;
  width:min(70vw, 320px);
  z-index:1;
}

.progress .track{
  fill:none;
  stroke: rgba(255,255,255,.18);
  stroke-width:6;
}

.progress .bar{
  fill:none;
  stroke: var(--accent);
  stroke-width:6;
  stroke-linecap:round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  stroke-dasharray: 283;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .2s linear, stroke .2s ease;
}

.progress.warning .bar { stroke: var(--danger); }
.progress.elapsed .bar { stroke: #888; }

/* ----------------- BUTTON LAYOUT ----------------- */
.controls{
  display:flex;
  gap:18px;
  z-index:2;
}
.controls.secondary{
  width:100%;
  justify-content:center;
}

.microNote{
  min-height:18px;
  text-align:center;
  color:rgba(234,240,255,.72);
}

/* ----------------- MODAL ----------------- */
.backdrop{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.55);
}

.modal{
  position:fixed;
  top:50%;
  left:50%;
  transform:translate(-50%, -50%);
  width:min(520px, calc(100vw - 24px));
  border-radius:22px;
  background:rgba(20,28,46,.96);
  border:1px solid rgba(255,255,255,.12);
  box-shadow:0 30px 90px rgba(0,0,0,.6);
  backdrop-filter:blur(16px);
}

.hidden { display:none; }

.modalHeader{
  padding:16px;
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.modalBody{
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:14px;
}

.modalFooter{
  padding:16px;
  display:flex;
  justify-content:flex-end;
  gap:12px;
}

.field{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.field.inline{
  flex-direction:row;
  align-items:center;
  gap:12px;
}

.row{
  display:flex;
  align-items:center;
  gap:12px;
}

input[type="number"], select{
  flex:1;
  padding:12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.08);
  color:var(--text);
}

.badge{
  padding:10px 12px;
  border-radius:14px;
  background:rgba(255,255,255,.12);
}

.btn{
  padding:12px 16px;
  border-radius:14px;
  font-weight:800;
  border:0;
}

.btn.primary{
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color:#081019;
}
.btn.ghost{
  background:rgba(255,255,255,.10);
  color:var(--text);
}

/* ------------------------------
   🎱 BILLIARD BALL BUTTONS
-------------------------------- */
.ball{
  width:128px;
  height:128px;
  border-radius:50%;
  border:none;
  font-weight:900;
  font-size:22px;
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
  text-align:center;
  user-select:none;
  cursor:pointer;

  box-shadow:
    inset -10px -16px 20px rgba(0,0,0,.35),
    inset 7px 7px 12px rgba(255,255,255,.30),
    0 18px 40px rgba(0,0,0,.45);

  transition: transform .08s ease, box-shadow .08s ease;
}

.ball::before{
  content:"";
  position:absolute;
  top:18px;
  left:22px;
  width:30px;
  height:30px;
  border-radius:50%;
  background:rgba(255,255,255,.55);
  filter:blur(1px);
}

.ball .label{
  position:relative;
  z-index:2;
}

/* Klick */
.ball:active{
  transform:translateY(2px) scale(.98);
  box-shadow:
    inset -8px -12px 18px rgba(0,0,0,.45),
    inset 5px 5px 10px rgba(255,255,255,.18),
    0 10px 22px rgba(0,0,0,.40);
}

/* Start / Cue Ball (weiß) */
.ball.cue{
  background: radial-gradient(circle, #ffffff, #e5e5e5 62%, #cacaca);
  color:#000;
}

/* Reset ball = Blau */
.ball.blue{
  background: radial-gradient(circle at 30% 30%, #b9d7ff, #0064ff 62%, #003a99);
  color:#000;
}

/* Extension ball = Grün */
.ball.green{
  background: radial-gradient(circle at 30% 30%, #c6ffda, #00c060 62%, #006b36);
  color:#000;
}

/* Extension ball USED = Rot */
.ball.green.used{
  background: radial-gradient(circle at 30% 30%, #ffb3b3, #d60000 62%, #7b0000);
  color:#000;
}

/* running glow */
.ball.active{
  box-shadow:
    0 0 24px rgba(255,255,255,.55),
    inset -10px -16px 20px rgba(0,0,0,.35),
    inset 7px 7px 12px rgba(255,255,255,.30),
    0 18px 40px rgba(0,0,0,.45);
}

/* responsive */
@media (max-width: 390px){
  .ball{
    width:112px;
    height:112px;
    font-size:18px;
  }
}