:root {
  --bg: #000000;
  --red: #ff1a1a;
  --red-soft: #8a1010;
  --text-muted: #7b7b7b;
  --panel: #111111;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  background: radial-gradient(circle at center, #130000 0%, var(--bg) 58%);
  color: #f5f5f5;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 0 clamp(0.75rem, 8vw, 9.5rem);
  overflow: hidden;
}

.app-shell {
  position: relative;
  height: calc(100vh - 2.4rem);
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  height: 100%;
  padding: 1.25rem;
  overflow-y: auto;
}

.setup-screen {
  padding-bottom: 1.75rem;
}

.hidden {
  display: none !important;
}

.site-footer {
  position: relative;
  width: 100%;
  padding: 0.35rem 1rem 0.7rem;
  text-align: center;
  z-index: 8;
  margin-top: 0.25rem;
}

.footer-links {
  display: inline-flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: #8f8f8f;
  text-decoration: none;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

.footer-links a:hover {
  color: #c6c6c6;
}

.ad-rail {
  position: fixed;
  top: 1rem;
  bottom: 1rem;
  width: clamp(120px, 9vw, 170px);
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ad-rail-left {
  left: 0.35rem;
}

.ad-rail-right {
  right: 0.35rem;
}

.ad-box {
  width: 100%;
}

.ad-vertical {
  min-height: 320px;
}

.screen-bottom-ad {
  width: min(900px, 100%);
  margin: 1rem auto 0;
  z-index: 6;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid #212121;
  border-radius: 0.55rem;
  padding: 0.25rem 0.35rem;
}

.ad-horizontal {
  min-height: 48px;
}

.ad-label {
  margin: 0;
  color: #838383;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.screen-label {
  margin: 0.5rem 0 0;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red-soft);
  font-weight: 700;
  font-size: 0.8rem;
}

.play-btn,
.back-btn {
  border: 1px solid #3a3a3a;
  background: #0a0a0a;
  color: var(--red);
  padding: 0.5rem 0.9rem;
  border-radius: 0.5rem;
  font-weight: 700;
  cursor: pointer;
}

.play-btn {
  border: none;
  background: var(--red);
  color: #070707;
  padding: 1rem 2.1rem;
  border-radius: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  font-size: 1.3rem;
}

.builder-panel {
  width: min(900px, 100%);
  margin: 1.25rem auto 0;
  background: rgba(18, 18, 18, 0.82);
  border: 1px solid #282828;
  border-radius: 0.9rem;
  padding: 1rem;
}

.builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.builder-title {
  margin: 0;
  color: var(--red);
  font-size: 1.05rem;
  letter-spacing: 0.05em;
}

.edit-btn {
  border: 1px solid #3a3a3a;
  background: #0d0d0d;
  color: #f0f0f0;
  width: 2rem;
  height: 2rem;
  border-radius: 0.45rem;
  cursor: pointer;
}

.edit-btn.is-active {
  border-color: var(--red);
  color: var(--red);
}

.block-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.block-row {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 0.75rem;
  background: var(--panel);
  border: 1px solid #252525;
  border-radius: 0.6rem;
  padding: 0.6rem;
}

.block-row.is-repeat {
  background: #2a2a2a;
  border-color: #474747;
}

.block-row.is-selectable-target {
  border-color: #8d8d8d;
  box-shadow: 0 0 0 1px rgba(155, 155, 155, 0.25);
  cursor: pointer;
}

.color-square {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 0.35rem;
  border: 1px solid #444;
  cursor: pointer;
}

.repeat-icon {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  border: 1px solid #676767;
  color: #d0d0d0;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
}

.move-controls {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.move-btn {
  width: 1.5rem;
  height: 1rem;
  border: 1px solid #4a4a4a;
  background: #111111;
  color: #b8b8b8;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.repeat-center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.repeat-center .repeat-from-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choose-from-btn {
  border: 1px solid #6d6d6d;
  background: #3a3a3a;
  color: #e9e9e9;
  border-radius: 0.45rem;
  font: inherit;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
}

.repeat-from-text {
  font-weight: 700;
}

.repeat-count-input {
  width: 4.5rem;
}

.basic-color-picker {
  position: fixed;
  display: flex;
  gap: 0.4rem;
  padding: 0.45rem;
  border: 1px solid #343434;
  border-radius: 0.55rem;
  background: #080808;
  z-index: 20;
}

.add-menu {
  position: fixed;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.45rem;
  border: 1px solid #343434;
  border-radius: 0.55rem;
  background: #080808;
  z-index: 25;
}

.add-menu button {
  border: 1px solid #303030;
  background: #141414;
  color: #f0f0f0;
  border-radius: 0.4rem;
  font: inherit;
  padding: 0.4rem 0.6rem;
  text-align: left;
  cursor: pointer;
}

.add-menu button:hover {
  border-color: #4b4b4b;
}

.swatch {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.3rem;
  border: 1px solid #4a4a4a;
  cursor: pointer;
}

.name-display,
.time-display {
  color: #f6f6f6;
  cursor: pointer;
}

.name-display {
  display: block;
  width: 100%;
  min-width: 0;
}

.time-display {
  color: var(--red);
  min-width: 4rem;
  text-align: right;
}

.inline-input {
  width: 100%;
  background: #070707;
  border: 1px solid #3a3a3a;
  color: #f6f6f6;
  border-radius: 0.35rem;
  padding: 0.3rem 0.45rem;
  font: inherit;
}

.inline-time {
  width: 6rem;
  text-align: right;
}

.move-controls,
.delete-btn {
  justify-self: end;
}

.add-btn {
  margin-top: 0.9rem;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 1px solid #3a3a3a;
  background: #0b0b0b;
  color: var(--red);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.delete-btn {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.45rem;
  border: 1px solid #3a3a3a;
  background: #0d0d0d;
  color: #ff5d5d;
  cursor: pointer;
}

.timer-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding-bottom: 1.5rem;
}

.timer-center {
  width: 100%;
  flex: 1;
  display: grid;
  align-content: center;
}

.timer-block-name {
  margin: 0;
  text-align: center;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
  font-size: clamp(1.5rem, 4vw, 3.2rem);
}

.timer-round-counter {
  margin: 0.55rem 0 1.1rem;
  text-align: center;
  color: #838383;
  font-weight: 800;
  letter-spacing: 0.07em;
  font-size: clamp(1.1rem, 3vw, 2rem);
}

.timer-controls {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  right: 1.25rem;
  display: flex;
  justify-content: space-between;
  transition: opacity 180ms ease;
}

.timer-controls.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.timer-screen .countdown {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  line-height: 1;
  font-size: clamp(6rem, 28vw, 25rem);
  font-weight: 900;
  letter-spacing: 0;
  color: var(--red);
  text-shadow: 0 0 16px rgba(255, 26, 26, 0.34);
  font-variant-numeric: tabular-nums;
}

.countdown-side {
  min-width: 0;
}

.countdown-left {
  justify-self: end;
  text-align: right;
  padding-right: 0.02em;
}

.countdown-right {
  justify-self: start;
  text-align: left;
  padding-left: 0.02em;
}

.countdown-colon {
  justify-self: center;
  width: 0.55em;
  text-align: center;
}

.continue-btn {
  display: block;
  margin: 1.25rem auto 0;
  border: none;
  background: var(--red);
  color: #050505;
  border-radius: 0.75rem;
  padding: 0.85rem 2rem;
  font-weight: 900;
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  letter-spacing: 0.04em;
  cursor: pointer;
}

.continue-btn.hidden {
  display: none;
}

@media (max-width: 860px) {
  body {
    padding: 0 0.75rem;
  }

  .ad-rail {
    display: none;
  }
}
