/* 99 STR - old-school gamer / RuneScape-inspired styling. Mobile-first: clients log workouts
   from their phones, so layout stacks to one column by default and widens on larger screens. */

:root {
  --bg: #14100c;
  --panel-bg: #1f1912;
  --panel-border: #8b6914;
  --gold: #d4af37;
  --gold-bright: #ffd700;
  --text: #e8dcc0;
  --text-dim: #a89878;
  --danger: #c0392b;
  --xp-fill: linear-gradient(90deg, #6b8e23, #9acd32);
}

* { box-sizing: border-box; min-width: 0; }

html, body {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(circle at 50% 0%, #2a2118 0%, #14100c 70%);
  color: var(--text);
  font-family: "VT323", monospace;
  font-size: 20px;
  line-height: 1.4;
}

.rs-title {
  font-family: "Press Start 2P", monospace;
  color: var(--gold-bright);
  text-shadow: 2px 2px 0 #000;
  font-size: 1.3rem;
  letter-spacing: 1px;
  margin: 0 0 0.75em 0;
  overflow-wrap: break-word;
}
.rs-title.small { font-size: 0.9rem; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75em 1em;
  background: #0c0a07;
  border-bottom: 3px solid var(--panel-border);
  flex-wrap: wrap;
  gap: 0.5em;
}
.brand {
  font-family: "Press Start 2P", monospace;
  color: var(--gold-bright);
  text-decoration: none;
  font-size: 1rem;
}
.topbar nav { display: flex; align-items: center; gap: 1em; }
.topbar nav a { color: var(--text); text-decoration: none; font-size: 1.1rem; }
.topbar nav a:hover { color: var(--gold-bright); }
.logout-form { display: inline; margin: 0; }
.logout-form button {
  background: none; border: none; color: var(--text-dim); font-family: inherit;
  font-size: 1.1rem; cursor: pointer; padding: 0;
}
.logout-form button:hover { color: var(--danger); }

.content { max-width: 640px; margin: 0 auto; padding: 1em; }

.panel {
  background: var(--panel-bg);
  border: 3px solid var(--panel-border);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px #4a3a1a, 0 4px 10px rgba(0,0,0,0.5);
  padding: 1em;
  margin-bottom: 1em;
}

.login-panel { max-width: 360px; margin: 3em auto; text-align: center; }

.stack { display: flex; flex-direction: column; gap: 0.9em; }
label { display: flex; flex-direction: column; gap: 0.3em; font-size: 1rem; color: var(--text-dim); }
input, select, textarea {
  background: #0c0a07;
  border: 2px solid var(--panel-border);
  color: var(--text);
  font-family: "VT323", monospace;
  font-size: 1.1rem;
  padding: 0.5em;
  border-radius: 3px;
  width: 100%;
  max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-bright); }
textarea { resize: vertical; }
input[type="radio"], input[type="checkbox"] { width: auto; }

fieldset { border: 1px solid var(--panel-border); border-radius: 3px; padding: 0.6em 0.8em; margin: 0; }
fieldset legend { color: var(--text-dim); font-size: 0.95rem; padding: 0 0.3em; }
fieldset label { flex-direction: row; align-items: center; gap: 0.4em; display: inline-flex; margin-right: 1.2em; color: var(--text); }

.rs-button {
  font-family: "Press Start 2P", monospace;
  font-size: 0.8rem;
  color: #1a1400;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border: 2px solid #7a5c00;
  border-radius: 4px;
  padding: 0.9em 1em;
  cursor: pointer;
  text-shadow: none;
}
.rs-button:active { transform: translateY(1px); }
a.rs-button { display: inline-block; text-decoration: none; }
.submit-button { width: 100%; margin-top: 0.5em; }

.error-banner { color: var(--danger); font-size: 1.1rem; }

.stats-panel { display: flex; flex-direction: column; gap: 0.6em; }
.stat-block { display: flex; justify-content: space-between; align-items: baseline; }
.level-tag {
  font-family: "Press Start 2P", monospace;
  color: var(--gold-bright);
  font-size: 0.9rem;
}
.xp-bar { height: 18px; background: #0c0a07; border: 2px solid var(--panel-border); border-radius: 3px; overflow: hidden; }
.xp-bar-fill { height: 100%; background: var(--xp-fill); transition: width 0.3s ease; }
.stat-row { display: flex; justify-content: space-between; color: var(--text-dim); font-size: 1rem; }
.xp-to-next-row { margin-top: 0.2em; font-size: 0.85rem; }

.level-up-banner {
  font-family: "Press Start 2P", monospace;
  text-align: center;
  color: var(--gold-bright);
  background: #241b0c;
  border: 3px solid var(--gold-bright);
  border-radius: 4px;
  padding: 1em;
  margin-bottom: 1em;
  font-size: 0.9rem;
  line-height: 1.8;
  animation: glow 1.4s ease-in-out infinite alternate;
}
@keyframes glow {
  from { box-shadow: 0 0 6px var(--gold); }
  to { box-shadow: 0 0 18px var(--gold-bright); }
}
.xp-flash { text-align: center; color: #9acd32; font-size: 1.2rem; margin-bottom: 1em; }

.muted { color: var(--text-dim); font-size: 0.9rem; }

.exercise-row {
  border: 2px solid #3a2e18;
  border-radius: 4px;
  padding: 0.75em;
  margin-bottom: 0.75em;
  background: #17130d;
}
.exercise-row.deload { border-color: var(--danger); }
.exercise-image {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: #0c0a07;
  border: 2px solid #3a2e18;
  border-radius: 3px;
  margin-bottom: 0.6em;
}
.exercise-head { display: flex; align-items: center; gap: 0.6em; flex-wrap: wrap; }
.exercise-select { flex: 1; min-width: 0; font-size: 1.1rem; }

.xp-category-label { display: flex; align-items: center; gap: 0.4em; font-size: 0.85rem; margin: 0.3em 0; }
.xp-category-select { width: auto; font-size: 0.85rem; padding: 0.15em 0.3em; }

.slot-search { margin: 0.4em 0; }
.slot-search-toggle {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: "VT323", monospace;
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  width: auto;
}
.slot-search-toggle:hover { color: var(--gold); }
.slot-search-panel { margin-top: 0.4em; display: flex; flex-direction: column; gap: 0.4em; }
.slot-search-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.slot-search-input { font-size: 1rem; }
.deload-tag {
  font-family: "Press Start 2P", monospace;
  font-size: 0.6rem;
  color: #fff;
  background: var(--danger);
  padding: 0.3em 0.5em;
  border-radius: 3px;
}
.target-line { color: var(--text-dim); font-size: 1rem; margin: 0.4em 0; }

.rename-day { margin-bottom: 0.6em; }
.rename-day-toggle {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: "VT323", monospace;
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  width: auto;
}
.rename-day-toggle:hover { color: var(--gold); }
.rename-day-form { margin-top: 0.4em; display: flex; gap: 0.4em; align-items: center; flex-wrap: wrap; }
.rename-day-form input[type="text"] { flex: 1; min-width: 0; font-size: 1rem; width: auto; }
.rename-day-form button { width: auto; }
.rir-help {
  display: inline-block;
  width: 1.4em; height: 1.4em;
  text-align: center;
  border: 1px solid var(--text-dim);
  border-radius: 50%;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-dim);
  background: none;
  padding: 0;
  font-family: "VT323", monospace;
}
.rir-help:hover { color: var(--gold); border-color: var(--gold); }
.rir-explanation { display: block; font-size: 0.85rem; margin-top: 0.2em; }
.done-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5em; }

.exclude-btn {
  flex: 0 0 auto;
  background: #2a1610;
  border: 2px solid var(--danger);
  color: var(--text);
  font-size: 1.1rem;
  padding: 0.4em 0.6em;
  border-radius: 3px;
  cursor: pointer;
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}
.exclude-btn:hover { background: var(--danger); }
/* Visible label alongside the emoji - the old title="..." tooltip explaining this button never
   fires on a tap/touch device (same class of bug as the RIR fix, 2026-08-03), and this one
   performs a real (if reversible-via-coach) action with no confirm step, so it needs to be
   understood BEFORE the tap, not just after - a tap-to-reveal-then-tap-again pattern doesn't fit. */
.exclude-btn-label { font-size: 0.75rem; font-family: "VT323", monospace; }

.cardio-panel { margin-top: 1.2em; padding-top: 1em; border-top: 2px solid var(--panel-border); }
.cardio-panel .cardio-log-form { margin-bottom: 1em; }
.cardio-panel .steps-log-form { padding-top: 0.9em; border-top: 1px solid var(--panel-border); }

.mystery-box {
  border-style: dashed;
  border-color: var(--gold);
  text-align: center;
}
.mystery-box .exercise-head { justify-content: space-between; }
.mystery-label { color: var(--gold); font-size: 1rem; }
.mystery-roll-btn {
  width: auto;
  padding: 0.5em 0.9em;
  font-size: 1rem;
}
.mystery-result { margin-top: 0.6em; text-align: left; }
#mystery-name { color: var(--gold-bright); font-size: 1.1rem; }

.leaderboard { width: 100%; border-collapse: collapse; font-size: 1rem; }
.leaderboard th { text-align: left; color: var(--gold); border-bottom: 2px solid var(--panel-border); padding: 0.4em; }
.leaderboard td { padding: 0.4em; border-bottom: 1px solid #3a2e18; }
.leaderboard tr.me { background: #241b0c; }
.leaderboard tr.me td:nth-child(2) { color: var(--gold-bright); }
.level-inline { color: var(--text-dim); font-size: 0.85em; }

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 0.7em;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.2em;
  margin-bottom: 0.8em;
}
.chat-message { background: #17130d; border: 1px solid #3a2e18; border-radius: 3px; padding: 0.5em 0.7em; }
.chat-message.me { border-color: var(--gold); background: #211a0d; }
.chat-message-head { display: flex; align-items: baseline; gap: 0.5em; }
.chat-sender { color: var(--gold-bright); font-weight: bold; }
.chat-time { font-size: 0.75rem; }
.chat-message-body { margin-top: 0.2em; word-break: break-word; white-space: pre-wrap; }
.chat-delete-form { margin-left: auto; }
.chat-delete-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 0.2em;
}
.chat-delete-btn:hover { color: var(--danger); }
.chat-send-form { display: flex; gap: 0.5em; }
.chat-send-form input[type="text"] {
  flex: 1;
  background: #17130d;
  border: 1px solid var(--panel-border);
  border-radius: 3px;
  color: var(--text);
  padding: 0.6em;
  font-family: inherit;
}
.chat-send-form button { width: auto; }

.waiver-text { display: flex; flex-direction: column; gap: 0.8em; margin-bottom: 1em; line-height: 1.4; }
.waiver-disclaimer { font-size: 0.8rem; font-style: italic; margin-top: 1em; }

.shop-coming-soon { text-align: center; padding: 3em 1em; }

.skills-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6em; }
.skill-block { display: flex; flex-direction: column; gap: 0.3em; background: #17130d; border: 1px solid #3a2e18; border-radius: 3px; padding: 0.5em; }
.skill-block.skill-leveled-up { border-color: var(--gold-bright); }
.skill-icon {
  align-self: center;
  font-size: 1.6rem;
  line-height: 1;
  width: 2.2em;
  height: 2.2em;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0c0a07;
  border: 2px solid var(--gold);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px #4a3a1a;
}
.skill-name { color: var(--text-dim); font-size: 0.85rem; text-align: center; }
.skill-level { font-family: "Press Start 2P", monospace; color: var(--gold-bright); font-size: 0.9rem; text-align: center; }
.skill-xp-bar { height: 8px; }

.macro-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8em; }
.macro-summary > div { display: flex; flex-direction: column; background: #17130d; border: 1px solid #3a2e18; border-radius: 3px; padding: 0.6em; }
.macro-label { color: var(--text-dim); font-size: 0.9rem; }
.macro-value { color: var(--gold-bright); font-size: 1.4rem; }

.meal-block { border-bottom: 1px solid #3a2e18; padding: 0.6em 0; }
.meal-block:last-child { border-bottom: none; }
.meal-head { color: var(--gold); }
.meal-macros { color: var(--text-dim); font-size: 0.95rem; }
.meal-macros.meal-logged { color: var(--gold-bright); }
.meal-spacing-note { font-size: 0.9rem; margin-top: -0.3em; margin-bottom: 0.8em; }
.intra-workout-toggle { margin-bottom: 0.8em; }
.intra-workout-toggle label { display: flex; align-items: center; gap: 0.5em; cursor: pointer; }
.intra-workout-toggle input[type="checkbox"] { width: auto; }
.intra-workout-toggle .meal-spacing-note { margin-top: 0.3em; }
.food-idea { font-size: 0.9rem; color: var(--text-dim); margin-top: 0.2em; }

.diary-totals { margin-bottom: 0.8em; }
.diary-totals .macro-value { font-size: 1.1rem; }
.diary-day-nav { display: flex; align-items: center; justify-content: space-between; gap: 0.5em; margin-bottom: 0.6em; flex-wrap: wrap; }

.food-search-box { display: flex; flex-direction: column; gap: 0.5em; margin-bottom: 0.6em; }
.food-search-results { display: flex; flex-direction: column; gap: 0.3em; }
.food-result-btn {
  text-align: left;
  background: #17130d;
  border: 1px solid #3a2e18;
  color: var(--text);
  font-family: "VT323", monospace;
  font-size: 1rem;
  padding: 0.5em;
  border-radius: 3px;
  cursor: pointer;
  width: 100%;
}
.food-result-btn:hover { border-color: var(--gold); }

.scanner-container { margin-bottom: 0.8em; text-align: center; }
#scanner-view { max-width: 100%; margin: 0 auto; }

.log-amount-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 0.6em; }

.diary-entries { margin-top: 0.8em; border-top: 2px solid var(--panel-border); padding-top: 0.6em; }
.diary-entry { font-size: 0.95rem; color: var(--text-dim); padding: 0.2em 0; }
.invite-link { font-family: "VT323", monospace; color: var(--gold); word-break: break-all; }

.progress-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.6em;
  margin-top: 0.8em;
}
.progress-photo-item img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 2px solid #3a2e18;
  border-radius: 3px;
  background: #0c0a07;
}
.progress-photo-caption { font-size: 0.75rem; margin-top: 0.2em; text-align: center; }

.admin-client-list { display: flex; flex-direction: column; gap: 0.4em; }
.admin-client-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5em;
  background: #17130d;
  border: 1px solid #3a2e18;
  color: var(--gold-bright);
  text-decoration: none;
  font-size: 1.2rem;
  padding: 0.6em;
  border-radius: 3px;
}
.admin-client-link:hover { border-color: var(--gold); }
.admin-client-link.needs-attention { border-color: var(--danger); }
.admin-client-active { font-size: 0.85rem; }
.attention-tag {
  font-family: "Press Start 2P", monospace;
  font-size: 0.55rem;
  color: #fff;
  background: var(--danger);
  padding: 0.3em 0.5em;
  border-radius: 3px;
}
.admin-swap-row, .admin-add-row { border-style: dashed; }

@media (min-width: 640px) {
  .content { padding: 2em 1em; }
  body { font-size: 21px; }
}
