/* Installed-app shell: full screen on phones, a centred column on larger screens.
   Loaded last, so it overrides the layout-study rules in base/glass/training.css. */

html, body {
  height: 100%;
}

body {
  margin: 0;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

/* ---- Header ---- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: calc(env(safe-area-inset-top) + 10px) 18px 10px;
  border-bottom: 1px solid #ffffff14;
  background: #0c0c10cc;
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand b {
  color: #f14b55;
}

.brand-logo {
  width: 44px;
  height: 44px;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.top-actions button {
  min-height: 38px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
}

.premium-pill {
  background: linear-gradient(155deg, #c52a3b, #9a1026) !important;
  border-color: #ffffff30 !important;
  color: #fff;
}

/* ---- Screen ---- */
.screen {
  flex: 1;
  min-height: 0 !important;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 20px 18px 28px !important;
}

.screen:focus {
  outline: none;
}

.screen h2 {
  font-size: 30px;
}

/* ---- Bottom tab bar ---- */
nav#nav {
  position: static;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  margin: 0;
  padding: 6px 6px calc(env(safe-area-inset-bottom) + 6px);
  border: 0;
  border-top: 1px solid #ffffff1c;
  border-radius: 0;
  background: #121217e6;
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  backdrop-filter: blur(24px) saturate(150%);
  box-shadow: none;
}

nav#nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 54px;
  padding: 6px 2px;
  border: 0;
  border-radius: 14px;
  background: transparent !important;
  box-shadow: none;
  color: #9d9daa;
  font-size: 11px;
  font-weight: 600;
}

nav#nav button .icon {
  font-size: 22px;
}

nav#nav button[aria-current=page] {
  color: #fff;
}

nav#nav button[aria-current=page] .icon {
  color: #f14b55;
}

body[data-page=welcome] nav#nav,
body[data-page=welcome] .premium-pill {
  display: none;
}

/* ---- Icons ---- */
.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.14em;
  flex-shrink: 0;
}

.icon-filled {
  fill: currentColor;
}

/* ---- Live fight feed ---- */
.feed-event {
  display: block;
  text-decoration: none;
  color: inherit;
}

.feed-heading {
  margin: 26px 0 4px;
}

.feed-story {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 0;
  border-bottom: 1px solid #ffffff1a;
  color: inherit;
  text-decoration: none;
}

.feed-story strong {
  font-size: 16px;
  line-height: 1.35;
}

.feed-story .eyebrow {
  color: #f14b55;
}

.button-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  margin-top: 20px;
  border: 1px solid #ffffff25;
  border-radius: 18px;
  color: #f5f5f7;
  text-decoration: none;
  font-weight: 600;
}

/* ---- Install instructions ---- */
.install-button {
  background: #ffffff14 !important;
}

.install-dialog {
  width: min(440px, 92vw);
  border: 1px solid #ffffff30;
  border-radius: 24px;
  background: #1c1c24;
  color: #f5f5f7;
  padding: 24px;
}

.install-dialog::backdrop {
  background: #000a;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.install-dialog h2 {
  font-size: 24px;
  margin-top: 0;
}

.install-dialog ol {
  padding-left: 22px;
}

.install-dialog li {
  margin: 12px 0;
}

/* ---- Larger screens: the app sits in a centred column ---- */
@media (min-width: 700px) {
  body {
    padding: 24px 0;
    box-sizing: border-box;
  }
  .app {
    height: calc(100dvh - 48px);
    border: 1px solid #ffffff22;
    border-radius: 34px;
    overflow: hidden;
    box-shadow: 0 30px 80px #00000070;
  }
}

/* Headings receive focus on screen change (for screen readers); no ring needed */
.screen h2:focus,
.screen h2:focus-visible {
  outline: none;
}

.brand span {
  color: #f5f5f7;
}

/* ---- Fight training ---- */
.fight-arts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}

.fight-art {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 2px;
  min-height: 118px;
  padding: 12px 14px !important;
  border-radius: 18px !important;
  background-size: cover !important;
  background-position: center !important;
  text-align: left;
  color: #fff;
}

.fight-art:first-child {
  grid-column: span 2;
  min-height: 150px;
}

.fight-art strong {
  font-size: 18px;
  letter-spacing: -0.3px;
}

.fight-art span {
  font-size: 12px;
  color: #d8d8e0;
}

.fight-hero {
  margin: -20px -18px 16px;
  padding: 110px 18px 18px;
  background-size: cover;
  background-position: center;
}

.fight-hero h2 {
  margin: 4px 0 0;
}

.fight-session-card {
  padding: 18px;
  margin: 12px 0;
  border-radius: 22px;
  border: 1px solid #ffffff26;
  background: linear-gradient(135deg, #ffffff14, #ffffff06);
}

.fight-session-card h3 {
  margin: 8px 0 6px;
}

.fight-rounds {
  padding-left: 22px;
}

.fight-rounds li {
  padding: 10px 0;
  border-bottom: 1px solid #ffffff1c;
}

.fight-rounds strong,
.fight-rounds .small {
  display: block;
}

.fight-howto {
  min-height: 34px !important;
  margin-top: 8px;
  padding: 5px 12px !important;
  font-size: 12px;
}

.fight-options {
  margin: 12px 0 4px;
}

.fight-options .check {
  margin: 8px 0;
}

.fight-weeks {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 6px;
}

.fight-weeks button {
  white-space: nowrap;
}

.fight-drill-row {
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  margin: 0;
  padding: 12px 2px !important;
  border: 0 !important;
  border-bottom: 1px solid #ffffff1c !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  text-align: left;
}

.fight-cue {
  padding: 10px 12px;
  border-left: 3px solid #f14b55;
  background: #ffffff08;
}

.fight-safety {
  color: #ffb4bb;
  font-size: 14px;
}

/* Round timer */
.fight-runner {
  margin: 12px 0 16px;
  padding: 22px 18px;
  border-radius: 28px;
  border: 1px solid #ffffff2a;
  background: linear-gradient(160deg, #ffffff12, #ffffff04);
  text-align: center;
}

.fight-phase h3 {
  margin: 6px 0 4px;
  font-size: 22px;
}

.fight-kind {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #ffffff1a;
}

.fight-phase[data-kind=Round] .fight-kind,
.fight-phase[data-kind=Sprint] .fight-kind,
.fight-phase[data-kind=Run] .fight-kind,
.fight-phase[data-kind=Contract] .fight-kind {
  background: #c52a3b;
  color: #fff;
}

.fight-phase[data-kind=Rest] .fight-kind,
.fight-phase[data-kind=Recover] .fight-kind,
.fight-phase[data-kind=Walk] .fight-kind {
  background: #2d5d8a;
  color: #fff;
}

.fight-focus {
  margin: 6px 0 0;
  color: #e4e4ea;
}

.fight-clock {
  margin: 14px 0 10px;
  font-size: 84px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -3px;
  font-variant-numeric: tabular-nums;
}

.fight-bar {
  height: 8px;
  border-radius: 8px;
  background: #ffffff1c;
  overflow: hidden;
}

.fight-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: #f14b55;
  transition: width 0.25s linear;
}

.fight-controls {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

/* ---- Journal ---- */
.journal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0;
}

.journal-stats div {
  padding: 14px 10px;
  border-radius: 18px;
  border: 1px solid #ffffff22;
  background: #ffffff0b;
  text-align: center;
}

.journal-stats b {
  display: block;
  font-size: 28px;
  line-height: 1.1;
}

.journal-stats span {
  font-size: 11px;
  color: #bdbdc8;
}

.journal-chart {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  align-items: end;
  gap: 6px;
  height: 110px;
  margin: 6px 0 18px;
}

.journal-bar {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  gap: 4px;
}

.journal-bar span {
  display: block;
  width: 100%;
  min-height: 3px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(to top, #9a1026, #f14b55);
}

.journal-bar small {
  font-size: 10px;
  color: #9d9daa;
}

.journal-entry {
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  margin: 10px 0;
  padding: 14px 16px !important;
  border-radius: 18px !important;
  text-align: left;
}

.journal-entry .eyebrow {
  color: #f14b55;
}

.journal-note {
  font-size: 13px;
  color: #cfcfd8;
  font-style: italic;
}

.journal-form textarea {
  width: 100%;
  box-sizing: border-box;
  margin-top: 7px;
  padding: 12px;
  border: 1px solid #ffffff38;
  border-radius: 14px;
  background: #ffffff10;
  color: #f5f5f7;
  font: inherit;
  resize: vertical;
}

.journal-form input[type=number] {
  width: 100%;
  box-sizing: border-box;
  margin-top: 7px;
  padding: 12px;
  border: 1px solid #ffffff38;
  border-radius: 14px;
  background: #ffffff10;
  color: #f5f5f7;
  font: inherit;
}

.journal-form input[type=range] {
  width: 100%;
  margin-top: 10px;
  accent-color: #f14b55;
}

.journal-form output {
  float: right;
  color: #f14b55;
  font-weight: 700;
}

/* ---- Account ---- */
.account-button {
  width: 38px;
  min-height: 38px !important;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 18px;
}

.account-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.clerk-mount {
  display: flex;
  justify-content: center;
  margin: 18px 0;
}

.account-benefits li {
  border-bottom-color: #ffffff1a;
}

.account-danger {
  color: #ff9aa4 !important;
  border-color: #ff9aa455 !important;
}

.link-button {
  display: inline;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  color: #f14b55 !important;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* The welcome screen is the sign-in page: no account button or tabs yet */
body[data-page=welcome] .account-button {
  display: none;
}
