* {
    box-sizing: border-box;
    touch-action: manipulation;
}

:root {
    --primary-color: #000;
    --bg-color: #fff;
    --text-color: #333;
    --nav-bg: #f8f8f8;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background: var(--nav-bg);
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 100;
    padding-top: var(--safe-top);
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0 1rem;
    display: flex;
    overflow-x: auto;
}

nav li {
    flex: none;
}

nav a {
    display: block;
    padding: 1.5rem 1rem;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    -webkit-user-select: none;
    user-select: none;
}

main {
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

/* Podcast Styles */
.episode-list {
    list-style: none;
    padding: 0;
}

.episode-item {
    padding: 1.5rem 0;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.episode-item h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.episode-item small {
    color: #666;
}

.player-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 2rem 0;
    width: 100%;
}

.playback-buttons {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    width: 100%;
    justify-content: center;
}

.btn-large {
    background: var(--primary-color);
    color: var(--bg-color);
    border: none;
    padding: 1.5rem 1rem;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 8px;
    flex: 1;
    max-width: 120px;
    cursor: pointer;
    text-align: center;
}

.progress-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

input[type="range"] {
    width: 100%;
    height: 12px;
    -webkit-appearance: none;
    background: #ddd;
    border-radius: 6px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--bg-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-family: monospace;
    font-size: 1rem;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding-top: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-group label {
    font-weight: bold;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
}

.form-group input {
    padding: 1.25rem;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-color);
}

footer#debug-footer {
    width: 100%;
    background: var(--nav-bg);
    border-top: 1px solid #ddd;
    z-index: 1000;
    margin-top: auto;
    padding-bottom: var(--safe-bottom);
}

#debug-logs {
    padding: 1rem 2rem;
}

#debug-logs summary {
    list-style: none;
    cursor: pointer;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    font-weight: bold;
    color: var(--primary-color);
}

#debug-logs summary::-webkit-details-marker {
    display: none;
}

#debug-logs-list {
    list-style: none;
    margin: 1rem 0;
    padding: 0;
    font-family: monospace;
    font-size: 0.8rem;
    max-height: 30vh;
    overflow-y: auto;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

section {
    display: none;
}

section:target, section#home:not(:has(~ section:target)) {
    display: block;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #121212;
        --text-color: #e0e0e0;
        --nav-bg: #1e1e1e;
        --primary-color: #fff;
    }
}
