/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #222;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
main { flex: 1; padding: 1rem 0; }

a { color: #1e40af; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
header {
    background: #0b132b;
    color: #fff;
    padding: 1rem 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
}
.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #facc15;
    text-decoration: none;
}
nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}
nav ul li a {
    color: #e5e7eb;
    font-weight: 500;
    transition: color 0.2s;
}
nav ul li a:hover { color: #facc15; text-decoration: none; }

/* Sections */
section {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.hero {
    text-align: center;
    padding: 2rem 1rem;
}
.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: #0b132b;
    margin-bottom: 0.5rem;
}
.hero p {
    font-size: 1.2rem;
    color: #4b5563;
    max-width: 600px;
    margin: 0 auto;
}

/* Calculator */
.calculator {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    padding: 2rem;
}
.presets {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.presets button {
    background: #e0e7ff;
    color: #1e3a8a;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.presets button:hover { background: #c7d2fe; }

form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.form-group {
    display: flex;
    flex-direction: column;
}
.form-group label {
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #374151;
}
.form-group input[type="number"] {
    padding: 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
}
.form-group.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}
.form-group.checkbox input[type="checkbox"] { width: auto; }
#taxRateGroup { display: none; }

.members-container {
    grid-column: 1 / -1;
    background: #f3f4f6;
    padding: 1rem;
    border-radius: 8px;
}
.members-container .member-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.8rem;
}
.member-row label {
    min-width: 80px;
    font-weight: 600;
}
.member-row input {
    flex: 1;
    padding: 0.4rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
}

.btn-secondary {
    background: #e5e7eb;
    color: #1f2937;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-secondary:hover { background: #d1d5db; }

.results {
    margin-top: 1.5rem;
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.8rem;
}
th, td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}
th {
    background: #f9fafb;
    font-weight: 700;
}
.total {
    font-weight: 700;
    font-size: 1.1rem;
}
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1rem;
}

/* Walkthrough, Common Mistakes, FAQ, Assumptions */
.walkthrough, .common-mistakes, .faq, .assumptions {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    padding: 2rem;
}
h2 {
    font-size: 1.8rem;
    color: #0b132b;
    margin-bottom: 1rem;
}
p, ul, dl {
    color: #374151;
}
ul, dl { padding-left: 1.5rem; }
li, dd { margin-bottom: 0.5rem; }
dt {
    font-weight: 700;
    margin-top: 1rem;
}

/* Footer */
footer {
    background: #0b132b;
    color: #e5e7eb;
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: 2rem;
}
footer a {
    color: #facc15;
    text-decoration: none;
}
footer a:hover { text-decoration: underline; }
footer p { margin-bottom: 0.5rem; }

/* Print styles */
@media print {
    header, footer, .presets, .actions, #memberCount, #totalTickets, #ticketCost, #jackpot, #includeTax, #taxRate, #splitEquallyBtn, .hero { display: none; }
    .calculator { box-shadow: none; }
    body { background: #fff; }
    .results table { width: 100%; }
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.8rem; }
    form { grid-template-columns: 1fr; }
    .member-row { flex-direction: column; align-items: flex-start; }
}

.version { font-size: 0.8rem; opacity: 0.7; }


/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
