:root {
  --bg: #0b0d10;
  --panel: #15181d;
  --panel-2: #1d2229;
  --panel-3: #101318;
  --border: #343b45;
  --text: #f2f4f6;
  --muted: #9ca5af;
  --silver: #cfd5dc;
  --silver-dark: #9ca5af;
  --accent: #e5e9ed;
  --good: #72d68a;
  --warning: #efc56e;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
  --radius: 18px;
  --max: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.07) 0%, transparent 32%),
    radial-gradient(circle at 85% 12%, rgba(207, 213, 220, 0.06) 0%, transparent 34%),
    linear-gradient(180deg, #080a0d 0%, #101317 55%, #0b0d10 100%);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(8, 10, 13, 0.82);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  overflow: hidden;
}

.brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  line-height: 1;
  min-width: 0;
  max-width: 100%;
}

.brand strong {
  display: block;
  max-width: 100%;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 1.04rem;
  overflow-wrap: anywhere;
}

.brand span {
  display: block;
  max-width: 100%;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.nav-link,
.nav-share {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  white-space: nowrap;
}

.nav-share {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.nav-link:hover,
.nav-share:hover {
  color: var(--text);
}

main {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  padding: 48px 0 22px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid rgba(207, 213, 220, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 18px;
}

.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--good);
  box-shadow: 0 0 14px rgba(114, 214, 138, 0.5);
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 0.9;
  letter-spacing: -0.06em;
  text-transform: uppercase;
}

.hero-lead {
  margin: 20px 0 0;
  max-width: 720px;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.55;
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  gap: 18px;
  align-items: start;
  padding: 24px 0 52px;
}

.panel {
  min-width: 0;
  padding: 22px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 100%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  letter-spacing: -0.035em;
  text-transform: uppercase;
}

.panel-head p,
.helper-text {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.form-grid,
.custom-time {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--silver);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #101317;
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--silver);
}

.subsection {
  margin-top: 18px;
}

.subsection.compact {
  margin-top: 14px;
}

.subsection h3,
.settings-section h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.quick-plate-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.segment-btn,
.collar-btn,
.plate-toggle,
.time-preset {
  min-height: 42px;
  padding: 10px 13px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.segment-btn.active,
.collar-btn.active,
.plate-toggle.active,
.time-preset.active {
  background: linear-gradient(180deg, var(--silver) 0%, var(--silver-dark) 100%);
  color: #101317;
  border-color: transparent;
}

.plate-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 22px;
}

.result-card {
  margin-top: 22px;
  padding: 18px;
  border-radius: 18px;
  background: #101317;
  border: 1px solid var(--border);
}

.result-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.result-label {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

#loadedWeight {
  font-size: 2rem;
  line-height: 1;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(114, 214, 138, 0.13);
  color: #a4efb5;
  border: 1px solid rgba(114, 214, 138, 0.28);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.status-pill.warning {
  background: rgba(239, 197, 110, 0.13);
  color: #efc56e;
  border-color: rgba(239, 197, 110, 0.28);
}

.rounding-note {
  min-height: 1.4em;
  margin: 0 0 14px;
  color: var(--warning);
  line-height: 1.45;
}

.barbell-wrap {
  overflow: hidden;
  width: 100%;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 14px;
}

.barbell {
  height: 196px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.bar-shaft {
  width: 96px;
  height: 16px;
  flex: 0 1 96px;
  border-radius: 999px;
  background: linear-gradient(180deg, #d8dde2 0%, #6c747e 45%, #4e5660 55%, #dfe3e7 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.5);
  border-bottom: 1px solid rgba(0, 0, 0, 0.55);
}

.bar-sleeve,
.bar-sleeve-end {
  height: 24px;
  flex: 0 0 40px;
  border-radius: 2px;
  background: linear-gradient(180deg, #eef1f4 0%, #a6afb9 42%, #737d89 58%, #f4f6f8 100%);
  border: 1px solid rgba(0, 0, 0, 0.45);
}

.bar-sleeve {
  width: 40px;
}

.bar-sleeve-end {
  width: 38px;
  flex-basis: 38px;
  margin-left: 0;
}

.bar-plate {
  width: 27px;
  flex: 0 0 27px;
  margin-left: 2px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.72);
  display: grid;
  place-items: center;
  color: #101317;
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  box-shadow:
    inset 2px 0 0 rgba(255, 255, 255, 0.18),
    inset -2px 0 0 rgba(0, 0, 0, 0.28),
    1px 0 0 rgba(255, 255, 255, 0.08);
}

.bar-plate span {
  display: block;
  transform: none;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.plate-red {
  height: 176px;
  background: linear-gradient(90deg, #982328 0%, #c92f35 18%, #e04449 50%, #b52a30 82%, #7f1d22 100%);
  color: #ffffff;
}

.plate-blue {
  height: 166px;
  background: linear-gradient(90deg, #233f96 0%, #3259d2 18%, #5477ef 50%, #294cb7 82%, #1b3177 100%);
  color: #ffffff;
}

.plate-yellow {
  height: 152px;
  background: linear-gradient(90deg, #a78d1e 0%, #dfc545 18%, #f1dc68 50%, #c0a832 82%, #7f6b14 100%);
  color: #101317;
}

.plate-green {
  height: 134px;
  background: linear-gradient(90deg, #28623d 0%, #3b8b58 18%, #57aa73 50%, #32784b 82%, #1d4b2e 100%);
  color: #ffffff;
}

.plate-white {
  height: 112px;
  background: linear-gradient(90deg, #aeb5bd 0%, #e5e9ed 18%, #ffffff 50%, #c8ced5 82%, #8f98a2 100%);
  color: #101317;
}

.plate-black {
  height: 92px;
  background: linear-gradient(90deg, #050607 0%, #090b0e 18%, #252a31 50%, #090b0e 82%, #030405 100%);
  color: #ffffff;
}

.plate-small {
  height: 76px;
  background: linear-gradient(90deg, #606976 0%, #8e98a4 18%, #b0bac5 50%, #7c8794 82%, #4d5560 100%);
  color: #101317;
}

.bar-collar {
  width: 10px;
  height: 48px;
  flex: 0 0 10px;
  margin-left: 4px;
  border-radius: 3px;
  border: 1px solid #626a74;
  background: linear-gradient(180deg, #eef1f4 0%, #b8c0c8 52%, #eef1f4 100%);
  box-shadow:
    inset 1px 0 0 rgba(255, 255, 255, 0.35),
    inset -1px 0 0 rgba(0, 0, 0, 0.25);
}

.plate-list {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.timer-panel {
  position: sticky;
  top: 92px;
}

.timer-display {
  margin: 18px 0;
  padding: 22px;
  border-radius: 18px;
  text-align: center;
  background: #101317;
  border: 1px solid var(--border);
  font-size: clamp(3.5rem, 8vw, 5.4rem);
  font-weight: 900;
  letter-spacing: -0.06em;
  line-height: 1;
}

.timer-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.timer-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid transparent;
  transition: 0.15s ease;
  text-align: center;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(180deg, var(--silver) 0%, var(--silver-dark) 100%);
  color: #101317;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.06);
}

.full-width {
  width: 100%;
}

.modal,
.timer-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 10, 13, 0.96);
}

.modal.open,
.timer-overlay.open {
  display: flex;
}

.modal-card,
.timer-overlay-card {
  width: min(100%, 720px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 24px;
  border-radius: 24px;
  background: linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.modal-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.modal-title {
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 1rem;
  font-weight: 900;
}

.modal-copy {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.modal-close-btn,
.overlay-close {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 800;
}

.settings-section {
  margin-top: 18px;
}

.overlay-close {
  float: right;
}

.overlay-title {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.84rem;
}

.overlay-time {
  clear: both;
  margin: 34px 0 24px;
  text-align: center;
  font-size: clamp(5rem, 22vw, 11rem);
  line-height: 0.9;
  font-weight: 900;
  letter-spacing: -0.08em;
}

@media (max-width: 980px) {
  main,
  .nav {
    width: min(var(--max), calc(100% - 24px));
  }

  .nav {
    min-height: 64px;
    padding: 10px 0;
    gap: 12px;
  }

  .brand strong {
    font-size: 0.92rem;
    letter-spacing: 0.1em;
  }

  .brand span {
    font-size: 0.68rem;
  }

  .app-grid {
    grid-template-columns: 1fr;
  }

  .timer-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  main,
  .nav {
    width: min(var(--max), calc(100% - 24px));
  }

  .nav {
    align-items: stretch;
    flex-direction: column;
    padding: 14px 0;
    gap: 12px;
    overflow: visible;
  }

  .brand {
    width: 100%;
  }

  .brand strong {
    font-size: 0.88rem;
    letter-spacing: 0.08em;
    line-height: 1.1;
  }

  .brand span {
    font-size: 0.66rem;
    letter-spacing: 0.06em;
  }

  .nav-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    flex-shrink: 1;
  }

  .nav-link,
  .nav-share {
    width: 100%;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    white-space: normal;
    text-align: center;
  }

  .hero {
    padding: 34px 0 18px;
  }

  h1 {
    font-size: clamp(3rem, 19vw, 5rem);
  }

  .form-grid,
  .custom-time,
  .segmented,
  .settings-actions {
    grid-template-columns: 1fr;
  }

  .quick-plate-options {
    grid-template-columns: 1fr;
  }

  .timer-buttons {
    grid-template-columns: repeat(2, 1fr);
  }

  .result-top,
  .panel-head,
  .modal-top {
    flex-direction: column;
  }

  .barbell {
    justify-content: flex-start;
  }

  .timer-display {
    font-size: clamp(3.2rem, 18vw, 5rem);
  }
}

@media (max-width: 420px) {
  main,
  .nav {
    width: min(var(--max), calc(100% - 20px));
  }

  .panel,
  .result-card,
  .modal-card,
  .timer-overlay-card {
    padding: 16px;
  }

  .barbell-wrap {
    padding: 10px;
  }

  .bar-plate {
    width: 25px;
    flex-basis: 25px;
    font-size: 0.58rem;
  }

  .bar-collar {
    width: 9px;
    flex-basis: 9px;
    height: 44px;
  }

  .bar-sleeve-end {
    width: 34px;
    flex-basis: 34px;
  }
}