.tfl-daily-harmony {
  --tfl-bg: #f8fafc;
  --tfl-card: #ffffff;
  --tfl-ink: #0f172a;
  --tfl-muted: #64748b;
  --tfl-line: #cbd5e1;
  --tfl-primary: #1a56db;
  --tfl-primary-dark: #1746ad;
  --tfl-soft: #eef4ff;
  --tfl-danger: #b91c1c;
  --tfl-success: #166534;
  --tfl-warning: #92400e;
  color: var(--tfl-ink);
  background: linear-gradient(180deg, #ffffff 0%, var(--tfl-bg) 100%);
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: clamp(16px, 3vw, 28px);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  width: min(100%, 1100px);
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
}

.tfl-dh-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.tfl-dh-title {
  font-size: clamp(1.45rem, 4vw, 2.25rem);
  line-height: 1.05;
  margin: 0 0 8px;
  letter-spacing: -0.04em;
}

.tfl-dh-subtitle,
.tfl-dh-description {
  margin: 0;
  color: var(--tfl-muted);
  line-height: 1.5;
  max-width: 760px;
}

.tfl-dh-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tfl-dh-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #dbeafe;
  background: var(--tfl-soft);
  color: #1e3a8a;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 700;
}

.tfl-dh-scorebox {
  background: var(--tfl-card);
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 10px 14px;
  min-width: 132px;
  text-align: center;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

.tfl-dh-scorebox strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1.1;
}

.tfl-dh-scorebox span {
  display: block;
  color: var(--tfl-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.tfl-dh-board {
  background: var(--tfl-card);
  border: 1px solid #e2e8f0;
  border-radius: 22px;
  overflow: hidden;
}

.tfl-dh-stage {
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
}

.tfl-dh-svg {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto;
  touch-action: manipulation;
}

.tfl-dh-note-slot {
  cursor: pointer;
}

.tfl-dh-note-slot ellipse {
  transition: transform 120ms ease, fill 120ms ease, stroke 120ms ease;
  transform-box: fill-box;
  transform-origin: center;
}

.tfl-dh-slot-halo {
  transition: fill 120ms ease, stroke 120ms ease, r 120ms ease;
}

.tfl-dh-note-slot:hover ellipse,
.tfl-dh-note-slot:focus-visible ellipse,
.tfl-dh-note-slot.is-selected ellipse {
  transform: scale(1.08);
}

.tfl-dh-note-slot:focus-visible {
  outline: none;
}

.tfl-dh-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid #e2e8f0;
  background: #fbfdff;
}

.tfl-dh-button {
  border: 1px solid #dbe3ef;
  background: #ffffff;
  color: var(--tfl-ink);
  border-radius: 14px;
  padding: 11px 14px;
  font-weight: 800;
  cursor: pointer;
  min-height: 44px;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.tfl-dh-button:hover {
  transform: translateY(-1px);
  border-color: #b6c3d5;
}

.tfl-dh-button-primary {
  background: var(--tfl-primary);
  border-color: var(--tfl-primary);
  color: white;
}

.tfl-dh-button-primary:hover {
  background: var(--tfl-primary-dark);
}

.tfl-dh-picker {
  margin-top: 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 14px;
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.08);
}

.tfl-dh-picker-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--tfl-muted);
  font-weight: 800;
  margin-bottom: 10px;
}


.tfl-dh-keyboard-hint {
  color: var(--tfl-muted);
  font-size: 0.82rem;
  font-weight: 700;
  margin: -2px 0 10px;
}

.tfl-dh-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 8px;
}

.tfl-dh-choice {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid #dbe3ef;
  background: #f8fafc;
  font-weight: 900;
  cursor: pointer;
}

.tfl-dh-choice.is-active {
  border-color: var(--tfl-primary);
  background: var(--tfl-soft);
  color: #1e3a8a;
}


.tfl-dh-picker-layer {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 18px !important;
  box-sizing: border-box !important;
}

.tfl-dh-picker-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(15, 23, 42, 0.42);
  cursor: pointer;
}

.tfl-dh-picker-popup {
  position: relative;
  z-index: 1;
  width: min(92vw, 460px);
  max-height: min(80vh, 560px);
  overflow: auto;
  margin: 0;
  border-color: #dbeafe;
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.28);
}

.tfl-dh-picker-close {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #dbe3ef;
  background: #f8fafc;
  color: #0f172a;
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 900;
  cursor: pointer;
}

.tfl-dh-picker-close:hover,
.tfl-dh-picker-close:focus-visible {
  border-color: #bfdbfe;
  background: #eff6ff;
}


.tfl-dh-note-slot,
.tfl-dh-note-slot * {
  cursor: pointer;
}

.tfl-dh-note-hit {
  pointer-events: all;
}

.tfl-dh-feedback {
  margin-top: 16px;
  border-radius: 18px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  line-height: 1.5;
}

.tfl-dh-feedback.is-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: var(--tfl-success);
}

.tfl-dh-feedback.is-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--tfl-danger);
}

.tfl-dh-feedback.is-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: var(--tfl-warning);
}

.tfl-dh-feedback ul {
  margin: 8px 0 0 1.1em;
  padding: 0;
}

.tfl-dh-feedback li + li {
  margin-top: 4px;
}

.tfl-dh-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--tfl-muted);
  font-size: 0.9rem;
  margin-top: 12px;
}

.tfl-dh-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tfl-dh-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #0f172a;
  display: inline-block;
}

.tfl-dh-dot-missing { background: #94a3b8; }
.tfl-dh-dot-fixed { background: #0f172a; }
.tfl-dh-dot-selected { background: var(--tfl-primary); }

@media (max-width: 700px) {
  .tfl-daily-harmony {
    width: calc(100vw - 14px);
    max-width: calc(100vw - 14px);
    margin-left: calc(50% - 50vw + 7px);
    margin-right: calc(50% - 50vw + 7px);
    margin-bottom: 92px;
    padding: 10px;
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  }

  .tfl-dh-header {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 10px;
  }

  .tfl-dh-title {
    font-size: 1.35rem;
    letter-spacing: -0.03em;
  }

  .tfl-dh-subtitle,
  .tfl-dh-description {
    font-size: 0.94rem;
    line-height: 1.36;
  }

  .tfl-dh-meta {
    gap: 6px;
    margin-top: 8px;
  }

  .tfl-dh-pill {
    font-size: 0.74rem;
    padding: 5px 8px;
  }

  .tfl-dh-scorebox {
    display: none;
  }

  .tfl-dh-board {
    border-radius: 16px;
  }

  .tfl-dh-stage {
    padding: 4px 2px 8px;
  }

  .tfl-dh-svg {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .tfl-dh-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px;
  }

  .tfl-dh-button {
    width: 100%;
    min-height: 42px;
    border-radius: 13px;
    padding: 9px 10px;
    font-size: 0.94rem;
  }

  .tfl-dh-picker {
    margin-top: 10px;
    border-radius: 16px;
    padding: 10px;
  }

  .tfl-dh-picker-head {
    flex-direction: column;
    gap: 3px;
    font-size: 0.86rem;
  }

  .tfl-dh-keyboard-hint {
    font-size: 0.76rem;
    margin-bottom: 8px;
  }

  .tfl-dh-choice-grid {
    grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
    gap: 7px;
  }

  .tfl-dh-choice {
    min-height: 42px;
    border-radius: 12px;
  }

  .tfl-dh-legend {
    font-size: 0.78rem;
    gap: 8px;
    margin-top: 8px;
  }
}

.tfl-dh-date-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  margin: 0 0 14px;
}

.tfl-dh-date-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid #dbe3ef;
  background: #ffffff;
  color: var(--tfl-ink);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 850;
  text-decoration: none;
}

.tfl-dh-date-link:hover {
  border-color: #b6c3d5;
  background: #f8fafc;
}

.tfl-dh-date-link.is-disabled {
  color: var(--tfl-muted);
  background: #f8fafc;
}

.tfl-dh-date-current {
  text-align: center;
  line-height: 1.15;
}

.tfl-dh-date-current span {
  display: block;
  color: var(--tfl-muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tfl-dh-date-current strong {
  display: block;
  font-size: 0.98rem;
}

@media (max-width: 560px) {
  .tfl-dh-date-nav {
    display: flex;
    grid-template-columns: none;
    gap: 4px;
    margin-bottom: 8px;
  }

  .tfl-dh-date-current {
    display: none;
  }

  .tfl-dh-date-link {
    flex: 1 1 0;
    min-width: 0;
    min-height: 30px;
    padding: 4px 5px;
    border-radius: 999px;
    font-size: 0.66rem;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* v0.7.0 CPT archive cards */
.tfl-dh-archive-list {
  width: min(100%, 1100px);
  margin: 0 auto;
  color: #0f172a;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.tfl-dh-archive-list h2 {
  font-size: clamp(1.35rem, 3vw, 2rem);
  letter-spacing: -0.03em;
  margin: 0 0 16px;
}

.tfl-dh-archive-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.tfl-dh-archive-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #ffffff;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.tfl-dh-archive-card:hover,
.tfl-dh-archive-card:focus-visible {
  transform: translateY(-2px);
  border-color: #bfdbfe;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.1);
}

.tfl-dh-archive-card strong {
  color: #1a56db;
  font-size: 0.9rem;
}

.tfl-dh-archive-card span {
  font-weight: 850;
  line-height: 1.25;
}

.tfl-dh-archive-card small {
  color: #64748b;
  line-height: 1.35;
}

@media (max-width: 760px) {
  .tfl-dh-archive-grid {
    grid-template-columns: 1fr;
  }
}

/* v0.8.0 library/challenge split */
.tfl-dh-header.is-library .tfl-dh-pill {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #334155;
}

.tfl-dh-archive-intro {
  color: #64748b;
  margin: -6px 0 18px;
  max-width: 760px;
  line-height: 1.5;
}

.tfl-dh-archive-list.is-library .tfl-dh-archive-card strong {
  color: #166534;
}

.tfl-dh-archive-list.is-daily .tfl-dh-archive-card strong {
  color: #1a56db;
}

/* v0.9.4 library level/key selection flow */
.tfl-dh-library-flow {
  padding-bottom: 24px;
}

.tfl-dh-library-breadcrumbs {
  width: min(100%, 1100px);
  margin: 0 auto 14px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.tfl-dh-level-grid .tfl-dh-archive-card,
.tfl-dh-key-grid .tfl-dh-archive-card {
  min-height: 148px;
}

.tfl-dh-level-card em,
.tfl-dh-key-card em {
  color: #64748b;
  font-style: normal;
  font-size: 0.88rem;
}

.tfl-dh-level-card span {
  font-size: 1.08rem;
}

.tfl-dh-key-card strong {
  font-size: 1.15rem;
}

.tfl-dh-library-subheading {
  margin: 22px 0 10px;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  color: #0f172a;
}

@media (max-width: 760px) {
  .tfl-dh-level-grid .tfl-dh-archive-card,
  .tfl-dh-key-grid .tfl-dh-archive-card {
    min-height: 0;
  }
}

/* v0.9.6 simpler library flow: choose level, then random exercise */
.tfl-dh-library-random-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}

.tfl-dh-random-context {
  width: min(100%, 1100px);
  margin: 0 auto 14px;
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  background: #f8fbff;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: baseline;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.tfl-dh-random-context strong {
  color: #0f172a;
}

.tfl-dh-random-context span {
  color: #64748b;
}

/* v0.9.8 — daily challenge email subscription */
.tfl-dh-subscribe {
  margin: 22px auto 0;
  width: min(100%, 980px);
  padding: 0 12px;
  box-sizing: border-box;
}
.tfl-dh-subscribe-inner {
  border: 1px solid rgba(23, 32, 51, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 34px rgba(16, 24, 40, 0.08);
  padding: 18px;
}
.tfl-dh-subscribe-copy h3 {
  margin: 0 0 6px;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}
.tfl-dh-subscribe-copy p,
.tfl-dh-subscribe-privacy {
  margin: 0 0 12px;
  color: rgba(23, 32, 51, 0.72);
  font-size: 0.95rem;
}
.tfl-dh-subscribe-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.tfl-dh-subscribe-form input[type="email"] {
  flex: 1 1 260px;
  min-height: 44px;
  border: 1px solid rgba(23, 32, 51, 0.18);
  border-radius: 999px;
  padding: 0 16px;
  font: inherit;
  background: #fff;
}
.tfl-dh-subscribe-form button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: #172033;
  color: #fff;
}
.tfl-dh-subscribe-notice {
  border-radius: 14px;
  padding: 10px 12px;
  margin: 10px 0 12px;
  font-size: 0.95rem;
}
.tfl-dh-subscribe-notice.is-success { background: rgba(20, 120, 70, 0.12); color: #145c38; }
.tfl-dh-subscribe-notice.is-error { background: rgba(180, 35, 24, 0.11); color: #8a1f17; }
.tfl-dh-subscribe-notice.is-info { background: rgba(40, 80, 160, 0.10); color: #243b70; }
@media (max-width: 640px) {
  .tfl-dh-subscribe { padding: 0 8px; }
  .tfl-dh-subscribe-inner { padding: 14px; border-radius: 18px; }
  .tfl-dh-subscribe-form { display: block; }
  .tfl-dh-subscribe-form input[type="email"],
  .tfl-dh-subscribe-form button { width: 100%; margin-top: 8px; }
}


@media (max-width: 700px) {
  .tfl-dh-picker-layer {
    align-items: center !important;
    justify-content: center !important;
    padding: max(14px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom)) !important;
  }

  .tfl-dh-picker-popup {
    width: min(92vw, 420px);
    max-height: min(70vh, 480px);
    border-radius: 18px;
    padding: 12px;
  }

  .tfl-dh-picker-popup .tfl-dh-choice-grid {
    grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
    gap: 8px;
  }

  .tfl-dh-picker-popup .tfl-dh-choice {
    min-height: 48px;
    font-size: 0.98rem;
  }
}

