/* Mode switch and header */

#mode-slot {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mode-item {
  position: relative;
  padding: 0 10px;
}

.due-dot {
  position: absolute;
  top: 5px;
  right: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.daily-lock {
  display: none;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.daily-lock svg {
  color: var(--faint);
}

:root[data-mode="daily"] .daily-lock {
  display: inline-flex;
}

:root[data-mode="daily"] .controls {
  display: none;
}

body[data-phase="playing"] #mode-slot .seg,
:root[data-mode="daily"][data-daily="playing"] #mode-slot .seg {
  opacity: 0.35;
  pointer-events: none;
}

:root[data-mode="practice"] body[data-phase="playing"] .streak-chip {
  opacity: 0.35;
}

.streak-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}

.streak-chip svg {
  color: var(--muted);
}

/* Screens */

:root[data-mode="daily"] .stage > .screen {
  display: none;
}

:root[data-mode="daily"] .stage > .screen-daily:not([data-view="loading"]) {
  display: flex;
}

.screen-daily > div {
  display: none;
  width: 100%;
}

.screen-daily[data-view="ready"] .daily-ready,
.screen-daily[data-view="playing"] .daily-play,
.screen-daily[data-view="error"] .daily-error {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.screen-daily[data-view="done"] {
  max-width: 1000px;
  text-align: left;
}

.screen-daily[data-view="done"] .daily-result {
  display: grid;
}

/* Ready */

.daily-preview #dr-preview {
  filter: blur(10px);
  user-select: none;
}

.daily-foot {
  width: 100%;
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
}

.daily-clock {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.clock {
  color: var(--fg);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.daily-error {
  gap: 12px;
}

/* Streak */

.streak {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.week {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.wd {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 14px;
  font-size: 10px;
  font-weight: 500;
  color: var(--faint);
}

.wd i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
}

.wd-played i {
  background: var(--fg);
  border-color: var(--fg);
}

.wd-frozen i {
  border: 1px dashed var(--fg);
}

.wd-today i {
  border-color: var(--fg);
}

.wd-future i {
  border-color: var(--line);
}

.wd-current span {
  color: var(--fg);
  font-weight: 600;
}

.streak-text {
  min-width: 0;
}

.streak-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.streak-sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

/* Play */

.daily-play-note {
  margin: 64px 0 0;
  min-height: 18px;
  font-size: 12px;
  color: var(--muted);
}

.daily-play-note.confirming {
  color: var(--fg);
  font-weight: 500;
}

#dp-time {
  color: var(--muted);
}

#dp-time.urgent {
  color: var(--fg);
}

/* Result */

.daily-result {
  grid-template-columns: minmax(0, 1fr) 280px;
  column-gap: 72px;
  row-gap: 40px;
  align-items: start;
}

:root[data-daily="done"] .daily-result > * {
  animation: rise 220ms var(--ease-out) both;
}

:root[data-daily="done"] .daily-result > :nth-child(2) {
  animation-delay: 40ms;
}

:root[data-daily="done"] .daily-result > :nth-child(3) {
  animation-delay: 80ms;
}

.dres-main {
  min-width: 0;
}

.dres-head {
  display: flex;
  align-items: flex-end;
  gap: 32px;
  margin-top: 12px;
}

.dres-head .end-score {
  margin: 0;
}

.dres-place {
  padding-bottom: 10px;
  min-width: 0;
}

.dres-verdict {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.dres-sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.card {
  margin-top: 36px;
  max-width: 640px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
}

.card-title {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.card-hint {
  color: var(--muted);
  font-size: 12px;
}

.squares {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 5px;
  margin: 14px 0 16px;
}

.sq {
  display: block;
  aspect-ratio: 1;
  border-radius: 4px;
}

.sq-0 {
  background: var(--line);
}

.sq-1 {
  background: var(--faint);
}

.sq-2 {
  background: var(--muted);
}

.sq-3 {
  background: var(--fg);
}

.squares.fresh .sq {
  animation: square-in 200ms var(--ease-out) both;
  animation-delay: calc(120ms + var(--i) * 28ms);
}

@keyframes square-in {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.card-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.legend-scale {
  display: inline-flex;
  gap: 2px;
}

.legend-scale .sq {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.legend-slow:not(:empty) {
  margin-left: 4px;
}

.card-actions {
  display: flex;
  gap: 8px;
}

.card-actions .btn {
  height: 34px;
}

.copy-btn {
  min-width: 108px;
}

.dres-note {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.rail-label {
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--fg);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.board {
  margin: 0;
  padding: 6px 0 0;
  list-style: none;
}

.board-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  height: 34px;
  padding: 0 8px;
  margin: 0 -8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.board-rank {
  color: var(--faint);
}

.board-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-score {
  font-weight: 600;
}

.board-you {
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}

.board-you .board-name {
  font-weight: 600;
}

.board-ghost .board-name,
.board-ghost .board-score {
  color: var(--muted);
}

.board-tag {
  font-weight: 400;
  color: var(--muted);
}

.board-gap,
.board-empty {
  padding: 8px 0;
  font-size: 12px;
  color: var(--faint);
}

.rail-clock {
  margin-top: 28px;
}

.rail-clock .rail-label {
  border-bottom-color: var(--line);
}

.clock-big {
  margin: 12px 0 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.clock-sub {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.rail-next {
  margin-top: 14px;
}

:root[data-mode="daily"][data-daily="playing"] #account,
:root[data-mode="daily"][data-daily="playing"] #signin-btn {
  opacity: 0.35;
}

.dres-foot {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.dres-stats {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Small screens */

@media (max-width: 960px) {
  .daily-lock-more {
    display: none;
  }
}

@media (max-width: 860px) {
  .daily-result {
    grid-template-columns: minmax(0, 1fr);
  }
  .dres-foot,
  .daily-foot {
    flex-direction: column;
    align-items: flex-start;
  }
  .dres-stats {
    text-align: left;
  }
}

@media (max-width: 760px) {
  #mode-slot {
    order: 3;
  }
  .controls {
    order: 4;
  }
  .dres-head {
    gap: 20px;
  }
  .dres-verdict {
    font-size: 20px;
  }
  .card {
    padding: 16px;
  }
  .card-actions {
    width: 100%;
  }
  .card-actions .btn {
    flex: 1;
  }
}
