/* 元件樣式：組間計時器、純數字鍵盤 */

.workout-log {
  width: min(100%, 420px);
  display: grid;
  gap: 28px;
  justify-items: center;
}

.rest-timer {
  --timer-progress: 1;
  display: grid;
  place-items: center;
  width: 176px;
  height: 176px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #05080f 0 62%, transparent 63%),
    conic-gradient(
      from 180deg,
      #00ffd1 calc(var(--timer-progress) * 360deg),
      rgba(0, 255, 209, 0.12) 0
    );
  box-shadow:
    0 0 0 1px rgba(0, 255, 209, 0.22),
    0 0 28px rgba(0, 255, 209, 0.18),
    inset 0 0 24px rgba(0, 140, 255, 0.12);
}

.rest-timer__face {
  display: grid;
  place-items: center;
  gap: 6px;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background: linear-gradient(180deg, #0b1220 0%, #070b14 100%);
  border: 1px solid rgba(0, 255, 209, 0.28);
}

.rest-timer__label {
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #7f93a8;
}

.rest-timer__time {
  font-variant-numeric: tabular-nums;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #7fffd4;
  text-shadow: 0 0 16px rgba(0, 255, 209, 0.45);
}

.set-row {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 14px 14px 16px;
  border: 1px solid rgba(0, 255, 209, 0.2);
  border-radius: 18px;
  background: rgba(7, 11, 20, 0.78);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.set-row__index {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  color: #7fffd4;
}

.set-row__fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.set-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.set-field__label {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7f93a8;
}

.set-field__input {
  width: 100%;
  min-width: 0;
  min-height: 56px;
  padding: 8px 10px;
  border: 1px solid rgba(0, 255, 209, 0.22);
  border-radius: 12px;
  background: rgba(5, 8, 15, 0.9);
  color: #d7f9ff;
  font-size: clamp(1.15rem, 4.6vw, 1.7rem);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
  caret-color: #00ffd1;
  cursor: pointer;
}

.set-field__input::placeholder {
  color: rgba(127, 147, 168, 0.7);
}

.set-field__input.is-active {
  border-color: #00ffd1;
  box-shadow: 0 0 0 1px rgba(0, 255, 209, 0.35), 0 0 16px rgba(0, 255, 209, 0.18);
  color: #7fffd4;
}

.numeric-keypad {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.keypad-btn {
  min-height: 60px;
  padding: 0;
  border: 1px solid rgba(0, 255, 209, 0.22);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(12, 20, 34, 0.95) 0%, rgba(7, 11, 20, 0.95) 100%);
  color: #d7f9ff;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  transition:
    transform 0.08s ease,
    background 0.08s ease,
    border-color 0.08s ease,
    box-shadow 0.08s ease,
    color 0.08s ease;
}

.keypad-btn:hover {
  border-color: rgba(0, 255, 209, 0.55);
  color: #7fffd4;
}

.keypad-btn:focus-visible {
  outline: 2px solid #00ffd1;
  outline-offset: 2px;
}

.keypad-btn:active,
.keypad-btn.is-active {
  transform: scale(0.96);
  background: linear-gradient(180deg, rgba(0, 255, 209, 0.28) 0%, rgba(0, 140, 255, 0.18) 100%);
  border-color: #00ffd1;
  color: #05080f;
  box-shadow: inset 0 0 18px rgba(0, 255, 209, 0.35);
}

.keypad-btn--action {
  font-size: 1.5rem;
  color: #9be7ff;
}

.keypad-btn--submit {
  grid-column: 1 / -1;
  min-height: 56px;
  color: #05080f;
  background: linear-gradient(180deg, #7fffd4 0%, #00cfae 100%);
  border-color: #7fffd4;
  font-size: 1rem;
  letter-spacing: 0.08em;
}

.keypad-btn--submit:hover {
  color: #05080f;
  background: linear-gradient(180deg, #b2ffe6 0%, #00e6c0 100%);
}

.keypad-btn--submit.is-saved {
  background: #51e48e;
  border-color: #51e48e;
}

.keypad-btn--submit.is-error {
  color: #fff0f0;
  background: #9d3d4d;
  border-color: #ff8b9b;
}

.set-row__feedback {
  min-height: 1.2em;
  margin: 0;
  color: #7f93a8;
  font-size: 0.78rem;
  text-align: center;
}

.set-row__feedback[data-status="success"] {
  color: #51e48e;
}

.set-row__feedback[data-status="error"] {
  color: #ff8b9b;
}

.keypad-btn--zero {
  letter-spacing: 0.08em;
}

.keypad-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.habits-view {
  width: min(100%, 900px);
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(0, 255, 209, 0.2);
  border-radius: 18px;
  background: rgba(7, 11, 20, 0.78);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.habits-view__heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.habits-view__heading h1 {
  margin: 0;
  color: #d7f9ff;
  font-size: clamp(1.35rem, 4vw, 1.9rem);
}

.habits-view__eyebrow,
.habits-view__period,
.habits-view__status {
  margin: 0;
  color: #7f93a8;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
}

.habits-view__eyebrow {
  margin-bottom: 6px;
  color: #7fffd4;
}

.habit-chart {
  position: relative;
  height: 300px;
  padding: 10px 4px 0;
}

.habits-dashboard__section {
  display: grid;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(127, 147, 168, 0.18);
}

.habits-dashboard__section h2 {
  margin: 0;
  color: #c9e7f4;
  font-size: 1rem;
}

.muscle-chart {
  position: relative;
  height: 320px;
  max-width: 560px;
  width: 100%;
  margin-inline: auto;
}

.workout-history__list {
  display: grid;
  gap: 10px;
}

.workout-history__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(71, 166, 255, 0.2);
  border-radius: 10px;
  background: rgba(5, 8, 15, 0.62);
}

.workout-history__details {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.workout-history__details strong {
  color: #d7f9ff;
  font-size: 0.9rem;
}

.workout-history__details span,
.workout-history__empty {
  margin: 0;
  color: #9fb2c8;
  font-size: 0.8rem;
}

.workout-history__actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.workout-history__actions button {
  min-height: 36px;
  padding: 6px 9px;
  border: 1px solid rgba(0, 255, 209, 0.24);
  border-radius: 8px;
  background: rgba(0, 255, 209, 0.06);
  color: #c9e7f4;
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
}

.workout-history__actions button:last-child {
  border-color: rgba(255, 92, 154, 0.32);
  background: rgba(255, 92, 154, 0.08);
}

.workout-history__actions button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.workout-history__editor {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 10px;
}

.workout-history__editor[hidden] {
  display: none;
}

.workout-history__editor label {
  display: grid;
  gap: 5px;
  color: #9fb2c8;
  font-size: 0.76rem;
}

.workout-history__editor input {
  width: 100%;
  min-height: 40px;
  padding: 7px 9px;
  border: 1px solid rgba(0, 255, 209, 0.3);
  border-radius: 8px;
  background: rgba(5, 8, 15, 0.9);
  color: #d7f9ff;
  font: inherit;
}

.workout-history__editor .workout-history__actions {
  grid-column: 1 / -1;
}

.workout-history__delete-confirm {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
  padding-top: 10px;
  color: #ffb2c8;
  font-size: 0.8rem;
}

.workout-history__delete-confirm[hidden] {
  display: none;
}

@media (max-width: 540px) {
  .habits-view {
    padding: 16px;
  }

  .workout-history__item {
    align-items: flex-start;
    grid-template-columns: minmax(0, 1fr);
  }

  .workout-history__actions {
    width: 100%;
  }

  .workout-history__actions button {
    flex: 1;
  }
}

.habits-view__status {
  min-height: 1.2em;
  letter-spacing: 0.04em;
  text-align: right;
}

.bottom-nav {
  position: fixed;
  z-index: 10;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(0, 255, 209, 0.2);
  background: rgba(5, 8, 15, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.bottom-nav__button {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  min-height: 56px;
  padding: 4px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #7f93a8;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.bottom-nav__icon {
  font-size: 1.15rem;
  line-height: 1;
}

.bottom-nav__button:hover,
.bottom-nav__button.is-active {
  border-color: rgba(0, 255, 209, 0.28);
  background: rgba(0, 255, 209, 0.08);
  color: #7fffd4;
}

.bottom-nav__button.is-active {
  text-shadow: 0 0 12px rgba(0, 255, 209, 0.55);
  box-shadow: inset 0 0 18px rgba(0, 255, 209, 0.08), 0 0 18px rgba(0, 255, 209, 0.12);
}

.bottom-nav__button:focus-visible {
  outline: 2px solid #00ffd1;
  outline-offset: 2px;
}

[data-app-view][hidden] {
  display: none;
}
