:root {
  --bg: #fbf6ef;
  --bg-2: #f3ece0;
  --ink: #2b2438;
  --muted: #6b6276;
  --line: #d9cfc0;
  --accent: #c24a6b;
  --accent-2: #7a4a8c;
  --good: #3f7d52;
  --warn: #b4622b;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43,36,56,.06), 0 8px 24px rgba(43,36,56,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  line-height: 1.55;
}
a { color: var(--accent-2); }
a:hover { color: var(--accent); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-radius: 12px;
}
.brand-text strong { font-size: 1.05rem; display: block; }
.brand-text small { color: var(--muted); font-size: .85rem; }
.topnav { display: flex; gap: 18px; }
.topnav a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
}
.topnav a:hover { background: rgba(122,74,140,.08); }

main { max-width: 1200px; margin: 0 auto; padding: 32px 24px 64px; }
section { margin-bottom: 56px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 2.2rem; letter-spacing: -0.02em; }
h2 { font-size: 1.6rem; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }

.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}
.hero-text h1 { margin-bottom: 16px; }
.hero-text p { color: var(--muted); max-width: 52ch; }
.hero-actions { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.hero-card {
  background: linear-gradient(135deg, #fff4e6, #f3e6ff);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  font-size: .95rem;
}
.card-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: #a83e5c; border-color: #a83e5c; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent-2); color: var(--accent-2); }
.btn.small { padding: 6px 12px; font-size: .85rem; border-radius: 8px; }

.layout {
  display: grid;
  grid-template-columns: 320px 1fr 280px;
  gap: 20px;
  align-items: start;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.panel h2 { font-size: 1.2rem; margin-bottom: 16px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; margin-bottom: 6px; font-size: .9rem; }
select, input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 1rem;
  color: var(--ink);
}
select:focus, input:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.seg { display: flex; gap: 6px; }
.seg-btn {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}
.seg-btn.active { background: var(--accent-2); color: #fff; border-color: var(--accent-2); }
.actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.tips { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--line); }
.tips h3 { font-size: .95rem; }
.tips ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: .9rem; }

.routine-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.routine-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.routine-list { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.exercise {
  display: grid;
  grid-template-columns: 60px 40px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.exercise .time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent-2);
}
.exercise .num {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: var(--bg);
  border-radius: 50%;
  font-size: .85rem;
  font-weight: 600;
}
.exercise .name { font-weight: 600; }
.exercise .desc { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.exercise .diff { font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--bg-2); color: var(--muted); }
.exercise .diff.medium { background: #fde7c2; color: var(--warn); }
.exercise .diff.hard { background: #f7d0d8; color: var(--accent); }
.exercise .controls { display: flex; gap: 4px; }
.exercise .controls button {
  width: 28px; height: 28px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: .9rem;
}
.exercise .controls button:hover { background: var(--bg); }
.exercise .remove { color: var(--accent); border-color: #f3c6d0; }

.empty {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
  background: #fff;
}
.total {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.total strong { font-size: 1.1rem; color: var(--accent-2); }

.side details {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}
.side details:last-child { border-bottom: 1px solid var(--line); }
.side summary { cursor: pointer; font-weight: 600; }
.side details p { color: var(--muted); font-size: .9rem; margin-top: 6px; }

.preset-grid, .saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.preset, .saved-card {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  color: var(--ink);
  transition: transform .05s ease, border-color .15s ease;
}
.preset:hover, .saved-card:hover { transform: translateY(-2px); border-color: var(--accent-2); }
.preset h3, .saved-card h3 { font-size: 1rem; margin-bottom: 6px; }
.preset p, .saved-card p { color: var(--muted); font-size: .9rem; }
.meta { display: inline-block; margin-top: 8px; font-size: .8rem; color: var(--accent-2); }
.saved-card .saved-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.saved-card .delete {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: .85rem;
}

.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.ref-grid article {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.ref-grid h3 { font-size: 1rem; color: var(--accent-2); }
.ref-grid p { color: var(--muted); font-size: .9rem; }

.about {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

.footer {
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 20px 28px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.footer nav { display: flex; gap: 16px; }
.footer nav a { color: var(--muted); text-decoration: none; font-size: .9rem; }
.footer nav a:hover { color: var(--accent-2); }

@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  h1 { font-size: 1.8rem; }
}
@media (max-width: 640px) {
  .topnav { display: none; }
  .exercise { grid-template-columns: 50px 1fr; }
  .exercise .num, .exercise .diff, .exercise .controls { grid-column: span 2; justify-self: start; }
  main { padding: 20px 16px 48px; }
  section { margin-bottom: 40px; }
}

@media print {
  body { background: #fff; }
  .topnav, .controls, .routine-actions, .actions, .footer, .about, #presets, #routines, #reference, .hero-card, .tips { display: none; }
  .layout { grid-template-columns: 1fr; }
  .exercise { break-inside: avoid; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
