:root {
    --bg: #f6f3eb;
    --bg-strong: #eadcca;
    --surface: rgba(255, 251, 245, 0.8);
    --surface-strong: #fffaf2;
    --ink: #1e1d1a;
    --muted: #6f6a5d;
    --accent: #c45c2c;
    --accent-strong: #8f3513;
    --accent-soft: rgba(196, 92, 44, 0.14);
    --line: rgba(30, 29, 26, 0.08);
    --shadow: 0 24px 60px rgba(84, 58, 33, 0.18);
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 18px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Avenir Next", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.7), transparent 36%),
        linear-gradient(180deg, #f1e3cf 0%, #f7f3ec 42%, #eee1cd 100%);
    color: var(--ink);
}

body {
    display: flex;
    justify-content: center;
    padding: 20px 14px calc(28px + env(safe-area-inset-bottom));
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    width: min(100%, 430px);
    min-height: calc(100vh - 40px);
    background: linear-gradient(180deg, rgba(255, 250, 242, 0.92), rgba(255, 255, 255, 0.72));
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 36px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.topbar,
.bottom-nav {
    padding: 18px 20px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent), #e7a642);
    color: white;
    display: grid;
    place-items: center;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.eyebrow,
.screen-kicker,
.text-label {
    margin: 0;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.72rem;
}

.brand-title,
.screen-header h2,
.card-line {
    margin: 0;
}

.brand-title {
    font-size: 1.4rem;
}

.icon-button,
.ghost-button,
.small-control,
.nav-button,
.save-button {
    border: 0;
    border-radius: 999px;
}

.icon-button,
.ghost-button,
.small-control,
.nav-button {
    background: rgba(255, 255, 255, 0.7);
    color: var(--ink);
}

.icon-button,
.ghost-button {
    padding: 12px 16px;
}

.screen-stack {
    flex: 1;
    padding: 4px 18px 0;
}

.screen {
    display: none;
    flex-direction: column;
    gap: 20px;
    min-height: 100%;
}

.screen.is-active {
    display: flex;
}

.screen-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.screen-header.compact {
    flex-direction: row;
    align-items: center;
    gap: 14px;
}

.screen-description {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.module-list {
    display: grid;
    gap: 14px;
}

.module-card {
    width: 100%;
    padding: 16px;
    border: 0;
    border-radius: var(--radius-lg);
    text-align: left;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line);
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 14px;
    align-items: center;
}

.module-card:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.module-thumb {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(135deg, #f0cf8d, #da7d53);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.module-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.module-title {
    margin: 0 0 4px;
    font-size: 1.05rem;
}

.module-meta,
.player-meta {
    color: var(--muted);
    font-size: 0.88rem;
}

.module-arrow {
    color: var(--accent-strong);
    font-weight: 700;
}

.player-card {
    background: linear-gradient(180deg, var(--surface-strong), rgba(255, 248, 239, 0.8));
    border-radius: var(--radius-xl);
    padding: 24px 18px;
    box-shadow: inset 0 0 0 1px var(--line);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.visual-frame {
    width: 138px;
    height: 138px;
    border-radius: 32px;
    background: linear-gradient(135deg, #f7ead8, #edd0b1);
    padding: 14px;
    box-shadow: 0 20px 40px rgba(166, 118, 63, 0.18);
}

.visual-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.text-pair {
    width: 100%;
    text-align: center;
    padding: 14px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.68);
}

.text-pair.accent {
    background: var(--accent-soft);
}

.card-line {
    margin-top: 8px;
    line-height: 1.24;
    font-size: clamp(1.2rem, 4vw, 1.7rem);
}

.player-meta {
    width: 100%;
    display: flex;
    justify-content: space-between;
}

.progress-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #efbb57);
    border-radius: inherit;
    transition: width 180ms ease;
}

.transport {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
}

.small-control {
    padding: 14px 10px;
}

.play-toggle {
    width: 112px;
    height: 112px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #ed9c46);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 16px 36px rgba(196, 92, 44, 0.36);
}

.settings-form {
    display: grid;
    gap: 14px;
}

.setting-row {
    display: grid;
    gap: 8px;
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line);
}

.setting-row input[type="number"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: white;
}

.switch-row {
    grid-template-columns: 1fr auto;
    align-items: center;
}

.switch-row input[type="checkbox"] {
    width: 22px;
    height: 22px;
}

.save-button {
    padding: 16px;
    background: var(--ink);
    color: white;
}

.bottom-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.nav-button {
    padding: 14px 10px;
    border: 1px solid transparent;
}

.nav-button.is-active {
    background: white;
    border-color: rgba(0, 0, 0, 0.06);
    color: var(--accent-strong);
}

@media (max-width: 380px) {
    .app-shell {
        min-height: calc(100vh - 28px);
    }

    .topbar,
    .bottom-nav {
        padding-left: 16px;
        padding-right: 16px;
    }

    .play-toggle {
        width: 96px;
        height: 96px;
    }
}
