:root {
    --bg-color: #f5f5f7;
    --card-bg: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --accent-color: #007aff;
    --accent-hover: #0056b3;
    --border-color: rgba(60, 60, 67, 0.08);
    --success-color: #34c759;
    --danger-color: #ff3b30;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    background: #fafafa;
    min-height: 100vh;
}

@media (min-width: 500px) {
    body {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        padding: 40px 20px;
    }
    .app-container {
        border-radius: 40px;
        box-shadow: 0 20px 60px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
        overflow: hidden;
        border: 8px solid #ffffff;
        min-height: auto;
    }
}

/* Header */
.header {
    padding: 50px 24px 30px;
    background: linear-gradient(180deg, #ffffff 0%, rgba(255,255,255,0) 100%);
}

.title {
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #1d1d1f 0%, #434347 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Main Content */
.main-content {
    padding: 0 24px 120px; /* Add space at bottom so content isn't hidden behind the floating button */
}

.section {
    margin-bottom: 36px;
}

.section-label, .section-title {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
    display: block;
    margin-left: 8px;
}

/* Input Wrapper */
.bac-section {
    margin-bottom: 40px;
}

.input-wrapper {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 24px 24px;
    display: flex;
    align-items: baseline;
    box-shadow: 0 8px 24px rgba(0,0,0,0.03), 0 2px 6px rgba(0,0,0,0.02);
    border: 1px solid rgba(255,255,255,0.8);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.input-wrapper:focus-within {
    transform: scale(1.02);
    box-shadow: 0 12px 32px rgba(0, 122, 255, 0.12);
    border-color: rgba(0, 122, 255, 0.3);
}

.bac-input {
    flex: 1;
    border: none;
    font-size: 56px;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    outline: none;
    background: transparent;
    width: 100%;
    padding: 0;
    line-height: 1;
}

.unit {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-left: 12px;
}

/* Card Groups */
.card-group {
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

.card-header {
    background: #fafafc;
    padding: 14px 20px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
}

.toggle-row:last-child {
    border-bottom: none;
}

.toggle-label {
    font-size: 15px;
    font-weight: 500;
    color: #1d1d1f;
    padding-right: 24px;
    flex: 1;
    line-height: 1.4;
}

/* Custom Toggle Switch (iOS Style) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e9e9ea;
    transition: .3s cubic-bezier(0.3, 1.05, 0.4, 1.05);
    border-radius: 31px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 27px;
    width: 27px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s cubic-bezier(0.3, 1.05, 0.4, 1.05);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2), 0 0 1px rgba(0,0,0,0.1);
}

input:checked + .slider {
    background-color: var(--success-color);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Disclaimer */
.disclaimer {
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-secondary);
    text-align: justify;
    padding: 16px;
    border-top: 1px solid var(--border-color);
    margin-top: -16px;
}

.disclaimer-modal {
    border-top: none;
    padding: 16px 4px 0;
    margin-top: 0;
    text-align: center;
}

/* Bottom Action Bar */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0 24px calc(14px + env(safe-area-inset-bottom));
    z-index: 50;
    pointer-events: none;
    display: flex;
    justify-content: center;
}

.action-btn {
    pointer-events: auto;
    width: 100%;
    max-width: 432px;
    display: block;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 18px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 16px 32px rgba(0, 122, 255, 0.3), 0 4px 12px rgba(0, 122, 255, 0.2);
}

.action-btn:active {
    transform: scale(0.96);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.15);
}

/* Result Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 1;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: rgba(245, 245, 247, 0.95);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 32px 32px 0 0;
    padding: 40px 24px 50px;
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.1, 0.8, 0.3, 1);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
}

@media (min-width: 500px) {
    .modal-overlay {
        position: absolute;
        border-radius: 32px;
    }
}

.modal-overlay.hidden .modal-content {
    transform: translateY(100%);
}

.close-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    background: rgba(0,0,0,0.06);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background 0.2s ease;
}

.close-btn:active {
    background: rgba(0,0,0,0.1);
}

.result-header {
    text-align: center;
    margin-bottom: 40px;
}

.result-title {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 700;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}

.verdict-text {
    font-size: 52px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.verdict-text.probation {
    background: linear-gradient(135deg, #34c759 0%, #248a3d 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.verdict-text.imprisonment {
    background: linear-gradient(135deg, #ff3b30 0%, #c9241b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.verdict-text.none {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Frosted Glass Card for Term/Fine */
.glass-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 30px;
    margin-bottom: 32px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.data-point {
    text-align: center;
    flex: 1;
}

.data-value {
    display: block;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 6px;
    white-space: nowrap;
}

.data-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.divider {
    width: 1px;
    height: 50px;
    background: var(--border-color);
}

.analysis-section {
    background: #ffffff;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
}

.analysis-section h4 {
    font-size: 16px;
    margin-bottom: 12px;
    font-weight: 700;
    color: var(--text-primary);
}

.analysis-text {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}
