@import url('https://fonts.googleapis.com/css2?family=SF+Pro+Display:wght@300;400;500;600;700&display=swap');

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #f2f2f7;
    --surface: #ffffff;
    --surface-secondary: #f9f9fb;
    --border: rgba(0, 0, 0, 0.04);
    --separator: rgba(60, 60, 67, 0.08);
    --text: #1c1c1e;
    --text-secondary: #3c3c43;
    --text-tertiary: #8e8e93;
    --text-quaternary: #aeaeb2;

    --red: #ff3b30;
    --red-bg: rgba(255, 59, 48, 0.08);
    --blue: #007aff;
    --blue-bg: rgba(0, 122, 255, 0.08);
    --green: #34c759;
    --green-bg: rgba(52, 199, 89, 0.08);
    --orange: #ff9500;
    --orange-bg: rgba(255, 149, 0, 0.08);
    --gray: #8e8e93;

    --radius-lg: 16px;
    --radius-md: 13px;
    --radius-sm: 10px;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
    --shadow-button: 0 1px 2px rgba(0, 0, 0, 0.06);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app {
    min-height: 100vh;
    padding: 0 16px 48px;
}

.container {
    max-width: 440px;
    margin: 0 auto;
}

/* Header - iOS style large title */
.header {
    padding: 60px 0 8px;
    margin-bottom: 8px;
}

.header h1 {
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
}

.tagline {
    color: var(--text-tertiary);
    font-size: 0.85rem;
    font-weight: 400;
    margin-top: 4px;
}

/* Grouped card sections (iOS Settings style) */
.section-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 24px 16px 8px;
}

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-card);
    transition: transform 0.2s ease;
}

.card:active {
    transform: scale(0.99);
}

/* Smoke Card - Hero */
.card-smoke {
    padding: 28px 24px;
    text-align: center;
}

.card-smoke .card-date {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-weight: 500;
    margin-bottom: 16px;
}

.counter-ring {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ring-svg {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: var(--separator);
    stroke-width: 8;
}

.ring-fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 326.73;
    stroke-dashoffset: 326.73;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.ring-fill-smoke {
    stroke: var(--red);
}

.counter-ring .counter-value {
    font-size: 3.4rem;
    font-weight: 700;
    color: var(--text);
    z-index: 1;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    letter-spacing: -2px;
}

.counter-ring .counter-value.bump {
    transform: scale(1.15);
}

.counter-label {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

/* Buttons - iOS style */
.btn-row {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.96);
    opacity: 0.85;
}

.btn-primary {
    flex: 1;
    background: var(--red);
    color: #fff;
    font-size: 0.92rem;
    padding: 16px 24px;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.2);
}

.btn-primary:hover {
    box-shadow: 0 4px 14px rgba(255, 59, 48, 0.25);
}

.btn-secondary {
    background: var(--surface-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--separator);
    padding: 14px 18px;
}

.btn-secondary:hover {
    background: var(--bg);
}

/* Tracker rows (iOS list style) */
.tracker-card {
    padding: 0;
    overflow: hidden;
}

.tracker-row {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 14px;
}

.tracker-row + .tracker-row {
    border-top: 1px solid var(--separator);
}

.tracker-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.tracker-icon-blue {
    background: var(--blue-bg);
}

.tracker-icon-orange {
    background: var(--orange-bg);
}

.tracker-info {
    flex: 1;
}

.tracker-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
}

.tracker-subtitle {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 1px;
}

.tracker-count {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    min-width: 32px;
    text-align: right;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tracker-count.bump {
    transform: scale(1.25);
}

.tracker-actions {
    display: flex;
    gap: 8px;
    padding: 12px 20px 16px;
    border-top: 1px solid var(--separator);
}

.btn-tracker {
    flex: 1;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-tracker:active {
    transform: scale(0.96);
}

.btn-add-blue {
    background: var(--blue-bg);
    color: var(--blue);
}
.btn-add-blue:hover { background: rgba(0, 122, 255, 0.12); }

.btn-add-orange {
    background: var(--orange-bg);
    color: var(--orange);
}
.btn-add-orange:hover { background: rgba(255, 149, 0, 0.12); }

.btn-paid {
    background: var(--green-bg);
    color: var(--green);
}
.btn-paid:hover { background: rgba(52, 199, 89, 0.12); }

/* Log - iOS list style */
.card-log {
    padding: 0;
    overflow: hidden;
}

.log-header {
    padding: 16px 20px 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.log-list {
    max-height: 300px;
    overflow-y: auto;
}

.log-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 20px;
    border-top: 1px solid var(--separator);
    transition: background 0.15s ease;
}

.log-entry:hover {
    background: var(--surface-secondary);
}

.log-date {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.log-count {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--red);
    background: var(--red-bg);
    padding: 4px 10px;
    border-radius: 20px;
}

.empty-state {
    text-align: center;
    padding: 36px 20px;
    color: var(--text-quaternary);
}

.empty-state p {
    font-size: 0.82rem;
    margin-top: 6px;
}

.empty-icon {
    font-size: 1.6rem;
    display: block;
    opacity: 0.6;
}

/* Danger */
.card-danger {
    background: transparent;
    box-shadow: none;
    padding: 8px 0;
    text-align: center;
}

.btn-danger-flat {
    background: none;
    border: none;
    color: var(--red);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-danger-flat:hover {
    background: var(--red-bg);
}

.btn-danger-flat:active {
    transform: scale(0.97);
}

/* Scrollbar */
.log-list::-webkit-scrollbar {
    width: 0;
}

/* Modal - iOS Alert style */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.15s ease;
}

.modal {
    background: var(--surface);
    border-radius: 14px;
    max-width: 300px;
    width: 100%;
    overflow: hidden;
    animation: modalIn 0.25s cubic-bezier(0.34, 1.2, 0.64, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-body {
    padding: 24px 20px 20px;
    text-align: center;
}

.modal-body h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.modal-body p {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--separator);
}

.modal-btn {
    padding: 14px;
    border: none;
    background: none;
    font-size: 0.92rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}

.modal-btn:active {
    background: var(--bg);
}

.modal-btn + .modal-btn {
    border-top: 1px solid var(--separator);
}

.modal-btn-cancel {
    color: var(--blue);
    font-weight: 400;
}

.modal-btn-confirm {
    color: var(--red);
    font-weight: 600;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Responsive */
@media (max-width: 420px) {
    .app {
        padding: 0 12px 40px;
    }

    .header {
        padding: 48px 0 8px;
    }

    .counter-ring {
        width: 140px;
        height: 140px;
    }

    .counter-ring .counter-value {
        font-size: 2.8rem;
    }
}
