/* ===== Terra Workout ===== */
:root {
  --coral: #E37B5B;
  --coral-dark: #C8634A;
  --white: #FFFFFF;
  --gray-50:  #FAFAFA;
  --gray-100: #F2F2F2;
  --gray-200: #E5E5E5;
  --gray-400: #BDBDBD;
  --gray-600: #6B6B6B;
  --gray-900: #1A1A1A;

  --radius-card: 18px;
  --shadow-card: 0 4px 14px rgba(0,0,0,0.12);
  --shadow-phone: 0 30px 60px rgba(0,0,0,0.25);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  background: linear-gradient(160deg, #2a2a2a 0%, #1a1a1a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-900);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ===== Phone Frame (desktop preview) ===== */
.phone {
  position: relative;
  width: min(390px, 100vw);
  height: min(844px, 100vh);
  background: var(--white);
  border-radius: 48px;
  border: 10px solid #111;
  overflow: hidden;
  box-shadow: var(--shadow-phone);
  display: flex;
  flex-direction: column;
}

@media (max-width: 420px) {
  body { background: var(--white); }
  .phone {
    width: 100vw; height: 100vh;
    border-radius: 0; border: none;
    box-shadow: none;
  }
}

/* ===== App layout ===== */
.app {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.app[hidden] { display: none; }

/* ===== App Header (coral background) ===== */
.app-header {
  background: var(--coral);
  padding: 55px 20px 22px;
  text-align: center;
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}
.app-header h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.back-btn {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.2);
  border: none;
  color: var(--white);
  font-size: 28px;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 700;
}

/* ===== Categories Grid ===== */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 14px;
  flex: 1;
}

.category-card {
  background: var(--white);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 0;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px 8px 14px;
  gap: 6px;
  transition: transform 0.12s ease;
}
.category-card:active { transform: scale(0.96); }

.category-card .emoji {
  font-size: 64px;
  line-height: 1;
}
.category-card .label {
  background: var(--coral);
  color: var(--white);
  text-align: center;
  padding: 8px 18px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.3px;
  border-radius: 8px;
  margin-top: 4px;
  min-width: 80%;
}

/* ===== Detail Screen ===== */
.detail .app-header { justify-content: flex-start; padding-left: 64px; }
.detail .app-header h1 { font-size: 30px; }

.exercise-list {
  list-style: none;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.exercise-item {
  background: var(--gray-50);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 4px solid var(--coral);
}
.exercise-item .name { font-weight: 700; font-size: 16px; color: var(--gray-900); }
.exercise-item .meta { font-size: 13px; color: var(--gray-600); margin-top: 2px; }
.exercise-item .badge {
  background: var(--coral);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
}

/* ===== Bottom Nav ===== */
.bottom-nav {
  display: flex;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: 8px 4px 18px;
  flex-shrink: 0;
}
.nav-item {
  flex: 1;
  background: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  border-radius: 12px;
  color: var(--gray-600);
  transition: color 0.15s;
}
.nav-item .nav-emoji {
  font-size: 26px;
  line-height: 1;
}
.nav-item .nav-label {
  font-size: 12px;
  font-weight: 600;
}
.nav-item.active {
  color: var(--coral);
}
.nav-item.active .nav-emoji { transform: scale(1.15); }
.nav-item:active { background: var(--gray-50); }