* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #013220;
  color: #f5f5f5;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.8rem;
  background: #004d40;
  border-bottom: 2px solid #00796b;
}

.app-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.header-buttons {
  display: flex;
  gap: 0.5rem;
}

.main-scroll {
  flex: 1;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

.screen {
  flex: 0 0 100%;
  max-width: 100%;
  padding: 0.8rem;
  scroll-snap-align: start;
}

h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
}

h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.0rem;
}

.panel {
  background: #024731;
  border-radius: 0.75rem;
  padding: 0.8rem;
  margin-bottom: 0.8rem;
  border: 1px solid #0b8a6d;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

.field-group {
  margin-bottom: 0.6rem;
}

.field-group label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.2rem;
}

.field-row {
  display: flex;
  gap: 0.75rem;
}

.field-row .field-group {
  flex: 1;
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  font-size: 0.9rem;
}

.radio-row input {
  margin-right: 0.25rem;
}

.suit-row {
  display: flex;
  gap: 0.25rem;
}

.suit-btn {
  flex: 1;
  border: 1px solid #ffab91;
  background: #bf360c;
  color: #fff3e0;
  font-size: 1rem;
  padding: 0.35rem 0;
  border-radius: 0.5rem;
}

.suit-btn.active {
  background: #ff7043;
  color: #1b0000;
}

.level-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.level-btn {
  flex: 1;
  min-width: 2rem;
  border-radius: 0.5rem;
  border: 1px solid #90caf9;
  background: #0d47a1;
  color: #e3f2fd;
  font-size: 0.95rem;
  padding: 0.3rem 0;
}

.level-btn.active {
  background: #42a5f5;
  color: #002171;
}

.delineation {
  text-align: center;
  margin: 0.5rem 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #ffe082;
  border-top: 1px solid #ffa000;
  border-bottom: 1px solid #ffa000;
  padding: 0.3rem 0;
}

.center {
  text-align: center;
}

.result-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 0.25rem 0;
}

.btn-circle {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 2px solid #ffcc80;
  background: #e65100;
  font-size: 1.7rem;
  color: #fff3e0;
}

.delta-display {
  min-width: 2.7rem;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
}

.preview-box {
  background: #012218;
  border-radius: 0.4rem;
  border: 1px solid #0b8a6d;
  padding: 0.5rem;
  font-size: 0.85rem;
  white-space: pre-wrap;
}

.button-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn {
  flex: 1;
  padding: 0.5rem 0.6rem;
  border-radius: 0.6rem;
  border: none;
  font-size: 0.9rem;
  font-weight: 700;
}

.btn.small {
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
}

.btn-outline {
  background: transparent;
  border: 1px solid #ffcc80;
  color: #ffe0b2;
}

.btn.primary {
  background: #43a047;
  color: #e8f5e9;
}

.btn.danger {
  background: #e53935;
  color: #ffebee;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.3rem;
}

.totals-side {
  flex: 1;
}

.totals-label {
  font-size: 0.85rem;
  color: #c8e6c9;
}

.totals-value {
  font-size: 1.3rem;
  font-weight: 700;
}

.totals-sub {
  font-size: 0.85rem;
  color: #ffe082;
  margin-top: 0.15rem;
}

.last-hand {
  font-size: 0.85rem;
  color: #fff9c4;
  margin-top: 0.3rem;
}

/* SCORECARD (slide right) */

.scorecard {
  font-size: 0.9rem;
}

/* New grid layout to align the above/below line across both columns */
.scorecard-grid {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

/* Align header, above-the-line, and below-the-line columns with more space between We and They */
.scorecard-header-row,
.scorecard-above-row,
.scorecard-below-row {
  display: flex;
  gap: 1.0rem;
}


.scorecard-header-cell,
.scorecard-above-row .scorecard-column,
.scorecard-below-row .scorecard-column {
  flex: 1;
}

.score-list {
  min-height: 3rem;
}

.score-entry {
  display: flex;
  justify-content: space-between;
  padding: 0.12rem 0;
  min-height: 1.1rem;
}


.score-entry span {
  font-size: 0.86rem;
  white-space: nowrap;
}


.score-list.above {
  margin-bottom: 0.1rem;
}

/* Continuous line across both columns */
.hline-full {
  border-top: 2px solid #42a5f5;
  margin: 0.3rem 0 0.45rem 0;
}

.game-hline {
  border-top: 2px solid #ffe082;
  margin: 0.3rem 0 0.45rem 0;
}


/* Divider between completed games in below-the-line area */
.game-divider {
  border-top: 2px solid #ffe082;
  margin: 0.25rem 0 0.35rem 0;
}

.score-total-row {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
  font-weight: 600;
  font-size: 0.9rem;
}

/* HAND HISTORY */

.history-list {
  max-height: 40vh;
  overflow-y: auto;
  border-radius: 0.35rem;
  border: 1px solid #0b8a6d;
  background: #012218;
}

.history-item {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #024731;
  font-size: 0.86rem;
}

.history-item:last-child {
  border-bottom: none;
}

/* OVERLAY */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  background: #024731;
  border-radius: 0.75rem;
  padding: 1rem;
  max-width: 22rem;
  border: 1px solid #0b8a6d;
  box-shadow: 0 3px 10px rgba(0,0,0,0.5);
}

.overlay-content h2 {
  margin-top: 0;
}

.overlay-content #overlayText {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}


.score-entry.placeholder span { visibility: hidden; }


.scorecard-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.icon-button {
  background: transparent;
  border: none;
  color: #ffe082;
  font-size: 1.3rem;
  padding: 0.1rem 0.3rem;
  cursor: pointer;
}

.icon-button:focus {
  outline: 2px solid #ffcc80;
  outline-offset: 2px;
}

.text-input {
  width: 100%;
  padding: 0.35rem 0.45rem;
  border-radius: 0.45rem;
  border: 1px solid #0b8a6d;
  background: #012218;
  color: #f5f5f5;
  font-size: 0.9rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.9fr 1fr 0.9fr;
  gap: 0.3rem 0.5rem;
  margin-bottom: 0.75rem;
}

.settings-grid-header {
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: #ffe082;
}

.settings-grid-label {
  display: flex;
  align-items: center;
  font-size: 0.86rem;
}

.app-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.city-select-btn {
  border-radius: 0.6rem;
  border: 1px solid #ffcc80;
  background: transparent;
  color: #ffe0b2;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

.screen-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}


.screen-header-row .btn {
  flex: 0;
  white-space: nowrap;
}




/* v6.3: enlarge We/They headings on scorecard to match app title */
.scorecard-header-cell h3 {
  font-size: 1.2rem;
}


/* v6.3: larger Level and Strain buttons with more spacing */
.level-row,
.suit-row {
  display: flex;
  gap: 0.4rem;
}

.level-btn {
  min-width: 2.4rem;
  padding: 0.45rem 0;
  font-size: 1.05rem;
}

.suit-btn {
  padding: 0.5rem 0;
  font-size: 1.05rem;
}

/* v6.4 strain buttons same size as level buttons */
.suit-btn {
  min-width: 2.4rem;
  padding: 0.45rem 0;
  font-size: 1.05rem;
}

/* v6.4 enlarge bottom We/They */
.scorecard-header-cell h3 {
  font-size: 1.2rem !important;
}

/* v6.4 highlight selected Level/Strain yellow */
.level-btn.active, .suit-btn.active {
  background: yellow !important;
  color: black !important;
  border: 2px solid #000;
}


/* v6.5: force strain buttons same size as level buttons */
.suit-btn {
  flex: 1;
  min-width: 2.4rem;
  padding: 0.45rem 0;
  font-size: 1.05rem;
  border-radius: 0.5rem;
}

/* v6.5: enlarge We/They headings on scorecard */
.scorecard-header-cell h3 {
  font-size: 1.4rem !important;
}

/* v6.7: enlarge bottom We/They labels to match title size */
.totals-label {
  font-size: 1.2rem !important;
  font-weight: 700;
}


/* v6.8: center Level & Strain buttons without stretching full width */
.level-row,
.suit-row {
  justify-content: center;
}

/* v6.8: prevent buttons from stretching like a justified column */
.level-btn,
.suit-btn {
  flex-grow: 0 !important;
  flex-shrink: 0 !important;
  flex-basis: auto !important;
}
