@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #17100b;
  --panel: #21170f;
  --panel-light: #2b1e13;
  --gold: #c9a45c;
  --gold-light: #ecd49b;
  --gold-dark: #80602d;
  --text: #f4ead9;
  --muted: #9c8b75;
  --line: rgba(201,164,92,.22);
  --green: #91ad78;
  --danger: #bd766b;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  background: #100b07;
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #100b07;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
}

button, input, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  width: 100%;
  max-width: 460px;
  min-height: 100dvh;
  margin: 0 auto;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(119,78,32,.15), transparent 48%),
    var(--bg);
  border-left: 1px solid rgba(201,164,92,.08);
  border-right: 1px solid rgba(201,164,92,.08);
  overflow: hidden;
}

.topbar {
  height: 76px;
  padding: 13px 21px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(23,16,11,.95);
}

.eyebrow {
  display: block;
  color: var(--gold);
  font-size: 9px;
  letter-spacing: 2px;
  font-weight: 700;
}

.brand-name {
  margin-top: 3px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 25px;
}

.brand-name span,
.page-intro h1 span,
.hero-copy h1 span {
  color: var(--gold-light);
}

.top-seal {
  width: 39px;
  height: 39px;
  border: 1px solid var(--gold-dark);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--gold-light);
  font-family: 'Cormorant Garamond', serif;
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 0 18px rgba(201,164,92,.1);
}

.main-content {
  padding: 19px 17px 112px;
}

.screen {
  display: none;
  animation: screen-in .24s ease-out;
}

.screen.active {
  display: block;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

/* HERO 3D */

.hero-card {
  position: relative;
  height: 235px;
  overflow: hidden;
  border: 1px solid rgba(201,164,92,.4);
  border-radius: 7px;
  background:
    radial-gradient(ellipse at 74% 48%, rgba(164,111,40,.25), transparent 45%),
    linear-gradient(135deg, #382617, #1b120c 60%, #120d09);
  box-shadow: 0 15px 38px rgba(0,0,0,.24);
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(201,164,92,.15);
  pointer-events: none;
}

.hero-copy {
  position: absolute;
  z-index: 2;
  left: 18px;
  top: 27px;
  width: 58%;
  pointer-events: none;
}

.hero-copy h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 31px;
  line-height: .98;
  margin: 13px 0 10px;
  font-weight: 600;
}

.hero-copy p {
  color: #c1ac8d;
  font-size: 11px;
}

.scene3d {
  position: absolute;
  right: -7px;
  top: 5px;
  width: 58%;
  height: 190px;
  z-index: 1;
}

.scene3d canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.hero-bottom {
  position: absolute;
  z-index: 3;
  bottom: 12px;
  left: 18px;
  right: 18px;
  display: flex;
  justify-content: space-between;
  color: var(--gold);
  font-size: 8px;
  letter-spacing: 2px;
  pointer-events: none;
}

/* HEADINGS */

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 27px 2px 13px;
}

.section-heading h2,
.calendar-header h2 {
  margin: 4px 0 0;
  font-family: 'Cormorant Garamond', serif;
  font-size: 25px;
  font-weight: 600;
}

.live-dot {
  width: 7px;
  height: 7px;
  margin-right: 5px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--green);
}

.text-button {
  color: var(--gold-light);
  background: transparent;
  border: 0;
  font-size: 11px;
}

/* STATS */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.stat-card {
  min-width: 0;
  padding: 13px 10px;
  background: linear-gradient(145deg, #2b1e13, #20160f);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.stat-icon {
  display: block;
  color: var(--gold);
  font-size: 17px;
  margin-bottom: 9px;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 1px;
}

.stat-card strong {
  display: block;
  color: var(--gold-light);
  font-family: 'Cormorant Garamond', serif;
  font-size: 29px;
  font-weight: 600;
  margin-top: 3px;
}

.stat-card small {
  color: var(--muted);
  font-size: 9px;
}

/* PANELS AND FORMS */

.royal-panel {
  padding: 17px;
  background: linear-gradient(145deg, #291d13, #1e150f);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.royal-panel label {
  display: block;
  margin: 16px 0 8px;
  color: #d8c5a5;
  font-size: 11px;
  font-weight: 600;
}

.royal-panel label:first-child {
  margin-top: 0;
}

.royal-panel input,
.royal-panel textarea {
  width: 100%;
  color: var(--text);
  background: #17100b;
  border: 1px solid rgba(201,164,92,.2);
  border-radius: 4px;
  padding: 12px;
  outline: none;
  font-size: 12px;
  resize: vertical;
}

.royal-panel input:focus,
.royal-panel textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,164,92,.08);
}

.royal-panel input::placeholder,
.royal-panel textarea::placeholder {
  color: #756653;
}

.royal-panel input[type="date"] {
  color-scheme: dark;
}

.muscle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.muscle-option {
  min-height: 39px;
  padding: 7px 4px;
  color: #c4b39a;
  background: #19110c;
  border: 1px solid rgba(201,164,92,.19);
  border-radius: 4px;
  font-size: 10px;
  transition: .2s;
}

.muscle-option.selected {
  color: #21170f;
  font-weight: 700;
  border-color: var(--gold);
  background: linear-gradient(135deg, #ecd49b, #b58a43);
  box-shadow: 0 3px 13px rgba(201,164,92,.12);
}

.gold-button {
  width: 100%;
  min-height: 47px;
  margin-top: 18px;
  color: #24190d;
  background: linear-gradient(110deg, #b88b43, #ecd49b, #b88b43);
  border: 1px solid #f0d9a6;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.4px;
  box-shadow: 0 5px 16px rgba(0,0,0,.2);
}

.gold-button:active {
  transform: scale(.985);
}

.gold-button span {
  font-size: 17px;
  vertical-align: -2px;
  margin-right: 5px;
}

.form-feedback {
  min-height: 14px;
  margin: 9px 0 0;
  color: var(--green);
  font-size: 10px;
  text-align: center;
}

/* SESSION LIST */

.session-list,
.journal-list {
  display: grid;
  gap: 9px;
}

.session-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  background: #21170f;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.session-mark {
  width: 37px;
  height: 37px;
  flex: 0 0 37px;
  display: grid;
  place-items: center;
  color: var(--gold-light);
  border: 1px solid var(--gold-dark);
  font-family: 'Cormorant Garamond', serif;
  font-size: 19px;
}

.session-info {
  min-width: 0;
  flex: 1;
}

.session-info strong {
  display: block;
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 600;
}

.session-info small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  font-size: 10px;
}

.session-duration {
  color: var(--gold-light);
  font-size: 11px;
  white-space: nowrap;
}

.delete-button {
  width: 27px;
  height: 27px;
  color: var(--danger);
  background: transparent;
  border: 1px solid rgba(189,118,107,.25);
  border-radius: 3px;
  font-size: 13px;
}

.empty-state {
  padding: 24px 14px;
  color: var(--muted);
  border: 1px dashed var(--line);
  text-align: center;
  font-size: 11px;
  line-height: 1.7;
}

/* JOURNAL */

.page-intro {
  padding: 12px 3px 19px;
}

.page-intro h1 {
  margin: 7px 0;
  font-family: 'Cormorant Garamond', serif;
  font-size: 35px;
  font-weight: 600;
}

.page-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.date-display {
  margin-bottom: 12px;
  color: var(--gold-light);
  font-family: 'Cormorant Garamond', serif;
  font-size: 19px;
}

.journal-panel textarea {
  line-height: 1.7;
}

.journal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
}

.journal-footer span {
  color: var(--muted);
  font-size: 10px;
}

.journal-footer .gold-button {
  width: auto;
  min-width: 130px;
  margin: 0;
  padding: 0 15px;
}

.journal-entry {
  padding: 14px;
  background: #21170f;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.journal-entry strong {
  display: block;
  color: var(--gold-light);
  font-family: 'Cormorant Garamond', serif;
  font-size: 19px;
}

.journal-entry small {
  display: block;
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 9px;
}

.journal-entry p {
  margin: 0;
  color: #c9b99f;
  font-size: 11px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.journal-entry-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.small-action {
  color: var(--gold-light);
  background: transparent;
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 3px;
  font-size: 9px;
}

/* HISTORY */

.history-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 16px;
}

.history-summary > div {
  padding: 15px;
  background: linear-gradient(145deg, #302116, #21160e);
  border: 1px solid var(--line);
}

.history-summary strong {
  display: block;
  margin-top: 7px;
  color: var(--gold-light);
  font-family: 'Cormorant Garamond', serif;
  font-size: 29px;
}

.calendar-panel {
  padding: 15px 12px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.calendar-header h2 {
  font-size: 22px;
  text-transform: capitalize;
}

.calendar-arrow {
  width: 32px;
  height: 32px;
  color: var(--gold-light);
  background: #17100b;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 23px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  text-align: center;
}

.calendar-weekdays {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 9px;
}

.calendar-day {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: #d4c4ac;
  background: #19110c;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 11px;
}

.calendar-day.has-session::after {
  content: "";
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
}

.calendar-day.today {
  border-color: var(--gold-dark);
}

.calendar-day.selected {
  color: #21170f;
  background: var(--gold-light);
  font-weight: 800;
}

.calendar-day.selected::after {
  background: #513817;
}

.calendar-day:disabled {
  opacity: .2;
  cursor: default;
}

.calendar-legend {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 9px;
}

.calendar-legend span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

/* NAVIGATION */

.bottom-nav {
  position: fixed;
  z-index: 20;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 460px;
  min-height: 73px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(25,17,11,.97);
  border-top: 1px solid rgba(201,164,92,.3);
  backdrop-filter: blur(16px);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #877660;
  background: transparent;
  border: 0;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1px;
}

.nav-symbol {
  font-size: 20px;
  line-height: 1.2;
}

.nav-item.active {
  color: var(--gold-light);
}

.nav-item.active .nav-symbol {
  text-shadow: 0 0 13px rgba(236,212,155,.5);
}

/* RESPONSIVE */

@media (min-width: 600px) {
  body {
    padding: 20px 0;
  }

  .app-shell {
    min-height: calc(100dvh - 40px);
    border-radius: 12px;
    border: 1px solid var(--line);
  }

  .bottom-nav {
    bottom: 20px;
    border-radius: 0 0 12px 12px;
  }
}

@media (max-width: 350px) {
  .main-content {
    padding-left: 12px;
    padding-right: 12px;
  }

  .muscle-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-copy h1 {
    font-size: 26px;
  }
}