:root {
  --color-bg: #ffffff;
  --color-text: #222222;
  --color-muted: #666666;
  --color-accent: #2b6cb0;
  --color-border: #e2e2e2;
  --region-fill: #ececec;
  --region-fill-hover: #cfcfcf;
  --region-stroke: #9a9a9a;
  --decor-fill: #f6f6f6;
  --decor-stroke: #bbbbbb;
  --max-width: 960px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 16px 0;
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
}

.site-nav a {
  margin-left: 16px;
  color: var(--color-muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.site-nav a:hover { color: var(--color-accent); }

.hero {
  text-align: center;
  padding: 40px 0 20px;
}

.hero h1 { font-size: 1.9rem; margin-bottom: 8px; }
.hero p { color: var(--color-muted); }

.body-map-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 0 40px;
}

.body-map-wrap svg {
  max-width: 240px;
  width: 100%;
  height: auto;
}

#view-toggle {
  padding: 8px 18px;
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
}
#view-toggle:hover { background: #f2f2f2; }

.whole-body-btn {
  display: inline-block;
  margin-top: 4px;
  padding: 10px 22px;
  border: none;
  border-radius: 20px;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}
.whole-body-btn:hover { background: #1f4f85; }

.region {
  stroke: rgba(60, 50, 40, 0.35);
  stroke-width: 1.25;
  cursor: pointer;
  transition: fill 0.15s ease, stroke 0.15s ease, opacity 0.15s ease;
}
#body-front .region[data-region="shoulder"] { fill: url(#shoulderGrad); }
#body-front .region[data-region="chest"] { fill: url(#chestGrad); }
#body-front .region[data-region="arm"] { fill: url(#armGrad); }
#body-front .region[data-region="abs"] { fill: url(#absGrad); }
#body-front .region[data-region="thigh"] { fill: url(#thighGrad); }
#body-front .region[data-region="face"] { fill: url(#faceSkin); stroke: var(--decor-stroke); }

#body-back .region[data-region="back"] { fill: url(#backGrad); }
#body-back .region[data-region="arm"] { fill: url(#armGradBack); }
#body-back .region[data-region="side"] { fill: url(#sideGrad); }
#body-back .region[data-region="waist"] { fill: url(#waistGrad); }
#body-back .region[data-region="hip"] { fill: url(#hipGrad); }
#body-back .region[data-region="calf"] { fill: url(#calfGrad); }

.region:hover, .region.active {
  opacity: 0.75;
  stroke: var(--color-accent);
  stroke-width: 2;
}

.decor {
  stroke: var(--decor-stroke);
  stroke-width: 1;
  pointer-events: none;
}
#body-front .decor { fill: url(#skinBody); }
#body-back .decor { fill: url(#skinBodyBack); }

.face-decor {
  fill: url(#faceSkin);
  stroke: var(--decor-stroke);
  stroke-width: 1;
  pointer-events: none;
}

.trap-hint {
  fill: #dfa85e;
  opacity: 0.5;
  pointer-events: none;
}

.muscle-line {
  stroke: #ffffff;
  stroke-width: 1.25;
  stroke-linecap: round;
  opacity: 0.55;
  pointer-events: none;
  fill: none;
}

.skin-line {
  stroke: #999999;
  stroke-width: 1;
  stroke-linecap: round;
  opacity: 0.4;
  pointer-events: none;
  fill: none;
}

.region-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 0 0 50px;
}

.region-list a {
  padding: 8px 16px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  text-decoration: none;
  color: var(--color-text);
  font-size: 0.9rem;
}
.region-list a:hover { background: #f2f2f2; }

.intro-copy {
  max-width: 640px;
  margin: 0 auto 50px;
  padding: 0 20px;
  color: var(--color-muted);
}

.exercise-section {
  max-width: var(--max-width);
  margin: 0 auto 40px;
  padding: 0 20px;
}

.exercise-section h2 {
  border-left: 4px solid var(--color-accent);
  padding-left: 10px;
}

.video-embed {
  position: relative;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 16 / 9;
  margin: 16px 0;
}
.video-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.exercise-item {
  margin-bottom: 16px;
}
.exercise-item h3 {
  margin-bottom: 4px;
  font-size: 1.05rem;
}

.caution {
  background: #fff7e6;
  border: 1px solid #f0d9a0;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #7a5b00;
  max-width: var(--max-width);
  margin: 0 auto 40px;
}

.related-links {
  max-width: var(--max-width);
  margin: 0 auto 40px;
  padding: 0 20px;
}
.related-links a {
  margin-right: 12px;
  color: var(--color-accent);
}

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 20px 0;
  color: var(--color-muted);
  font-size: 0.85rem;
  text-align: center;
}
.site-footer a { color: var(--color-muted); }

@media (max-width: 600px) {
  .hero h1 { font-size: 1.5rem; }
}

/* Routine builder */
.rb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.rb-chip {
  padding: 10px 18px;
  border: 1.5px solid var(--color-accent);
  border-radius: 20px;
  background: #eef4fb;
  color: var(--color-accent);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.rb-chip:active { cursor: grabbing; }

.rb-chip-ghost {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0.85;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.rb-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: var(--max-width);
  margin: 0 auto 30px;
  padding: 0 20px;
}
@media (max-width: 700px) {
  .rb-columns { grid-template-columns: 1fr; }
}

.rb-column {
  border: 2px dashed var(--color-border);
  border-radius: 14px;
  padding: 16px;
  min-height: 160px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.rb-zone-active {
  background: #eef4fb;
  border-color: var(--color-accent);
}

.rb-column-title {
  margin-top: 0;
  border-left: 4px solid var(--color-accent);
  padding-left: 10px;
}

.rb-empty {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.rb-block {
  position: relative;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px 36px 14px 14px;
  margin-bottom: 12px;
}
.rb-block h4 {
  margin: 0 0 6px;
  font-size: 1rem;
  outline: none;
}
.rb-block p {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: var(--color-muted);
  outline: none;
}
.rb-block h4:focus, .rb-block p:focus {
  background: #fffbe6;
}

.rb-circles {
  display: flex;
  gap: 6px;
}
.rb-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--color-accent);
  background: #fff;
  cursor: pointer;
  padding: 0;
}
.rb-circle.checked { background: var(--color-accent); }

.rb-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: #f2f2f2;
  color: var(--color-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.rb-remove:hover { background: #e2e2e2; }

.rb-add-toggle {
  margin-top: 8px;
  padding: 8px 14px;
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  background: none;
  color: var(--color-muted);
  cursor: pointer;
  font-size: 0.85rem;
}

.rb-add-form {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rb-add-form input {
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.9rem;
}
.rb-add-form button {
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: var(--color-accent);
  color: #fff;
  cursor: pointer;
  align-self: flex-start;
}

.rb-reset {
  padding: 10px 18px;
  border: 1px solid #d97070;
  border-radius: 20px;
  background: #fff;
  color: #c0392b;
  cursor: pointer;
  font-size: 0.9rem;
}
.rb-reset:hover { background: #fdecea; }

.rb-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: #222;
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  max-width: 90vw;
  text-align: center;
}
.rb-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
