:root {
  --color-bg-main: #050810;
  --color-bg-elevated: #0b0f1a;
  --color-bg-muted: #101522;

  --color-text-primary: #f5f5f7;
  --color-text-secondary: #a3a8b8;
  --color-text-muted: #6d7385;
  --color-text-danger: #ff6b6b;
  --color-text-accent: #7cffb2;

  --color-accent-primary: #16f29a;
  --color-accent-soft: #1e9c74;

  --color-border-subtle: #1b2235;
  --color-border-strong: #2f3b5c;

  --shadow-card: 0 18px 45px rgba(0, 0, 0, 0.55);
  --radius-card: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #0b0f1a 0, #050810 55%);
  color: var(--color-text-primary);
}

.app-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.app-meta {
  display: flex;
  align-items: center;
}

.app-title {
  margin: 0;
  font-size: 1.8rem;
}

.app-subtitle {
  margin: 0.4rem 0 0;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

.app-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(22, 242, 154, 0.5);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-accent);
}

.app-main {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1.1rem;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .app-main {
    grid-template-columns: 1fr;
  }
}

.card {
  background: linear-gradient(135deg, rgba(22, 242, 154, 0.06), transparent 60%),
    var(--color-bg-elevated);
  border-radius: var(--radius-card);
  border: 1px solid var(--color-border-subtle);
  box-shadow: var(--shadow-card);
  padding: 0.9rem 1.05rem 1.1rem;
}

.card-title {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.card-inputs,
.card-results,
.card-warnings {
  margin-left: auto;
  margin-right: auto;
}

.inputs-instruction {
  margin: 0 0 0.6rem;
  font-size: 0.83rem;
  color: var(--color-text-muted);
}

.form-grid {
  display: grid;
  gap: 0.5rem;
}

/* Compact inline fields */

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.form-field--inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.field-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  flex: 1 1 auto;
}

.field-label span {
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.85rem;
  color: var(--color-text-primary);
}

.field-input {
  border-radius: 8px;
  border: 1px solid var(--color-border-subtle);
  background: var(--color-bg-muted);
  color: var(--color-text-primary);
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
}

.field-input--compact {
  max-width: 5rem;
  min-width: 5rem;        /* ensure same width for all, including admits */
  padding: 0.35rem 0.55rem;
  font-size: 0.9rem;
  text-align: center;     /* center the numbers in the box */
}

.field-input:focus {
  outline: none;
  border-color: var(--color-accent-primary);
  box-shadow: 0 0 0 1px rgba(22, 242, 154, 0.45);
}

.form-field--admissions .field-label span {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
}

.btn-primary {
  margin-top: 0.3rem;
  border-radius: 999px;
  border: none;
  background-image: linear-gradient(135deg, #16f29a, #4da3ff);
  color: #050810;
  padding: 0.5rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.6);
}

.btn-primary--full {
  width: 100%;
  justify-content: center;
}

.btn-primary:hover {
  transform: translateY(-1px) scale(1.02);
  filter: brightness(1.03);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.7);
}

.results-body,
.flags-body {
  font-size: 0.95rem;
}

.results-placeholder {
  margin: 0;
  color: var(--color-text-muted);
}

/* Mapping / summary text */

.results-summary {
  margin-bottom: 0.6rem;
  font-size: 0.86rem;
  color: var(--color-text-secondary);
}

.mapping-list {
  list-style: none;
  padding: 0;
  margin: 0.15rem 0 0.6rem;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.mapping-list li span {
  font-weight: 600;
  color: var(--color-text-accent);
}

/* Remove up/down arrows on number inputs */

/* Chrome, Edge, Safari, Opera */
input[type="number"].field-input--compact::-webkit-outer-spin-button,
input[type="number"].field-input--compact::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
input[type="number"].field-input--compact {
  appearance: textfield;      /* modern standard */
  -moz-appearance: textfield;
}

/* Admissions table */

.admissions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 0.35rem;
}

.admissions-table thead {
  background: rgba(22, 242, 154, 0.06);
}

.admissions-table th,
.admissions-table td {
  padding: 0.25rem 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;          /* center all numeric columns */
  white-space: nowrap;
}

/* Assigned Team text left-aligned for readability, rest stay centered */
.admissions-table th:nth-child(2),
.admissions-table td:nth-child(2) {
  text-align: left;
}

/* Neon highlight per selected team */

.cell-selected {
  font-weight: 600;
  text-shadow: 0 0 6px rgba(22, 242, 154, 0.85);
}

.cell-selected--L {
  background: radial-gradient(circle, rgba(22, 242, 154, 0.25), transparent 65%);
  color: #8dffd2;
}

.cell-selected--M {
  background: radial-gradient(circle, rgba(77, 163, 255, 0.25), transparent 65%);
  color: #c0d9ff;
}

.cell-selected--Post {
  background: radial-gradient(circle, rgba(187, 120, 255, 0.25), transparent 65%);
  color: #e2c5ff;
}

.cell-selected--Pre {
  background: radial-gradient(circle, rgba(255, 214, 102, 0.25), transparent 65%);
  color: #ffe9ad;
}

.cell-selected--S {
  background: radial-gradient(circle, rgba(255, 145, 77, 0.25), transparent 65%);
  color: #ffd0ad;
}

/* Assigned team text coloring to match matrix highlights */

.result-role {
  font-weight: 600;
}

.result-role--L {
  color: #8dffd2; /* match L highlight */
  text-shadow: 0 0 6px rgba(22, 242, 154, 0.85);
}

.result-role--M {
  color: #c0d9ff; /* match M highlight */
  text-shadow: 0 0 6px rgba(77, 163, 255, 0.8);
}

.result-role--Post {
  color: #e2c5ff; /* match Post highlight */
  text-shadow: 0 0 6px rgba(187, 120, 255, 0.8);
}

.result-role--Pre {
  color: #ffe9ad; /* match Pre highlight */
  text-shadow: 0 0 6px rgba(255, 214, 102, 0.8);
}

.result-role--S {
  color: #ffd0ad; /* match S highlight */
  text-shadow: 0 0 6px rgba(255, 145, 77, 0.8);
}

.cell-call-chief {
  color: var(--color-text-danger);
  font-weight: 600;
}

/* Flags */

.flag-pill {
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.15rem 0.25rem 0.15rem 0;
}

.flag-pill--warning {
  background: rgba(255, 200, 87, 0.1);
  color: #ffc857;
  border-left: 3px solid #ffc857;
}

.flag-pill--danger {
  background: rgba(255, 107, 107, 0.08);
  color: #ff6b6b;
  border-left: 3px solid #ff6b6b;
}

/* Footer */

.app-footer {
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.disclaimer {
  margin: 0 0 0.4rem;
}

.credit-line {
  margin: 0;
  font-size: 0.75rem;
}

.credit-link {
  color: var(--color-text-accent);
}

/* Mobile layout */

@media (max-width: 600px) {
  .app-shell {
    max-width: 100%;
    margin: 0 auto;
    padding: 2rem 0.6rem 2.4rem;
  }

  .app-header,
  .app-footer,
  .card {
    max-width: 480px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .app-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.7rem;
  }

  .app-header > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .app-meta {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .app-title {
    font-size: 1.55rem;
    line-height: 1.2;
  }

  .app-subtitle {
    max-width: 26rem;
    margin: 0.25rem auto 0;
    font-size: 0.9rem;
  }

  .form-field--inline {
    flex-direction: row;
    align-items: center;
  }

  .field-label {
    max-width: 70%;
  }

  .app-footer {
    text-align: left;
    width: 100%;
  }

  .disclaimer,
  .credit-line {
    max-width: 26rem;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 600px) {
  /* ... you already have other rules here ... */

  /* Prevent iOS Safari from zooming/offsetting on focus */
  .field-input,
  .field-input--compact {
    font-size: 16px;         /* >=16px stops the zoom */
  }

  input[type="number"].field-input--compact {
    -webkit-text-size-adjust: 100%;
  }
}

/* === iOS Install Hint Banner === */

.ios-install-hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.95);
  border-top: 1px solid rgba(0, 255, 102, 0.5);
  box-shadow: 0 -0.4rem 1rem rgba(0, 255, 102, 0.25);
  color: #e0ffe6;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.8rem;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ios-install-hint-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.ios-install-hint-text {
  flex: 1;
}

.ios-install-hint-text strong {
  color: #00ff66;
}

.ios-install-hint-close {
  border: 1px solid rgba(0, 255, 102, 0.6);
  background: transparent;
  color: #e0ffe6;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 999px;
  cursor: pointer;
}

.ios-install-hint-hidden {
  display: none !important;
}

