/* Additive styles for the multi-page shell. style.css is shipped byte-for-byte unchanged on every
   page — its `.ground` sizing is a hand-tuned calc() that encodes the exact flow-element stack, so
   nothing here may add a flow-level element to a game page. All new game-page chrome is fixed. */

/* Home/history pages inherit .app's bottom padding, which exists purely as clearance for the game's
   fixed D-pad bar. Those pages have no D-pad, so the space is just dead. */
body.page-plain .app {
  padding-bottom: 2rem;
}

/* Back-to-Home control on game routes. Deliberately fixed-position and mirrored on .mute-fab
   (style.css) so it costs ZERO vertical flow budget — a nav bar in normal flow would shrink the
   ground, which is exactly what the calc(100vh - 412px) tuning can't absorb.
   z-index 30 matches .mute-fab: above the sticky .stats (15), below the scorecard modal (1000). */
.nav-fab {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 30;
  background: #2c2c3e;
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.6rem 0.7rem;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  text-decoration: none;
}

.nav-fab:hover {
  background: #3a3a52;
}

/* The format name on a game route's pre-game screen, replacing the mode picker that used to live
   there (the format is now fixed by the URL). Inside #difficulty-screen, which is hidden once play
   starts, so it never competes with the ground for vertical space. */
.difficulty-screen-format {
  margin: 0 0 0.6rem;
  font-size: 1.25rem;
  font-weight: bold;
  color: #ffd54f;
}

/* The in-game Home button (◦ ⚙ menu, or surfaced next to Restart once an innings ends) — styled
   here rather than in style.css since it's new chrome from the same pass that split style.css off
   as untouched. Distinct color from #restart (blue) so the two "what next" actions read as
   separate choices, not a matched pair. */
#home-btn {
  background: #6b6b7a;
}

#home-btn:hover {
  background: #575764;
}

/* --- Home layout --- */

.home-section {
  background: #124a26;
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin-bottom: 0.9rem;
}

.home-section-label {
  margin: 0 0 0.7rem;
  font-size: 0.95rem;
  color: #9fd8ac;
}

/* Sits under a .home-section-label when the label alone leaves its section's purpose ambiguous —
   e.g. "Best Scores" next to a row of difficulty buttons reads as "set your difficulty" without
   this making clear the buttons are a filter for the table below them. */
.home-section-hint {
  margin: -0.4rem 0 0.7rem;
  font-size: 0.72rem;
  color: #7fae8a;
}

.mode-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.mode-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 0.7rem;
  border-radius: 8px;
  background: #2c2c3e;
  border: 1px solid #3a3a52;
  color: #fff;
  text-decoration: none;
  text-align: left;
}

.mode-card:hover {
  background: #3a3a52;
  border-color: #4caf50;
}

.mode-card-title {
  font-size: 1rem;
  font-weight: bold;
}

.mode-card-detail {
  font-size: 0.7rem;
  color: #9fd8ac;
}

.best-scores {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.best-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.18);
}

.best-row-mode {
  color: #9fd8ac;
}

.best-row-score {
  color: #ffd54f;
  font-weight: bold;
}

/* --- Match history --- */

.history-empty {
  margin: 0;
  font-size: 0.8rem;
  color: #9fd8ac;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 22rem;
  overflow-y: auto;
}

.history-row {
  display: grid;
  grid-template-columns: 3.6rem 1fr auto;
  grid-template-areas: "score meta result" "score date result";
  align-items: center;
  gap: 0.1rem 0.6rem;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid #3a3a52;
  border-radius: 6px;
  background: #2c2c3e;
  color: #fff;
  cursor: pointer;
  text-align: left;
}

.history-row:hover {
  background: #3a3a52;
}

.history-score {
  grid-area: score;
  font-size: 1rem;
  font-weight: bold;
  color: #ffd54f;
}

.history-meta {
  grid-area: meta;
  font-size: 0.72rem;
  color: #cfe8d6;
}

.history-date {
  grid-area: date;
  font-size: 0.65rem;
  color: #8fb89a;
}

.history-result {
  grid-area: result;
  font-size: 0.65rem;
  font-weight: bold;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}

.result-won {
  background: #2f7d3a;
  color: #eaffef;
}

.result-allout {
  background: #7d2f2f;
  color: #ffeaea;
}

.result-oversComplete {
  background: #6b5a2f;
  color: #fff6e0;
}

.clear-history-btn {
  margin-top: 0.7rem;
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  background: #7d2f2f;
}

.clear-history-btn:hover {
  background: #953838;
}

/* Ball-by-ball inside the history scorecard. The live game shows this in its own panel on the game
   page, so it only needs a home here. */
.history-commentary {
  max-height: 9rem;
  text-align: left;
  margin-top: 0.3rem;
}

.history-truncated {
  color: #ffd54f;
}

/* --- Feedback form --- */

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.feedback-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.feedback-label {
  font-size: 0.8rem;
  color: #9fd8ac;
}

.feedback-select,
.feedback-textarea,
.feedback-input {
  font-family: inherit;
  font-size: 0.85rem;
  color: #fff;
  background: #1a1a26;
  border: 1px solid #3a3a52;
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
}

.feedback-select {
  width: auto;
}

.feedback-textarea {
  resize: vertical;
  min-height: 5rem;
  width: 100%;
  box-sizing: border-box;
}

.feedback-input {
  width: 100%;
  box-sizing: border-box;
}

/* Honeypot: off-screen rather than display:none/visibility:hidden, since some bots skip fields
   that are hidden that way but still fill anything merely positioned off-canvas. */
.feedback-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.feedback-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.feedback-submit {
  background: #4caf50;
}

.feedback-submit:hover:not(:disabled) {
  background: #43a047;
}

.feedback-status {
  font-size: 0.8rem;
  color: #9fd8ac;
}

.feedback-status-ok {
  color: #4caf50;
}

.feedback-status-error {
  color: #ff8a65;
}

/* Matches style.css's breakpoint exactly so both fabs and the home layout shift together. */
@media (max-width: 430px), (max-height: 480px) {
  .nav-fab {
    top: 8px;
    left: 8px;
    font-size: 1rem;
    padding: 0.5rem 0.6rem;
  }

  .home-section {
    padding: 0.8rem 0.75rem;
  }

  .mode-list {
    gap: 0.45rem;
  }

  .mode-card {
    padding: 0.65rem 0.55rem;
  }
}
