/* Reachy Dance Duo - mobile-first.
 * Single column. Big touch targets. No hover-only states. iOS-safe.
 */

:root {
    --bg: #0a0a0c;
    --panel: rgba(255, 255, 255, 0.04);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text: #e6e6ea;
    --text-muted: #8a8a93;
    --accent: #00f2ff;
    --accent-warm: #ff007a;
    --warn: #fc6;
    --err: #f66;
    --ok: #6f6;
    --shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

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

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: contain;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.5rem;
}

h1 {
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
}

.chip {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
}

main {
    padding: 0.75rem 1rem 2rem;
    max-width: 540px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.step {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

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

.row {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    align-items: center;
    margin: 0.6rem 0;
}

.stat {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--panel-border);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-family: ui-monospace, SF Mono, monospace;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.stat b { color: var(--accent); font-weight: 500; }

.slider-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.6rem 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.slider-row span { min-width: 5.5rem; }
.slider-row input[type="range"] { flex: 1; }
.slider-row b {
    font-family: ui-monospace, SF Mono, monospace;
    color: var(--accent);
    font-weight: 500;
    min-width: 4.5rem;
    text-align: right;
}

button {
    font: inherit;
    border: none;
    border-radius: 12px;
    padding: 0.85rem 1.2rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: transform 0.05s ease, opacity 0.15s ease;
}
button:disabled { opacity: 0.4; cursor: not-allowed; }
button:active:not(:disabled) { transform: scale(0.98); }

button.primary {
    background: linear-gradient(135deg, var(--accent-warm), #ff4b4b);
    color: white;
    font-weight: 600;
}
button.secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid var(--panel-border);
}
button.big {
    width: 100%;
    padding: 1.1rem;
    font-size: 1rem;
    margin-top: 0.5rem;
}

input[type="text"] {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--panel-border);
    color: var(--text);
    padding: 0.85rem 1rem;
    border-radius: 12px;
    font-size: 1rem;
    -webkit-appearance: none;
}
input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
}

ul.robot-list, ul.results {
    list-style: none;
    margin: 0.6rem 0;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--panel-border);
}

ul.robot-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--panel-border);
}
ul.robot-list li:last-child { border-bottom: none; }
.rname { font-weight: 500; flex: 1; }
.rid { color: var(--text-muted); font-size: 0.75rem; font-family: ui-monospace, monospace; }

ul.results {
    max-height: 18rem;
    overflow-y: auto;
}
ul.results li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--panel-border);
    cursor: pointer;
}
ul.results li:last-child { border-bottom: none; }
ul.results li:active { background: rgba(255, 255, 255, 0.04); }
ul.results img, .thumb-placeholder {
    width: 44px; height: 44px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}
.thumb-placeholder { background: rgba(255, 255, 255, 0.05); }
ul.results .meta { flex: 1; min-width: 0; }
ul.results .rname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ul.results .err { color: var(--err); padding: 0.6rem 0.75rem; }

.tabs {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0 0.75rem;
    border-bottom: 1px solid var(--panel-border);
}
.tab {
    background: transparent;
    color: var(--text-muted);
    padding: 0.6rem 0.9rem;
    border-radius: 10px 10px 0 0;
    border: none;
    font-size: 0.9rem;
}
.tab.active {
    color: var(--text);
    background: rgba(0, 242, 255, 0.08);
    box-shadow: inset 0 -2px 0 var(--accent);
}

.panel { padding-top: 0.5rem; }

audio {
    width: 100%;
    margin: 0.75rem 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
}

.search-row { gap: 0.5rem; }
.search-row input { flex: 1; }

.dev {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.dev summary {
    padding: 0.4rem 0;
    cursor: pointer;
    user-select: none;
}
.dev pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 0.6rem;
    max-height: 12rem;
    overflow-y: scroll;
    font-family: ui-monospace, monospace;
    font-size: 0.7rem;
    line-height: 1.4;
    white-space: pre-wrap;
}
.dev .ev { color: var(--accent); }
.dev .state { color: #6cf; }
.dev .move, .dev .block { color: var(--warn); }
.dev .err { color: var(--err); }
.dev .warn { color: var(--warn); }

.status-message {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    margin: 0.75rem 0;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    transition: all 0.3s ease;
}

.status-message b {
    display: inline-block;
    margin-bottom: 0.25rem;
}

.status-message.pulse {
    border-color: rgba(0, 242, 255, 0.4);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.1);
    animation: pulse-glow 2s infinite ease-in-out;
}

.status-message.success {
    border-color: rgba(102, 255, 102, 0.4);
    background: rgba(102, 255, 102, 0.05);
}

.status-message.err-status {
    border-color: rgba(255, 102, 102, 0.4);
    background: rgba(255, 102, 102, 0.05);
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 5px rgba(0, 242, 255, 0.1); }
    50% { box-shadow: 0 0 15px rgba(0, 242, 255, 0.3); }
    100% { box-shadow: 0 0 5px rgba(0, 242, 255, 0.1); }
}
