:root { --bg-dark: #121212; --card-bg: #1e1e1e; --text-main: #fff; --primary: #3949ab; --danger: #e53935; --c-red: #d32f2f; --c-blue: #1976d2; --c-green: #388e3c; --c-yellow: #fbc02d; }
* { box-sizing: border-box; margin: 0; padding: 0; font-family: sans-serif; user-select: none; }
body { background: var(--bg-dark); color: var(--text-main); height: 100dvh; display: flex; flex-direction: column; overflow: hidden; padding: env(safe-area-inset-top) 1rem 1rem; touch-action: manipulation; }
.app-container { max-width: 800px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; height: 100%; }
header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0; flex-shrink: 0;}
.header-left { display: flex; align-items: center; gap: 10px; }
.global-hub-btn { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; background: rgba(255,255,255,0.1); border-radius: 8px; text-decoration: none; font-size: 1.5rem; }
select { background: var(--card-bg); color: #fff; padding: 5px; border-radius: 5px; touch-action: manipulation; }

.screen { display: none; flex: 1; flex-direction: column; }
.screen.active { display: flex; }
.card { background: var(--card-bg); padding: 2rem; border-radius: 12px; }
.center { justify-content: center; align-items: center; text-align: center; }

/* Stepper & Buttons */
.stepper { display: flex; align-items: center; justify-content: center; gap: 15px; margin: 20px 0; font-size: 1.5rem; font-weight: bold; }
.stepper button { width: 50px; height: 50px; font-size: 1.8rem; background: var(--primary); border: none; color: #fff; border-radius: 8px; touch-action: manipulation; }
.btn { padding: 15px; font-size: 1.2rem; font-weight: bold; border-radius: 8px; border: none; background: var(--primary); color: #fff; cursor: pointer; width: 100%; transition: 0.1s; touch-action: manipulation; }
.btn:active { transform: scale(0.98); }
.btn.danger { background: var(--danger); }
.btn.small { width: auto; padding: 10px 15px; font-size: 1rem; }
.btn.icon { flex-shrink: 0; width: auto; padding: 10px 15px; }

#btn-show-cards {
    margin: 20px;
}

/* Player name list on setup screen */
.name-list { width: 100%; max-height: 160px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.name-row { display: flex; align-items: center; gap: 10px; }
.name-row label { width: 24px; text-align: right; font-weight: bold; flex-shrink: 0; opacity: 0.7; }
.name-row input { flex: 1; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2); border-radius: 6px; color: #fff; padding: 8px 10px; font-size: 1rem; outline: none; }
.name-row input:focus { border-color: var(--primary); }

/* Collapsible */
details.mobile-details { width: 100%; background: var(--card-bg); border-radius: 8px; flex-shrink: 0;}
details.mobile-details summary { padding: 12px; font-weight: bold; text-align: center; cursor: pointer; outline: none; list-style: none; touch-action: manipulation; }
details.mobile-details summary::-webkit-details-marker { display: none; }
details.mobile-details[open] summary { border-bottom: 1px solid rgba(255,255,255,0.1); }
details.mobile-details div { padding: 10px; }

/* Table Area */
.table-area { flex: 1; display: flex; justify-content: center; align-items: center; gap: 5vw; background: #2e7d32; border-radius: 12px; margin-bottom: 15px; min-height: 0; padding: 20px; }
.uno-card { width: clamp(70px, 20vw, 120px); aspect-ratio: 2/3; border-radius: 8px; border: 4px solid #fff; display: flex; justify-content: center; align-items: center; font-size: clamp(2rem, 6vw, 4rem); font-weight: bold; color: #fff; text-shadow: 2px 2px 0 #000; cursor: pointer; position: relative; box-shadow: 0 4px 10px rgba(0,0,0,0.5); }
.uno-card.red { background: var(--c-red); }
.uno-card.blue { background: var(--c-blue); }
.uno-card.green { background: var(--c-green); }
.uno-card.yellow { background: var(--c-yellow); }
.card-back { background: #111; border-radius: 4px; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; font-size: clamp(1rem, 3vw, 2rem); color: var(--danger); border: 2px solid #fff; }

/* Hands (Spaced & Scrollable) */
.status-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 1.2rem; font-weight: bold; flex-shrink: 0;}
.hand-area { display: flex; gap: 15px; overflow-x: auto; padding: 15px 5px; min-height: clamp(140px, 30vw, 220px); scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
.hand-area .uno-card { flex-shrink: 0; transition: transform 0.2s; }
.hand-area .uno-card:active { transform: translateY(-5px); }

.modal { display: none; position: fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.8); z-index: 100; justify-content:center; align-items:center; padding: 1rem;}
.modal-content { background: var(--card-bg); padding: 20px; border-radius: 10px; max-width: 400px; width: 100%; position: relative; line-height: 1.5; max-height: 80vh; overflow-y: auto;}
.close-btn { position: absolute; right: 15px; top: 10px; font-size: 2rem; cursor: pointer; }
.rules-text { margin-top: 15px; }
.rules-text ul { padding-left: 20px; margin-top: 10px; }
.rules-text li { margin-bottom: 10px; }