:root{
  --purple: #b84acfff;
  --yellow: #fbbf00ff;

  --bg: var(--yellow);
  --text: var(--purple);

  --card: rgba(255,255,255,0.55);
  --card2: rgba(255,255,255,0.35);
  --stroke: rgba(184,74,207,0.35);

  --shadow: 0 14px 40px rgba(90, 18, 120, 0.25);
  --radius: 22px;

  --tap: 48px;
}

*{ box-sizing:border-box }
html,body{ height:100% }

body{
  margin:0;
  font-family: "Ubuntu", system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: var(--bg);
  color: var(--text);
}

/* Topbar: lila durchgehend, Logo mittig, Dropdown rechts */
.topbar{
  position: sticky;
  top: 0;
  z-index: 50;

  display: grid;
  grid-template-columns: var(--tap) 1fr auto;
  align-items: center;
  gap: 10px;

  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: var(--purple);
  color: var(--yellow);
  box-shadow: 0 8px 18px rgba(60, 10, 80, 0.25);
}

.menu-btn{
  width: var(--tap);
  height: var(--tap);
  border: 0;
  background: rgba(251,191,0,0.18);
  border-radius: 14px;
  cursor: pointer;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:6px;
  padding: 12px;
}
.menu-btn span{
  display:block;
  height:2px;
  width: 18px;
  background: var(--yellow);
  border-radius: 2px;
}

.topbar-center{
  display:flex;
  justify-content:center;
  align-items:center;
  min-height: var(--tap);
}
.logo{
  height: 36px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.2));
}

.topbar-right{
  display:flex;
  align-items:center;
  gap:10px;
}
.topbar-field{
  display:flex;
  flex-direction:column;
  gap:6px;
  align-items:flex-end;
}
.topbar-label{
  font-size: 12px;
  opacity: 0.9;
}
.topbar-select{
  min-width: 160px;
  max-width: 44vw;

  height: 40px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(251,191,0,0.35);
  background: rgba(251,191,0,0.20);
  color: var(--yellow);
  font-weight: 700;
  outline: none;
}

/* Sidebar */
.sidebar{
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;

  width: 300px;
  height: 100vh;

  padding: calc(14px + env(safe-area-inset-top)) 14px 14px;
  background: rgba(184,74,207,0.96);
  color: var(--yellow);

  transform: translateX(-100%);
  transition: transform 180ms ease;
  box-shadow: 12px 0 30px rgba(60,10,80,0.25);
}
.sidebar.open{ transform: translateX(0) }

.sidebar-head{
  font-weight: 800;
  letter-spacing: 0.3px;
  padding: 10px 10px 14px;
  border-bottom: 1px solid rgba(251,191,0,0.35);
}

.nav{
  display:flex;
  flex-direction:column;
  gap: 10px;
  margin-top: 14px;
}
.navlink{
  text-decoration:none;
  color: var(--yellow);
  background: rgba(251,191,0,0.16);
  border: 1px solid rgba(251,191,0,0.35);
  border-radius: 16px;
  padding: 14px 12px;
  font-weight: 800;
}
.navlink.active{
  background: rgba(251,191,0,0.28);
  box-shadow: inset 0 0 0 2px rgba(251,191,0,0.35);
}

/* Backdrop */
.backdrop{
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(0,0,0,0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}
.backdrop.open{
  opacity: 1;
  pointer-events: auto;
}

/* Content */
.content{
  padding: 18px 14px 40px;
}
.page-wrap{
  max-width: 520px;
  margin: 0 auto;
  padding-top: 14px;
}
.page-title{
  margin: 10px 0 14px;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.2px;
  color: var(--purple);
}

.card{
  background: var(--card);
  border: 2px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(6px);
}

.field{
  display:flex;
  flex-direction:column;
  gap: 8px;
}
.label{
  font-weight: 800;
  font-size: 13px;
}
.select{
  height: 46px;
  padding: 0 12px;
  border-radius: 16px;
  border: 2px solid rgba(184,74,207,0.45);
  background: var(--card2);
  color: var(--purple);
  font-weight: 800;
  outline: none;
}

/* Stopwatch center */
.stopwatch{
  margin-top: 16px;
  padding: 16px;
  border-radius: 20px;
  border: 2px solid rgba(184,74,207,0.45);
  background: rgba(251,191,0,0.18);
}

.stopwatch-label{
  font-size: 12px;
  font-weight: 800;
  opacity: 0.9;
  margin-bottom: 8px;
}

.display{
  font-family: "DSEG7 Classic", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 56px;
  line-height: 1;
  letter-spacing: 1px;
  text-align: center;
  color: var(--purple);
  text-shadow: 0 10px 26px rgba(184,74,207,0.22);
  padding: 10px 8px 6px;
  border-radius: 16px;
  background: rgba(255,255,255,0.55);
  border: 2px solid rgba(184,74,207,0.25);
}

.display-sub{
  margin-top: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  opacity: 0.85;
}

/* Buttons */
.btn{
  width: 100%;
  height: 54px;
  margin-top: 14px;
  border: 0;
  border-radius: 18px;
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
}
.btn-primary{
  background: var(--purple);
  color: var(--yellow);
  box-shadow: 0 10px 22px rgba(90, 18, 120, 0.25);
}
.btn:active{ transform: translateY(1px) }
.btn:disabled{ opacity: 0.55; cursor:not-allowed }

.hint{
  margin-top: 12px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0.9;
}

/* Modal */
.modal::backdrop{ background: rgba(0,0,0,0.45) }
.modal{
  border: 2px solid rgba(184,74,207,0.35);
  border-radius: 22px;
  padding: 0;
  background: rgba(255,255,255,0.92);
  color: var(--purple);
  box-shadow: var(--shadow);
  width: min(560px, 92vw);
}
.modal-inner{ padding: 16px }
.modal-header{
  display:flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.modal-title{
  font-weight: 900;
  opacity: 0.9;
}
.modal-time{
  font-family: "DSEG7 Classic", ui-monospace, monospace;
  font-size: 48px;
  margin-top: 8px;
}
.iconbtn.close{
  width: 46px;
  height: 46px;
  border-radius: 16px;
  border: 2px solid rgba(184,74,207,0.35);
  background: rgba(251,191,0,0.25);
  color: var(--purple);
  font-size: 22px;
  cursor: pointer;
}

.ratings{
  margin-top: 14px;
  display:flex;
  flex-direction:column;
  gap: 12px;
}
.rating-row{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 12px;
}
.rating-label{
  font-weight: 900;
}
.stars{ display:flex; gap: 8px; }

.star{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 2px solid rgba(184,74,207,0.35);
  background: rgba(251,191,0,0.20);
  color: rgba(184,74,207,0.55);
  display:grid;
  place-items:center;
  cursor:pointer;
  user-select:none;
  font-size: 18px;
}
.star.filled{
  background: rgba(184,74,207,0.16);
  border-color: rgba(184,74,207,0.55);
  color: var(--purple);
}

.modal-actions{
  margin-top: 14px;
  display:flex;
  justify-content:flex-end;
}

/* Desktop tweaks */
@media (min-width: 900px){
  .page-wrap{ max-width: 640px; }
  .topbar-select{ min-width: 220px; }
}
