:root {
    --bg: #F2F2F7;
    --surface: #FFFFFF;
    --surface-secondary: #FFFFFF;
    --text-primary: #000000;
    --text-secondary: #8E8E93;
    --accent: #007AFF;
    --danger: #FF3B30;
    --separator: #C6C6C8;
    --radius: 16px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    --font-stack: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #000000;
        --surface: #1C1C1E;
        --surface-secondary: #2C2C2E;
        --text-primary: #FFFFFF;
        --text-secondary: #98989D;
        --accent: #0A84FF;
        --separator: #38383A;
    }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; outline: none; }

body {
    background-color: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-stack);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Centered Search Layout */
.container-center {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.hero-title {
    font-size: 40px;
    font-weight: 700;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 17px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.search-box-large {
    width: 100%;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    display: flex;
    gap: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.search-box-large:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.search-input-large {
    flex: 1;
    border: none;
    background: transparent;
    padding: 16px;
    font-size: 18px;
    font-family: var(--font-stack);
    color: var(--text-primary);
}

.search-btn-large {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 0 24px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.search-btn-large:active { opacity: 0.8; }

/* Header */
header {
    margin-bottom: 30px;
    padding: 0 10px;
}

h1 {
    font-size: 34px;
    font-weight: 700;
    margin: 0 0 5px 0;
    letter-spacing: -0.5px;
}

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

/* iOS Grouped List Style */
.ios-list {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.ios-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: var(--surface);
    border-bottom: 0.5px solid var(--separator);
    transition: background 0.2s;
    position: relative;
}

.ios-item:last-child { border-bottom: none; }
.ios-item:active { background: var(--surface-secondary); }

.item-content {
    flex: 1;
    min-width: 0; /* Fix truncate */
}

.item-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
}

.item-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-meta {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

.chevron {
    color: #C7C7CC;
    margin-left: 12px;
    font-weight: 600;
    font-size: 18px;
}

/* Toolbar / Search */
.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    position: sticky;
    top: 20px;
    z-index: 100;
}

.search-bar {
    flex: 1;
    background: rgba(118, 118, 128, 0.12);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-input {
    background: transparent;
    border: none;
    font-size: 17px;
    color: var(--text-primary);
    width: 100%;
    font-family: var(--font-stack);
}

.search-input::placeholder { color: var(--text-secondary); }

.btn {
    color: var(--accent);
    font-size: 17px;
    font-weight: 400;
    background: transparent;
    border: none;
    padding: 10px 0;
    cursor: pointer;
}

.btn-primary {
    font-weight: 600;
}

/* Message Bubble Style for Detail View */
.msg-group {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.msg-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.msg-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.msg-body {
    font-size: 17px;
    line-height: 1.4;
    color: var(--text-primary);
    white-space: pre-wrap;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 40px;
    color: var(--accent);
    font-size: 17px;
}

.pagination a.disabled {
    color: var(--text-secondary);
    pointer-events: none;
}

@media (max-width: 600px) {
    .container { padding: 20px 16px; }
    h1 { font-size: 30px; }
    .hero-title { font-size: 32px; }
}
