:root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --text: #1d1d1f;
    --text-secondary: #6e6e73;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --border: #d2d2d7;
    --error: #ff3b30;
    --success: #34c759;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

header .subtitle {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Cards layout */
.cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 600px) {
    .cards {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Forms */
label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    color: var(--text-secondary);
}

input[type="text"],
input[type="number"],
textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s;
    margin-bottom: 0.75rem;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.25rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    width: 100%;
}

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

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button.secondary {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

button.secondary:hover {
    background: rgba(0, 113, 227, 0.05);
}

button.danger {
    background: var(--error);
}

button.danger:hover {
    background: #e0342b;
}

/* Errors */
.error {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 59, 48, 0.08);
    border-radius: 6px;
}

.hidden {
    display: none !important;
}

/* Room page */
.room-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.room-code {
    font-family: "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--accent);
    cursor: pointer;
    user-select: all;
}

.room-code:hover::after {
    content: " (click to copy)";
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: normal;
    font-weight: 400;
}

/* Participants */
.participants {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.participant-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background: rgba(0, 113, 227, 0.08);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
}

.participant-tag.owner {
    background: rgba(52, 199, 89, 0.1);
    color: var(--success);
}

/* Sections (views) */
section {
    display: none;
}

section.active {
    display: block;
}

/* Round */
.question-display {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.timer {
    font-family: "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    padding: 0.75rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.timer.warning {
    color: var(--error);
}

.answer-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Answers list */
.answers-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0;
}

.answers-list li {
    background: var(--bg);
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Actions bar */
.actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.actions button {
    width: auto;
    flex: 1;
    min-width: 140px;
}

/* Status */
.status {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-size: 1rem;
}

/* Round history */
.round-summary {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.round-summary h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.round-summary p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Connection status */
.connection-status {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 0.4rem;
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 100;
    transition: transform 0.3s;
    transform: translateY(-100%);
}

.connection-status.disconnected {
    background: var(--error);
    color: #fff;
    transform: translateY(0);
}

.connection-status.reconnecting {
    background: #ff9500;
    color: #fff;
    transform: translateY(0);
}
