:root {
  --bg: #020305;
  --bg-soft: #0a0b0f;
  --card: linear-gradient(180deg, rgba(40, 40, 46, 0.98), rgba(27, 28, 33, 0.98));
  --card-soft: linear-gradient(180deg, rgba(34, 35, 42, 0.94), rgba(21, 22, 28, 0.96));
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f5f5f7;
  --muted: #8f9199;
  --gold: #d0a528;
  --blue: #3fa2ff;
  --shadow: 0 22px 44px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.03), transparent 22%), #121212;
  color: var(--text);
  font-family: "SF Pro Display", "Segoe UI", sans-serif;
}

body {
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.device-shell {
  width: min(100%, 390px);
  position: relative;
}

.screen-glow {
  position: absolute;
  inset: 18px;
  border-radius: 34px;
  background: radial-gradient(circle at top right, rgba(63, 162, 255, 0.09), transparent 26%),
    radial-gradient(circle at bottom left, rgba(208, 165, 40, 0.08), transparent 24%);
  filter: blur(14px);
}

.app-shell {
  position: relative;
  min-height: 760px;
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(4, 4, 6, 0.99), rgba(9, 9, 12, 0.995));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 10px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
}

h2 {
  font-size: 16px;
  font-weight: 600;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font-size: 38px;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
}

.icon-btn.subtle {
  font-size: 28px;
  background: rgba(255, 255, 255, 0.03);
}

.content {
  padding: 0 18px 92px;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.ghost-title {
  color: rgba(255, 255, 255, 0.18);
  font-size: 19px;
  font-weight: 600;
}

.hero-row,
.section-title,
.records-toolbar,
.profile-line,
.exercise-row,
.record-main,
.counter-line,
.modal-head {
  display: flex;
  align-items: center;
}

.hero-row,
.records-toolbar,
.modal-head {
  justify-content: space-between;
}

.hero-row {
  margin: 2px 0 14px;
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 18px;
  font-weight: 700;
}

.fire {
  font-size: 18px;
}

.action-card,
.profile-card,
.note-card,
.history-card,
.record-card,
.faq-card,
.field-card,
.metrics-card,
.date-card,
.result-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.action-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  margin-bottom: 10px;
}

.action-card.primary {
  background: linear-gradient(180deg, rgba(51, 52, 59, 0.98), rgba(34, 35, 41, 0.98));
}

.action-card.secondary {
  background: var(--card-soft);
}

.plus {
  font-size: 28px;
  line-height: 1;
  font-weight: 300;
}

.note-card {
  min-height: 180px;
  padding: 12px;
}

.note-label,
.field-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

#wellbeing-note,
.field-card input,
.metric-big input {
  width: 100%;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--text);
}

#wellbeing-note {
  min-height: 128px;
}

.panel-stack,
.list-stack {
  display: grid;
  gap: 10px;
}

.profile-card {
  padding: 16px;
  margin-bottom: 12px;
}

.profile-card h2 {
  margin-bottom: 12px;
  font-size: 18px;
}

.profile-list {
  display: grid;
  gap: 6px;
}

.profile-line {
  justify-content: space-between;
  gap: 12px;
  color: #dadce2;
}

.profile-line span {
  color: var(--muted);
}

.section-block {
  margin-top: 4px;
}

.section-title {
  justify-content: space-between;
  padding: 0 4px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 10px;
}

.history-card {
  padding: 10px 12px;
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.history-main {
  font-size: 15px;
  font-weight: 600;
}

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

.exercise-list {
  display: grid;
  gap: 8px;
}

.exercise-row {
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}

.exercise-row span:last-child {
  color: #dcdde1;
  white-space: nowrap;
}

.records-toolbar {
  margin: 6px 0 14px;
}

.round-tool {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: transparent;
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 14px;
}

.record-card {
  padding: 12px 14px;
  border-radius: 9px;
  border-color: rgba(255, 255, 255, 0.07);
}

.record-card.highlight {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.record-main {
  justify-content: space-between;
  gap: 12px;
}

.record-title {
  font-size: 18px;
  font-weight: 600;
}

.record-weight {
  font-size: 20px;
  font-weight: 700;
}

.record-date {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.search-shell {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-soft);
  padding: 10px 12px;
  margin-bottom: 10px;
}

#faq-search {
  width: 100%;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.chip {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: #d8d9de;
  padding: 8px 10px;
}

.chip.active {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
}

.faq-card {
  padding: 12px 14px;
}

.faq-card summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
}

.faq-card summary::-webkit-details-marker {
  display: none;
}

.faq-card p {
  margin-top: 10px;
  color: #d3d4da;
  font-size: 14px;
  line-height: 1.45;
}

.bottom-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(21, 17, 16, 0.92), rgba(17, 13, 12, 0.96));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.nav-btn {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.32);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
}

.nav-btn.active {
  color: var(--text);
}

.nav-btn[data-tab="records"].active {
  color: var(--gold);
}

.nav-icon {
  font-size: 17px;
}

.nav-label {
  font-size: 10px;
}

.workout-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 50;
}

.workout-modal {
  width: min(100%, 390px);
  min-height: 620px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(4, 4, 6, 0.995), rgba(12, 12, 16, 0.99));
  box-shadow: var(--shadow);
  padding: 16px 16px 20px;
}

.modal-head {
  margin-bottom: 14px;
}

#modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-step {
  display: none;
}

.modal-step.active {
  display: block;
}

.draft-list {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.draft-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-height: 52px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--card-soft);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.draft-item.empty {
  justify-content: center;
  color: var(--muted);
}

.draft-title {
  font-size: 14px;
  font-weight: 600;
}

.draft-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.field-card,
.metrics-card,
.date-card,
.result-card {
  padding: 14px;
  margin-bottom: 12px;
}

.field-card input,
.metric-big input {
  font-size: 18px;
}

.metric-big {
  margin-bottom: 12px;
}

.counter-line {
  justify-content: space-between;
  padding: 8px 0;
}

.counter-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.counter-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.date-preview {
  width: 100%;
  border-radius: 10px;
  min-height: 48px;
  display: grid;
  place-items: center;
  margin: 12px 0 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

#workout-date-input {
  width: 100%;
  background: transparent;
  color: var(--text);
  border: 0;
}

.result-card {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 8px;
}

.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 22, 28, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  z-index: 100;
}

@media (max-width: 420px) {
  body {
    padding: 0;
  }

  .device-shell {
    width: 100%;
  }

  .app-shell {
    min-height: 100vh;
    border-radius: 0;
  }

  .workout-modal {
    min-height: calc(100vh - 24px);
  }
}
