/* Base */

:root {
    --bg: #0b1020;
    --card: #121936;
    --text: #e8ecff;
    --muted: #9aa3c7;
    --accent: #4f7cff;
    --accent-2: #22c55e;
    --warn: #eab308;
    --error: #ef4444;
    --border: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    color: var(--text);
    background: radial-gradient(1200px 800px at 70% -10%, #1a2360 0%, rgba(26, 35, 96, 0) 60%), radial-gradient(1000px 800px at -10% 110%, #102a43 0%, rgba(16, 42, 67, 0) 60%), var(--bg);
}

.page {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
}


/* Card */

.card {
    width: 100%;
    max-width: 920px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
}

.title {
    margin: 0 0 16px 0;
    font-size: 28px;
    font-weight: 700;
}

.tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 8px 0 16px 0;
}

.tab-btn {
    width: 100%;
    height: 56px;
    padding: 0 20px;
    font-size: 16px;
    border-radius: 12px;
    background: #0e1530;
    color: var(--text);
    border: 1px solid var(--border);
    cursor: pointer;
}

.tab-btn.active {
    border-color: rgba(79, 124, 255, 0.7);
    box-shadow: 0 0 0 4px rgba(79, 124, 255, 0.12);
}

.tab-panel {
    margin-top: 4px;
}

.subtitle {
    margin: 8px 0 12px 0;
    font-size: 18px;
    color: var(--muted);
    font-weight: 600;
}


/* Form */

.form {
    display: grid;
    gap: 16px;
}

.grid {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr;
}

.field {
    display: grid;
    gap: 6px;
}

.field span {
    font-size: 15px;
    color: var(--muted);
}

.field input {
    height: 56px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #0e1530;
    color: var(--text);
    padding: 0 16px;
    font-size: 16px;
    outline: none;
}

.field input::placeholder {
    color: #6b7398;
}

.field input:focus {
    border-color: rgba(79, 124, 255, 0.7);
    box-shadow: 0 0 0 4px rgba(79, 124, 255, 0.15);
}

.ud-presets {
    display: grid;
    gap: 8px;
}

.preset-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.preset {
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: #0e1530;
    color: var(--text);
    border: 1px solid var(--border);
    cursor: pointer;
}

.preset:hover {
    border-color: rgba(79, 124, 255, 0.6);
}

.preset-help {
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
}

.link-btn {
    background: none;
    border: none;
    color: var(--accent);
    padding: 0;
    cursor: pointer;
}

.link-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.warn {
    color: var(--warn);
    font-size: 13px;
}

.hidden {
    display: none;
}

.actions {
    display: flex;
    justify-content: flex-start;
}

.rpm-calc {
    display: grid;
    gap: 16px;
}

.rpm-calc + .form {
    margin-top: 16px;
}

/* Ensure hidden wins over .rpm-calc display */
.rpm-calc.hidden {
    display: none;
}

.btn-primary {
    height: 56px;
    padding: 0 20px;
    border-radius: 10px;
    background: linear-gradient(180deg, #5b86ff, #4f7cff);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
}

.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-secondary {
    height: 56px;
    padding: 0 20px;
    border-radius: 10px;
    background: #0e1530;
    color: var(--text);
    border: 1px solid var(--border);
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
}

.btn-secondary:hover {
    border-color: rgba(79, 124, 255, 0.7);
    box-shadow: 0 0 0 4px rgba(79, 124, 255, 0.15);
}

.error {
    color: var(--error);
    font-size: 14px;
}


/* Result */

.result {
    margin-top: 8px;
    display: grid;
    grid-template-columns: 140px 1fr;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: #0d1430;
}

.result-label {
    color: var(--muted);
}

.result-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent-2);
}

.result.disabled .result-value {
    color: #7b85a8;
}


/* Categories */

.categories {
    margin-top: 18px;
}

.cat-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.cat-card {
    border: 1px solid var(--border);
    background: #0e1530;
    border-radius: 12px;
    padding: 12px;
}

.cat-label {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 6px;
}

.cat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.cat-card.disabled .cat-value {
    color: #7b85a8;
}


/* Details */

.note {
    margin-top: 16px;
    color: var(--muted);
}

.note summary {
    cursor: pointer;
}

/* --- Additional Grinding Calculators (scoped minimal styles) --- */
.calc-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 8px 0 16px 0;
}

.calc-tab-btn {
    width: 100%;
    height: 56px;
    padding: 0 20px;
    font-size: 16px;
    border-radius: 12px;
    background: #0e1530;
    color: var(--text);
    border: 1px solid var(--border);
    cursor: pointer;
}

.calc-tab-btn.active {
    border-color: rgba(79, 124, 255, 0.7);
    box-shadow: 0 0 0 4px rgba(79, 124, 255, 0.12);
}

.calc-tab-panel.hidden {
    display: none;
}

/* two-column helper within new section while retaining mobile stack */
.grid.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 720px) {
    .grid.two-col {
        grid-template-columns: 1fr;
    }
}

/* Cylindrical sub-tabs */
.calc-subtabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 8px 0 16px 0;
}

.calc-subtab-btn {
    width: 100%;
    height: 56px;
    padding: 0 20px;
    font-size: 16px;
    border-radius: 12px;
    background: #0e1530;
    color: var(--text);
    border: 1px solid var(--border);
    cursor: pointer;
}

.calc-subtab-btn.active {
    border-color: rgba(79, 124, 255, 0.7);
    box-shadow: 0 0 0 4px rgba(79, 124, 255, 0.12);
}

.calc-subtab-panel.hidden {
    display: none;
}