.tk {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin: 1.5rem 0 2rem;
  min-width: 0;
}

.tk-panel .panel-body {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.tk-panel .field {
  margin-bottom: 0;
}

.tk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.tk-result p {
  margin: 0 0 4px;
}

.tk-big {
  font-size: 1.25rem;
}

.tk-roundnote {
  color: var(--warn);
}

.tk-bad {
  color: var(--bad);
}

.tk-tps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--raised);
  font-size: 0.92rem;
}

.tk-tpsinput {
  width: 84px;
}

.tk-presets {
  gap: 6px;
}

.tk-form {
  display: grid;
  gap: 12px;
}

.tk-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.tk-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  cursor: pointer;
}

.tk-messages:empty {
  display: none;
}

.tk-msg {
  margin-bottom: 6px;
  padding: 6px 10px;
  border-left: 3px solid var(--muted);
  border-radius: var(--radius-s);
  background: var(--raised);
  font-size: 0.88rem;
}

.tk-msg.tk-error {
  border-left-color: var(--bad);
  background: var(--bad-soft);
}

.tk-msg.tk-info {
  border-left-color: var(--info);
  background: var(--info-soft);
}

.tk-pre {
  margin: 0;
  padding: 12px 14px;
  max-width: 100%;
  overflow-x: auto;
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  font-family: var(--font-code);
  font-size: 0.86rem;
  line-height: 1.55;
  white-space: pre;
}

.tk-pre code {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  white-space: pre;
  font-size: inherit;
}

.tk-notes {
  margin: 0;
  padding-left: 1.2em;
  display: grid;
  gap: 4px;
}

.tk-subtitle {
  margin: 4px 0 0;
}

.tk-svg {
  width: 100%;
  height: auto;
  font-family: var(--font-body);
}

.tk-axis-small {
  font-size: 11px;
}

.tk-dotlabel {
  font-size: 11px;
  font-weight: 700;
}

.tk-run .tk-dot {
  transition: transform 0.2s;
  transform-box: fill-box;
  transform-origin: center;
}

.tk-run.tk-fired .tk-dot {
  transform: scale(1.25);
  fill: var(--ok);
}

.tk-playhead {
  stroke: var(--accent);
  stroke-width: 2;
}

.tk-playhead[hidden] {
  display: none;
}

.tk-dayview {
  position: relative;
  padding: 18px 0 8px;
}

.tk-sky {
  position: relative;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: linear-gradient(90deg, #5aa9e6 0%, #7cc4f5 45%, #f2a65a 50%, #f08a4b 54%, #1d2540 56%, #0d1228 78%, #1d2540 95%, #f08a4b 98%, #f2c26b 100%);
}

.tk-sun {
  position: absolute;
  top: -10px;
  width: 4px;
  height: 52px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface);
}

.tk-sun::after {
  content: "";
  position: absolute;
  top: -4px;
  left: -5px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface);
}

.tk-slider {
  width: 100%;
}

.tk-dayinfo p {
  margin: 0 0 6px;
}

.tk-daypresets {
  gap: 6px;
}

.tk-phase-day {
  background: var(--info-soft);
  color: var(--info);
}

.tk-phase-sunset,
.tk-phase-sunrise {
  background: var(--warn-soft);
  color: var(--warn);
}

.tk-phase-night {
  background: var(--deep-soft);
  color: var(--deep);
}

.page-body :not(pre) > code {
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 520px) {
  .tk-pair {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tk * {
    transition: none;
    animation: none;
  }
}
