:root {
  color-scheme: dark;
  font-family: Inter, system-ui, sans-serif;
}

body {
  margin: 0;
  background: #11131a;
  color: #f4f4f4;
}

.app {
  width: min(980px, 94vw);
  margin: 24px auto 32px;
}

h1,
h2,
h3,
h4 {
  margin-top: 0;
}

.card {
  background: #1b1f2a;
  border: 1px solid #31384a;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.hidden {
  display: none;
}

.buttons-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

button {
  border: 1px solid #58617a;
  background: #252c3a;
  color: #f2f2f2;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
}

button:hover {
  background: #2e3850;
}

button.active {
  border-color: #6ad4ff;
  background: #244462;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}


.live-selector button.active {
  border-color: #b65454;
  background: #4a2020;
  color: #ffd4d4;
}

.blank-selector button.active {
  border-color: #5e86bf;
  background: #22344e;
  color: #d7e8ff;
}

.primary {
  background: #2f5f2e;
  border-color: #4f9550;
}

.primary:hover {
  background: #3a7539;
}

.warning {
  background: #6d5722;
  border-color: #a88a3f;
}

.warning:hover {
  background: #816a2b;
}

.live-tone {
  color: #ff8f8f;
  border-color: #b65454;
}

.blank-tone {
  color: #9dc7ff;
  border-color: #5e86bf;
}

.action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.selected {
  margin: 8px 0 12px;
  color: #adb5c8;
}

.counters {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.counter-btn {
  width: 100%;
  min-height: 170px;
  padding: 14px;
  padding-right: 92px;
  display: grid;
  gap: 10px;
  text-align: left;
  align-content: space-between;
  border-width: 2px;
  position: relative;
  overflow: hidden;
}

.counter-btn strong {
  font-size: 44px;
  line-height: 1;
}

.counter-title {
  font-size: 15px;
  font-weight: 700;
}

.counter-shell {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  height: calc(100% - 18px);
  max-width: 84px;
  object-fit: contain;
  opacity: 0.95;
  pointer-events: none;
}

.counter-chance {
  font-size: 15px;
  opacity: 0.95;
}

.counter-chance strong {
  font-size: 20px;
}

.counter-btn.live-tone {
  background: #4a2020;
}

.counter-btn.live-tone:hover {
  background: #622929;
}

.counter-btn.live-tone .counter-chance strong {
  color: #ffd4d4;
}

.counter-btn.blank-tone {
  background: #22344e;
}

.counter-btn.blank-tone:hover {
  background: #294060;
}

.counter-btn.blank-tone .counter-chance strong {
  color: #d7e8ff;
}

.actions {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}


.timeline-wrapper {
  margin-top: 16px;
}

.timeline-hint {
  margin: 0 0 10px;
  color: #adb5c8;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 6px;
}

.timeline-empty {
  color: #adb5c8;
  margin: 0;
}

.timeline-chip {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  justify-items: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: 8px;
  border: 1px solid #434c61;
  background: #1c2230;
  text-align: center;
}

.timeline-chip .chip-index {
  font-weight: 700;
  font-size: 12px;
  color: #b8c8ec;
}

.timeline-chip .chip-shell {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 6px;
}


.timeline-chip:disabled {
  opacity: 1;
  cursor: default;
}

.timeline-chip.used:disabled {
  opacity: 0.5;
}

.timeline-chip.neutral {
  background: #1a1f2a;
  border-color: #3f4759;
}

.timeline-chip.pred-live {
  background: #4a2020;
  border-color: #b65454;
}

.timeline-chip.pred-blank {
  background: #22344e;
  border-color: #5e86bf;
}

.timeline-chip.used {
  opacity: 0.5;
  background: #161b25;
  border-style: dashed;
}

.timeline-chip.current {
  border-color: #ffd369;
  background: #3a2f16;
  box-shadow: 0 0 0 2px #ffd369 inset;
}

.timeline-chip.current.neutral {
  background: #3a2f16;
}

.timeline-chip.current .chip-shell {
  filter: brightness(1.12) contrast(1.12);
}

.timeline-chip.current.neutral .chip-shell {
  filter: brightness(1.45) contrast(1.2);
}


@media (max-width: 700px) {
  .counters {
    grid-template-columns: 1fr;
  }

  .buttons-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .timeline {
    grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  }
}
