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

.brand a {
  display: flex;
  align-items: center;
}

.sakura-logo {
  display: block;
  width: auto;
  height: 36px;
}

.tb-midnight {
  --tb-ease: cubic-bezier(0.32, 0.72, 0, 1);
  --tb-ease-soft: cubic-bezier(0.16, 1, 0.3, 1);
  --tb-urgent: #ffb45a;
}

.composer {
  display: grid;
  gap: 16px;
  max-width: 560px;
  margin-top: 32px;
}

.duration {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  color: var(--tb-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tb-input::placeholder {
  color: var(--tb-muted);
  opacity: 0.72;
}

.field input[type="number"] {
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}

.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.composer .tb-button {
  justify-self: start;
}

.error {
  margin: 0;
  color: var(--tb-accent);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.dial {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  align-items: stretch;
  padding: 28px 32px 24px;
  text-align: left;
}

.dial-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.dial .tb-eyebrow,
.dial-status {
  margin: 0;
}

.dial-status {
  color: var(--tb-accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.dial-body {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(16px, 2vw, 40px);
  min-height: 0;
}

.dial-face {
  position: relative;
  width: min(220px, 100%);
  aspect-ratio: 1;
  justify-self: center;
}

.dial-ring {
  display: block;
  width: 100%;
  height: auto;
}

.dial-track,
.dial-arc {
  fill: none;
  stroke-width: 6;
}

.dial-track {
  stroke: rgba(168, 182, 204, 0.28);
}

.dial-arc {
  stroke: var(--tb-accent);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-box: fill-box;
  transform-origin: center;
  transition: stroke-dashoffset 180ms var(--tb-ease), stroke 480ms var(--tb-ease);
}

.dial-ticks line {
  stroke: var(--tb-muted);
  stroke-linecap: round;
}

.dial-ticks .minor {
  stroke-width: 1;
  opacity: 0.32;
}

.dial-ticks .major {
  stroke-width: 1.75;
  opacity: 0.75;
}

.dial[data-status="idle"] .dial-arc {
  stroke: transparent;
}

.dial[data-status="paused"] .dial-arc {
  stroke: var(--tb-muted);
}

.dial.is-urgent .dial-arc {
  stroke: var(--tb-urgent);
}

.dial-share {
  position: absolute;
  inset: 23%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  text-align: center;
}

.dial-share-value {
  color: var(--tb-text);
  font-variant-numeric: tabular-nums;
  font-size: clamp(26px, 2vw, 44px);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1;
}

.dial-share-label {
  color: var(--tb-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.dial[data-status="running"] .dial-share-value {
  color: var(--tb-accent);
}

.dial-readout {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  width: 100%;
  min-width: 0;
}

.dial-lead {
  width: 100%;
  min-width: 0;
}

.dial[data-status="idle"] .dial-status,
.dial[data-status="paused"] .dial-status,
.dial[data-status="completed"] .dial-status {
  color: var(--tb-muted);
}

.dial-digits,
.digits {
  display: inline-flex;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.dial-digits {
  margin: 0;
  color: var(--tb-muted);
  font-size: clamp(36px, 4vw, 64px);
  line-height: 1;
  white-space: nowrap;
}

.dial-digits.has-days,
.dial-digits.has-ms {
  font-size: clamp(32px, 3.6vw, 48px);
}

.dial[data-status="running"] .dial-digits,
.dial[data-status="expired"] .dial-digits {
  color: var(--tb-accent);
}

.dial[data-status="paused"] .dial-digits {
  color: var(--tb-text);
}

.dial.is-urgent .dial-digits,
.dial.is-urgent .dial-share-value {
  color: var(--tb-urgent);
}

.dial-digits span,
.digits span {
  display: inline-block;
  min-width: 0.62em;
  text-align: center;
}

.dial-digits .sep,
.digits .sep {
  min-width: 0.28em;
  opacity: 0.55;
}

.dial-digits .ms,
.digits .ms {
  min-width: 1ch;
  font-size: 0.62em;
}

.dial-key {
  display: block;
  max-width: 100%;
  margin-top: 12px;
  overflow: hidden;
  color: var(--tb-text);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dial-key:hover {
  color: var(--tb-accent);
}

.dial-note {
  max-width: 28rem;
  margin: 12px 0 0;
  color: var(--tb-muted);
  font-size: 16px;
}

.dial-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  margin: 0;
}

.dial-stats[hidden] {
  display: none;
}

.dial-stats div {
  min-width: 0;
  padding: 14px 16px 16px;
  border: 1px solid rgba(43, 60, 85, 0.95);
  border-radius: 14px;
  background: rgba(11, 18, 32, 0.38);
}

.dial-stats dt {
  margin: 0;
  color: var(--tb-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dial-stats dd {
  margin: 8px 0 0;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  font-size: clamp(16px, 1.4vw, 24px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board {
  padding-bottom: 64px;
}

.board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.board-head h1,
.board-head h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.tb-nav a[aria-current="page"] {
  color: var(--tb-text);
}

.history-board {
  padding-top: 48px;
}

.history-lead {
  margin: 0 0 28px;
}

.history-log {
  display: grid;
  gap: 28px;
}

.history-day {
  margin: 0 0 12px;
  color: var(--tb-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.history-events {
  list-style: none;
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
}

.history-row {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 16px;
}

.history-time {
  color: var(--tb-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

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

.history-kind {
  margin: 4px 0 0;
  color: var(--tb-accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.history-row[data-type="deleted"] .history-kind,
.history-row[data-type="paused"] .history-kind,
.history-row[data-type="completed"] .history-kind {
  color: var(--tb-muted);
}

.history-spent {
  margin: 0;
  color: var(--tb-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.history-note {
  margin: 6px 0 0;
  color: var(--tb-text);
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.note-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  grid-column: 1 / -1;
}

.note-form .tb-input {
  flex: 1 1 16rem;
  min-height: 36px;
  padding: 8px 12px;
  font-size: 14px;
}

.count {
  margin: 0;
  color: var(--tb-muted);
  font-size: 13px;
}

.count:has(#active-count) {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-size: 15px;
}

#active-count {
  color: var(--tb-text);
  font-size: 40px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1;
}

.empty {
  margin: 0;
  padding: 28px;
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-radius);
  background: var(--tb-surface);
  color: var(--tb-muted);
}

.sync-status {
  margin: 0 0 20px;
  color: var(--tb-accent);
  font-size: 14px;
  font-weight: 600;
}

#task-list {
  list-style: none;
  display: grid;
  gap: 20px;
  margin: 0;
  padding: 0;
}

#task-list:empty {
  display: none;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 16px;
}

.row.is-new {
  animation: tb-enter 720ms var(--tb-ease);
}

.row.is-featured {
  border-color: var(--tb-accent);
}

.row.is-urgent {
  border-color: var(--tb-urgent);
  background:
    linear-gradient(180deg, rgba(255, 180, 90, 0.16), transparent 46%),
    var(--tb-surface);
  box-shadow: inset 3px 0 0 var(--tb-urgent);
}

.issue {
  min-width: 0;
  overflow: hidden;
  color: var(--tb-text);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue:hover {
  color: var(--tb-accent);
}

.digits {
  color: var(--tb-text);
  font-size: 20px;
  line-height: 1;
}

.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  grid-column: 1 / -1;
}

.labels {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  min-width: 0;
}

.status {
  margin: 0;
  color: var(--tb-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.row.is-featured[data-status="running"] .issue,
.row.is-featured[data-status="running"] .digits,
.row[data-status="running"] .status,
.row[data-status="expired"] .status {
  color: var(--tb-accent);
}

.urgent-flag {
  margin: 0;
  color: var(--tb-urgent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.row[data-status="paused"] .issue,
.row[data-status="paused"] .digits,
.row[data-status="completed"] .issue,
.row[data-status="completed"] .digits {
  color: var(--tb-muted);
}

.row.is-urgent .issue,
.row.is-urgent .digits,
.row.is-urgent .status,
.row.is-featured.is-urgent .issue,
.row.is-featured.is-urgent .digits {
  color: var(--tb-urgent);
}

.bar {
  grid-column: 1 / -1;
  height: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--tb-border);
}

.bar > span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--tb-accent);
  transform-origin: left center;
  transition: transform 180ms var(--tb-ease);
}

.row[data-status="paused"] .bar > span,
.row[data-status="completed"] .bar > span {
  background: var(--tb-muted);
}

.row.is-urgent .bar > span {
  background: var(--tb-urgent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.action {
  min-height: 36px;
  padding: 8px 14px;
  font-size: 13px;
}

@keyframes tb-enter {
  from {
    opacity: 0;
    transform: translate3d(0, 22px, 0) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 760px) {
  .tb-header .tb-logo {
    width: 124px;
    height: 36px;
  }

  .sakura-logo {
    height: 28px;
  }

  .duration {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tb-hero {
    gap: 0;
  }

  .tb-hero > div {
    display: contents;
  }

  .tb-description {
    margin-top: 0;
    margin-bottom: 0;
  }

  .composer {
    order: 2;
  }

  .composer .tb-button {
    justify-self: stretch;
  }

  .dial {
    position: relative;
    order: 1;
    height: auto;
    margin-top: 32px;
    min-height: 0;
  }

  .dial-body {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .dial-face {
    width: min(210px, 62vw);
  }

  .dial-readout,
  .dial-lead {
    align-items: center;
    text-align: center;
  }

  .dial-stats {
    max-width: 340px;
  }

  .dial-digits {
    font-size: clamp(36px, 12vw, 56px);
  }

  .dial-digits.has-days,
  .dial-digits.has-ms {
    font-size: clamp(28px, 9vw, 44px);
  }

  .meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    justify-content: flex-start;
  }

  .history-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .history-spent {
    grid-column: 2;
    text-align: left;
  }
}

.tb-header,
.tb-hero > div > .tb-eyebrow,
.tb-title,
.tb-hero > div > .tb-description,
.composer,
.dial,
.board-head,
.board > .empty,
.history-lead,
.tb-footer {
  animation: tb-rise 860ms var(--tb-ease) backwards;
}

.tb-title {
  white-space: nowrap;
}

.tb-hero > div > .tb-eyebrow { animation-delay: 70ms; }
.tb-title { animation-delay: 130ms; }
.tb-hero > div > .tb-description,
.history-lead { animation-delay: 190ms; }
.composer { animation-delay: 250ms; }
.dial { animation-delay: 170ms; }
.board-head { animation-delay: 300ms; }
.board > .empty { animation-delay: 360ms; }
.tb-footer { animation-delay: 420ms; }

.tb-logo,
.sakura-logo,
.tb-nav a,
.tb-button,
.tb-input,
.issue,
.dial-key,
.row,
.history-row,
.dial-status,
.dial-digits,
.count {
  transition:
    color 480ms var(--tb-ease),
    background-color 480ms var(--tb-ease),
    border-color 560ms var(--tb-ease),
    transform 560ms var(--tb-ease),
    opacity 480ms var(--tb-ease);
}

.tb-nav a:hover,
.tb-header a:hover .tb-logo {
  transform: translateY(-2px);
}

.tb-header a:hover .tb-logo,
.brand:hover .sakura-logo {
  transform: scale(1.035);
}

.tb-button:hover {
  transform: translateY(-2px);
}

.tb-button:active {
  transform: scale(0.98);
}

.tb-button:disabled:hover,
.tb-button:disabled:active {
  transform: none;
}

.tb-input:focus {
  transform: translateY(-1px);
  border-color: var(--tb-accent);
}

.dial-key:hover {
  transform: translateX(4px);
}

.dial {
  isolation: isolate;
  overflow: hidden;
}

.dial::before {
  content: "";
  position: absolute;
  pointer-events: none;
}

.dial::before {
  z-index: 0;
  width: 240px;
  height: 240px;
  top: -72px;
  right: -48px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(131, 181, 255, 0.42), transparent 68%);
  animation: tb-orb 18s var(--tb-ease-soft) infinite alternate;
}

.dial > * {
  position: relative;
  z-index: 1;
}

.dial.is-status .dial-status {
  animation: tb-status 560ms var(--tb-ease);
}

.dial[data-status="running"] .dial-digits .sep:not(.dot) {
  animation: tb-colon 2s var(--tb-ease-soft) infinite;
}

.dial-digits span.tick,
.digits span.tick {
  animation: tb-tick 460ms var(--tb-ease);
}

.error:not([hidden]) {
  animation: tb-rise 520ms var(--tb-ease);
}

.row.is-leaving {
  pointer-events: none;
  animation: tb-leave 440ms var(--tb-ease) forwards;
}

.history-events > li {
  animation: tb-enter 760ms var(--tb-ease) backwards;
}

.history-events > li:nth-child(2) { animation-delay: 50ms; }
.history-events > li:nth-child(3) { animation-delay: 100ms; }
.history-events > li:nth-child(4) { animation-delay: 150ms; }
.history-events > li:nth-child(5) { animation-delay: 200ms; }
.history-events > li:nth-child(6) { animation-delay: 250ms; }
.history-events > li:nth-child(7) { animation-delay: 300ms; }
.history-events > li:nth-child(n + 8) { animation-delay: 340ms; }

@media (hover: hover) {
  .row:hover,
  .history-row:hover {
    transform: translateY(-4px);
    background: var(--tb-surface-hover);
  }

  .row.is-urgent:hover {
    background:
      linear-gradient(180deg, rgba(255, 180, 90, 0.22), transparent 52%),
      var(--tb-surface-hover);
  }
}

@keyframes tb-rise {
  from {
    opacity: 0;
    transform: translate3d(0, 28px, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes tb-tick {
  from {
    opacity: 0.15;
    transform: translate3d(0, 0.46em, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes tb-colon {
  0%, 42% { opacity: 0.92; }
  50%, 92% { opacity: 0.22; }
  100% { opacity: 0.92; }
}

@keyframes tb-status {
  from {
    opacity: 0;
    transform: translate3d(0, 8px, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes tb-orb {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-28px, 22px, 0) scale(1.08); }
}

@keyframes tb-leave {
  to {
    opacity: 0;
    transform: translate3d(0, 14px, 0) scale(0.98);
  }
}

/* Desktop Full HD: largest 16:9 frame that fills the screen. Mobile stays at max-width 760px. */
@media (min-width: 761px) {
  html {
    height: 100%;
  }

  body.tb-midnight {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .tb-container {
    display: flex;
    flex-direction: column;
    width: min(100vw, calc(100vh * 16 / 9));
    width: min(100vw, calc(100dvh * 16 / 9));
    height: min(100vh, calc(100vw * 9 / 16));
    height: min(100dvh, calc(100vw * 9 / 16));
    margin: 0;
    padding-inline: clamp(24px, 2.5vw, 56px);
  }

  #main {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: auto;
  }

  .tb-hero {
    flex: 0 0 auto;
    align-items: stretch;
    grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
    gap: clamp(32px, 3vw, 64px);
    padding-block: clamp(24px, 3vh, 40px);
  }

  .composer {
    max-width: 640px;
  }

  .tb-description {
    max-width: none;
  }

  .dial {
    height: 100%;
  }

  .dial-body {
    grid-template-rows: minmax(0, 1fr) minmax(136px, 34%);
    align-items: stretch;
  }

  .dial-readout {
    display: contents;
  }

  .dial-lead {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    min-height: 0;
    container-type: size;
  }

  .dial-face {
    grid-row: 2;
    width: auto;
    height: 100%;
    max-width: 100%;
    justify-self: start;
  }

  .dial-stats {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
  }

  .dial-digits {
    font-size: min(20.5cqi, calc(100cqh - 40px));
  }

  .dial-digits.has-days,
  .dial-digits.has-ms {
    font-size: min(14.5cqi, calc(100cqh - 40px));
  }

  .board {
    flex: 1 0 auto;
    padding-bottom: 28px;
  }
}
