:root {
  --bg: #eef1ed;
  --ink: #17211b;
  --muted: #637168;
  --panel: #fbfcf8;
  --line: #d8ded6;
  --track: #214d3b;
  --accent: #ff6b35;
  --warning: #b45309;
  --danger: #b91c1c;
  --soft: #e3ebe3;
  --shadow: 0 24px 60px rgba(21, 31, 25, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 107, 53, 0.10), transparent 28%),
    linear-gradient(315deg, rgba(33, 77, 59, 0.16), transparent 38%),
    var(--bg);
  font-family: "Avenir Next", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.phone-frame {
  width: min(420px, 100%);
  height: min(860px, calc(100vh - 48px));
  min-height: 720px;
  background: var(--panel);
  border: 1px solid rgba(23, 33, 27, 0.12);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-rows: 42px 1fr 72px;
}

.status-bar,
.tab-bar {
  background: rgba(251, 252, 248, 0.94);
  backdrop-filter: blur(14px);
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.screen {
  overflow: auto;
  padding: 20px 18px 24px;
}

.tab-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.tab.active {
  color: var(--track);
  font-weight: 700;
}

.hero {
  padding: 20px;
  color: white;
  background: linear-gradient(135deg, #214d3b, #386f58);
  border-radius: 8px;
}

.hero p {
  color: rgba(255, 255, 255, 0.82);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.75);
}

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

h1 {
  font-size: 28px;
  line-height: 1.12;
  margin-bottom: 10px;
}

h2 {
  font-size: 22px;
  margin-bottom: 12px;
}

h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.stack {
  display: grid;
  gap: 14px;
}

.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.chip-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--track);
  background: var(--soft);
  font-size: 12px;
}

.button {
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  background: var(--track);
  color: white;
  font-weight: 700;
}

.button.secondary {
  background: var(--soft);
  color: var(--track);
}

.button.warning {
  background: #fff4e8;
  color: var(--warning);
}

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

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
  text-align: left;
}

.template-grid,
.day-grid {
  display: grid;
  gap: 10px;
}

.template-card,
.day-control {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
  text-align: left;
}

.template-card.active {
  border-color: var(--track);
  box-shadow: inset 0 0 0 1px var(--track);
}

.day-control {
  display: grid;
  gap: 10px;
}

.day-control.training {
  background: #f7fbf7;
}

.day-control.rest {
  background: #fffaf4;
}

.day-control p,
.template-card p {
  margin-bottom: 0;
}

.meta {
  font-size: 12px;
  color: var(--muted);
}

.status {
  color: var(--track);
  font-weight: 700;
}

.danger {
  color: var(--danger);
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
  background: rgba(12, 18, 14, 0.38);
  padding: 18px;
}

.modal-panel {
  width: min(420px, 100%);
  max-height: 82vh;
  overflow: auto;
  background: var(--panel);
  border-radius: 12px 12px 8px 8px;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
}

@media (max-width: 520px) {
  .app-shell {
    padding: 0;
  }

  .phone-frame {
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    border-radius: 0;
  }

  .action-grid {
    grid-template-columns: 1fr;
  }
}
