:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101010;
  color: #f4f1ea;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: #101010;
}

button,
input {
  font: inherit;
}

.viewer-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100vw;
  height: 100svh;
  background: #101010;
}

.top-panel {
  z-index: 5;
  padding: 5px 10px 6px;
  background: rgba(16, 16, 16, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.title-row {
  position: relative;
  min-height: 25px;
}

.viewer-title {
  position: absolute;
  left: 50%;
  width: min(72vw, 620px);
  transform: translateX(-50%);
  justify-self: center;
  overflow: hidden;
  text-align: center;
  font-size: clamp(15px, 4vw, 22px);
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.counter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 16px;
  margin-top: 2px;
  margin-bottom: 5px;
}

.brand-title {
  color: #ff4a4a;
}

.course-title {
  color: #fffaf0;
}

.image-counter,
.slide-label,
.group-number {
  color: #2f55ff;
  font-weight: 900;
}

.image-counter {
  position: relative;
  z-index: 1;
  justify-self: end;
  min-width: 38px;
  padding: 3px 5px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  text-align: center;
  font-size: 11px;
}

.gauge-panel {
  margin-top: 5px;
}

.gauge-labels {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  color: #f3f0e7;
  font-size: 11px;
  font-weight: 800;
}

.gauge-labels span {
  text-align: center;
}

.group-gauge {
  width: 100%;
  height: 18px;
  margin: 0;
  accent-color: #2f55ff;
}

.gauge-actions {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 24px;
  width: 100%;
}

.group-controls {
  position: absolute;
  left: 50%;
  display: grid;
  grid-template-columns: 30px 46px 30px;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
}

.group-controls button {
  height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #f4f1ea;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
}

.bottom-panel button {
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  color: #f4f1ea;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.group-number {
  height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  background: #f8f6f0;
  color: #395bff;
  text-align: center;
  font-size: 16px;
  line-height: 20px;
}

.quick-range {
  justify-self: end;
  max-width: 34vw;
  min-width: 0;
  overflow: hidden;
  color: #2f55ff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  background: #0b0b0b;
  touch-action: none;
}

#mainImage {
  display: block;
  max-width: 100%;
  max-height: 100%;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
  will-change: transform;
}

.bottom-panel {
  z-index: 5;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 12px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(16, 16, 16, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.slide-label {
  text-align: center;
  font-size: 18px;
}
