:root {
  color-scheme: light;
  --ink: #12201b;
  --muted: #607069;
  --line: #d9e5df;
  --panel: #ffffff;
  --page: #f5faf7;
  --green: #10a86c;
  --green-deep: #08734e;
  --blue: #2388d9;
  --pink: #db4b87;
  --yellow: #f4c542;
  --shadow: 0 18px 42px rgba(22, 62, 43, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(51, 205, 135, 0.22), transparent 32rem),
    linear-gradient(180deg, #f8fffb 0%, var(--page) 100%);
  color: var(--ink);
  font-family:
    "Inter", "Yu Gothic UI", "Hiragino Sans", "Meiryo", system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green-deep);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1.02;
}

h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

.today-chip {
  display: grid;
  gap: 6px;
  min-width: 174px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.today-chip span {
  color: var(--muted);
  font-size: 0.88rem;
}

.today-chip strong {
  color: var(--green-deep);
  font-size: 1.2rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  font-size: 2rem;
  line-height: 1;
}

.accent-green strong {
  color: var(--green);
}

.accent-blue strong {
  color: var(--blue);
}

.accent-pink strong {
  color: var(--pink);
}

.tab-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.tab-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.tab-button.active {
  background: var(--green);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(16, 168, 108, 0.2);
}

.workspace {
  display: block;
}

.exercise-panel,
.timer-panel,
.calendar-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.exercise-panel,
.calendar-panel {
  padding: 16px;
}

.timer-panel {
  padding: 18px;
}

.section-heading,
.timer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.compact-heading {
  margin-top: 18px;
}

.daily-plan {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.plan-summary {
  display: grid;
  grid-column: 1 / -1;
  gap: 3px;
  padding: 12px;
  border-radius: 8px;
  background: #eaf9f1;
  color: var(--green-deep);
}

.plan-summary span {
  color: var(--muted);
  font-size: 0.84rem;
}

.plan-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
  width: 100%;
  min-height: 116px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  font-weight: 800;
}

.plan-item.current {
  border-color: rgba(16, 168, 108, 0.7);
  background: #f5fff9;
  box-shadow: inset 0 0 0 2px rgba(16, 168, 108, 0.1);
}

.plan-item.locked {
  background: #f7fbf9;
  color: #7d8b85;
}

.plan-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-pill {
  display: inline-grid;
  min-width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 999px;
  background: #e2f8ee;
  color: var(--green-deep);
  font-size: 0.8rem;
  font-weight: 900;
}

.plan-item strong {
  color: var(--green-deep);
}

.plan-meta {
  display: grid;
  gap: 3px;
}

.plan-meta small,
.plan-actions label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.plan-item.done {
  border-color: rgba(16, 168, 108, 0.55);
  background: #f0fcf5;
}

.plan-item.done .plan-item-top > span:last-child::before {
  content: "✓ ";
  color: var(--green);
}

.plan-actions {
  display: grid;
  gap: 8px;
}

.plan-start-button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #ffffff;
  font-weight: 900;
}

.plan-start-button:disabled {
  cursor: not-allowed;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
}

.plan-actions label {
  display: grid;
  gap: 5px;
}

.swap-select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
  background: #ffffff;
  color: var(--ink);
}

.swap-select:disabled {
  opacity: 0.55;
}

.exercise-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.exercise-card {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfefd;
  color: var(--ink);
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.exercise-card:hover,
.exercise-card.active {
  transform: translateY(-1px);
  border-color: rgba(16, 168, 108, 0.55);
  background: #effcf5;
}

.exercise-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #e2f8ee;
  color: var(--green-deep);
  font-size: 1.35rem;
  font-weight: 900;
}

.exercise-card strong {
  display: block;
  margin-bottom: 2px;
}

.exercise-card small,
.exercise-description,
.timer-face small,
.day-detail,
.log-form label {
  color: var(--muted);
}

.level-pill,
.type-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.level-pill {
  min-width: 58px;
  padding: 6px 9px;
  background: #e8f4ff;
  color: #1769a8;
}

.type-pill {
  padding: 5px 8px;
  background: #eef8f3;
  color: var(--green-deep);
}

.exercise-description {
  min-height: 48px;
  margin-bottom: 14px;
  line-height: 1.6;
}

.form-visual {
  margin: 0 0 16px;
}

.form-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid #cce6d9;
  border-radius: 8px;
  background-image: url("assets/exercise-form-atlas-anime.png");
  background-position: var(--atlas-x, 0%) var(--atlas-y, 0%);
  background-repeat: no-repeat;
  background-size: 300% 300%;
  background-color: #ffffff;
}

.form-visual figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.5;
}

.timer-face {
  display: grid;
  gap: 8px;
  place-items: center;
  margin-bottom: 16px;
  padding: 28px 14px;
  border: 1px solid #cce6d9;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(16, 168, 108, 0.12), rgba(35, 136, 217, 0.1)),
    #fbfffd;
}

.timer-face span {
  color: var(--green-deep);
  font-weight: 900;
}

.timer-face strong {
  font-variant-numeric: tabular-nums;
  font-size: clamp(3rem, 9vw, 5.4rem);
  line-height: 0.95;
}

.timer-controls,
.preset-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border: 0;
  border-radius: 8px;
  font-weight: 850;
}

.primary-button {
  min-height: 46px;
  padding: 0 16px;
  background: var(--green);
  color: white;
  box-shadow: 0 10px 20px rgba(16, 168, 108, 0.24);
}

.secondary-button,
.ghost-button,
.icon-button {
  min-height: 42px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.ghost-button {
  padding: 0 12px;
}

.icon-button {
  width: 40px;
  font-size: 1.5rem;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.preset-button {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid #cae6d8;
  border-radius: 8px;
  background: #f5fcf8;
  color: var(--green-deep);
  font-weight: 800;
}

.preset-button.active {
  background: var(--green);
  color: white;
}

.log-form {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 10px;
  align-items: end;
}

.log-form label {
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 800;
}

.log-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--ink);
  background: #fff;
}

.feedback-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #cae6d8;
  border-radius: 8px;
  background: #f4fcf8;
}

.feedback-panel[hidden] {
  display: none;
}

.feedback-panel h2 {
  margin-bottom: 0;
}

.feedback-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.feedback-actions button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
}

.feedback-actions button:hover {
  border-color: rgba(16, 168, 108, 0.55);
  background: #effcf5;
}

.feedback-panel small {
  color: var(--muted);
  font-weight: 800;
}

.compact {
  min-height: 42px;
}

.calendar-heading {
  display: grid;
  grid-template-columns: auto 1fr auto;
  text-align: center;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.weekday-row {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-align: center;
}

.calendar-day {
  position: relative;
  display: grid;
  min-height: 48px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f7fbf9;
  color: var(--ink);
  font-weight: 850;
}

.calendar-day.other-month {
  color: #a6b4ae;
}

.calendar-day.today {
  border-color: var(--blue);
}

.calendar-day.done {
  background: #e9fbf1;
  color: var(--green-deep);
}

.calendar-day.partial {
  background: #fff8e5;
  color: #8a6200;
}

.calendar-day.selected {
  outline: 3px solid rgba(35, 136, 217, 0.24);
}

.calendar-day .dot {
  position: absolute;
  bottom: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.day-detail {
  min-height: 108px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfefd;
  line-height: 1.55;
}

.day-detail strong {
  display: block;
  color: var(--ink);
  margin-bottom: 6px;
}

.day-detail ul {
  padding-left: 18px;
  margin: 8px 0 0;
}

.day-detail li + li {
  margin-top: 4px;
}

@media (max-width: 980px) {
  .daily-plan,
  .exercise-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .plan-summary {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 1240px);
    padding: 16px 0;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid,
  .tab-nav,
  .daily-plan,
  .exercise-list,
  .timer-controls,
  .preset-row,
  .feedback-actions,
  .log-form {
    grid-template-columns: 1fr;
  }

  .timer-face {
    padding: 22px 10px;
  }
}
