/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #1a1a1a;
    --surface: #2a2a2a;
    --text: #e0e0e0;
    --text-secondary: #b0b0b0;
    --accent: #d4a373;
    --accent-hover: #e6b88a;
    --border: #444;
    --radius: 8px;
    --shadow: 0 4px 12px rgba(0,0,0,0.3);
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --max-width: 800px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 0 1rem;
}

/* ===== Header ===== */
header {
    text-align: center;
    padding: 2rem 0 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* ===== Main Layout ===== */
main {
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

section h2 {
    font-size: 1.5rem;
    color: var(--accent);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

/* ===== Form ===== */
.form-group {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

select, input[type="number"] {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
    font-family: var(--font);
    transition: border-color 0.2s;
}

select:focus, input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(212, 163, 115, 0.3);
}

button {
    background: var(--accent);
    color: #1a1a1a;
    border: none;
    padding: 0.7rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    width: 100%;
    margin-top: 0.5rem;
}

button:hover {
    background: var(--accent-hover);
}

button:active {
    transform: scale(0.98);
}

.result-box {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    min-height: 3rem;
    font-size: 1.1rem;
    word-break: break-word;
}

.result-box.error {
    color: #e57373;
    border-color: #e57373;
}

/* ===== Info & Reference ===== */
.formula {
    background: var(--bg);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
    font-size: 1.2rem;
    margin: 1rem 0;
    border: 1px solid var(--border);
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

th, td {
    padding: 0.7rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg);
    color: var(--accent);
    font-weight: 700;
}

tr:hover td {
    background: rgba(212, 163, 115, 0.05);
}

.tips-section ul {
    list-style-type: square;
    padding-left: 1.5rem;
}

.tips-section li {
    margin-bottom: 0.5rem;
}

/* ===== Footer ===== */
footer {
    text-align: center;
    padding: 1.5rem 0;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    margin-top: 2rem;
    font-size: 0.9rem;
}

footer a {
    color: var(--accent);
    text-decoration: none;
    margin: 0 0.3rem;
}

footer a:hover {
    text-decoration: underline;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.8rem;
    }
    section {
        padding: 1rem;
    }
    .formula {
        font-size: 1rem;
    }
}

@media (min-width: 601px) {
    .calculator-section form {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    .form-group:last-of-type {
        grid-column: span 2;
    }
    button {
        grid-column: span 2;
    }
}



/* 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;
}

.site-utility-links {
  width: min(900px, calc(100% - 32px));
  margin: 32px auto;
  padding-top: 16px;
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(127, 127, 127, 0.25);
  font-size: 0.9rem;
}

.site-utility-links a {
  color: inherit;
  opacity: 0.75;
}
