:root {
  --bg: #0f1115;
  --panel: #1a1f29;
  --text: #f5f7fa;
  --accent: #2f80ed;
  --ok: #27ae60;
  --danger: #eb5757;
  --btn: #2d3748;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}

.app {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.toggle-admin {
  position: relative;
  z-index: 60;
  min-height: 3rem;
  min-width: 8rem;
  padding: 0.5rem 0.9rem;
  border-radius: 12px;
  background: #3a4458;
  font-size: clamp(1rem, 2vw, 1.3rem);
  justify-self: start;
  align-self: center;
}

.admin {
  position: fixed;
  top: 64px;
  left: 170px;
  width: min(34vw, 520px);
  max-height: min(86vh, 760px);
  overflow: auto;
  z-index: 40;
  background: var(--panel);
  padding: 1rem;
  border: 2px solid #2a3342;
  border-radius: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  align-items: center;
}

.admin.rotated {
  transform: rotate(180deg);
}

.opposite-on #btnToggleAdmin,
.opposite-on .progress-title,
.opposite-on .mode-btn,
.opposite-on #wordBox,
.opposite-on #letterBox,
.opposite-on .btn-sub {
  transform: rotate(180deg);
}

.admin.hidden {
  display: none;
}

.admin h2,
.admin label,
.admin button,
.admin input {
  font-size: clamp(0.9rem, 1.7vw, 1.2rem);
}

.admin h2 {
  grid-column: 1 / -1;
  margin: 0;
}

.admin-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.admin input[type='number'],
.admin input[type='range'] {
  background: #11161f;
  color: var(--text);
  border: 1px solid #3a4458;
  border-radius: 10px;
  padding: 0.45rem;
}

.admin input[type='range'] {
  padding: 0.2rem;
}
.speed-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.user-view {
  display: grid;
  grid-template-rows: 24% 76%;
  padding: 1rem 1.2rem 1rem 1.2rem;
}


.top-strip {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(420px, 1fr) minmax(80px, 110px);
  gap: 0.9rem;
  align-items: center;
  padding: 0 0.4rem;
}

.progress-panel {
  justify-self: stretch;
  align-self: center;
  width: 100%;
  background: #141a23;
  border: 2px solid #374154;
  border-radius: 18px;
  padding: 0.8rem 1.2rem;
  text-align: center;
}

.progress-title {
  font-size: clamp(1rem, 2.1vw, 1.5rem);
  opacity: 0.92;
  margin-bottom: 0.45rem;
}

.word-box,
.letter-box {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #374154;
  border-radius: 18px;
  background: #141a23;
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.6rem;
  width: min(760px, 95%);
  margin: 0.2rem auto 0.8rem;
}

.mode-btn {
  min-height: 2.6rem;
  font-size: clamp(0.9rem, 1.8vw, 1.2rem);
  background: #293142;
}

.mode-btn.active {
  background: #2f80ed;
}

.word-box {
  margin: 0;
  font-size: clamp(2rem, 5.6vw, 4.8rem);
  min-height: 5.2rem;
  letter-spacing: 0.08em;
}

.letter-box {
  justify-self: stretch;
  align-self: center;
  width: 100%;
  margin: 0;
  font-size: clamp(1.1rem, 2.1vw, 1.6rem);
  min-height: 2.4rem;
  max-height: 3rem;
  border-radius: 12px;
}

.controls {
  display: grid;
  /* 25% zurück | 75% weiter+bestätigen */
  grid-template-columns: 1fr 1.5fr 1.5fr;
  column-gap: 0.9rem; /* normaler Abstand */
  align-items: stretch;
  justify-self: stretch;
  align-self: end;
  width: 100%;
  height: 100%;
}

/* Größerer Abstand zwischen Zurück und dem rechten Block */
#btnPrev {
  margin-right: 1rem;
}

.btn {
  border: none;
  border-radius: 22px;
  background: var(--btn);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.05s ease, filter 0.2s ease, background 0.2s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn.huge {
  position: relative;
  font-size: clamp(2.8rem, 6.6vw, 5.4rem);
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding-top: 3.5rem; /* mehr Platz oben */
}

.btn-icon {
  line-height: 1;
  margin-top: 0;
}

.btn-sub {
  position: absolute;
  top: 0.45rem;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: clamp(0.9rem, 1.9vw, 1.45rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
  pointer-events: none;
}

.btn.confirm {
  background: var(--ok);
}

.btn.danger {
  background: var(--danger);
}

.btn.admin-btn {
  min-height: 2.8rem;
}

.btn.longpress-armed {
  filter: brightness(1.2);
  outline: 4px solid #ffd166;
}

@media (max-width: 900px) {
  .admin {
    left: 10px;
    top: 74px;
    width: min(68vw, 420px);
    grid-template-columns: 1fr;
  }

  .top-strip {
    grid-template-columns: minmax(120px, 170px) minmax(0, 1fr) minmax(64px, 82px);
    gap: 0.5rem;
  }

  .controls {
    width: 100%;
    column-gap: 0.65rem;
  }

  #btnPrev {
    margin-right: 0.7rem;
  }

  .btn.huge {
    font-size: clamp(1.5rem, 5.2vw, 2.5rem);
  }
}
