:root {
  --bg: #f7f7fb;
  --card: #ffffff;
  --text: #171724;
  --muted: #74748a;
  --primary: #6d5dfc;
  --primary-2: #5849df;
  --danger: #e94f64;
  --border: #e7e7f2;
  --shadow: 0 18px 50px rgba(24, 24, 48, .12);
}

body.dark {
  --bg: #101018;
  --card: #1b1b27;
  --text: #f4f4fb;
  --muted: #aaaabe;
  --border: #2d2d3d;
  --shadow: 0 18px 50px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html { height: 100%; overflow: hidden; }
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, rgba(109, 93, 252, .14), transparent 35%), var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; }
#app { height: 100dvh; max-width: 540px; margin: 0 auto; position: relative; overflow: hidden; }
.screen { height: 100dvh; display: none; padding: clamp(12px, 3.5vh, 24px); overflow: hidden; }
.screen.active { display: flex; flex-direction: column; }
.brand, .centerCard { margin: auto 0; text-align: center; }
.brand h1 { font-size: 46px; margin: 10px 0 4px; letter-spacing: -2px; }
.brand p, .muted { color: var(--muted); }
.logo {
  width: 84px; height: 84px; border-radius: 24px; display: inline-grid; place-items: center;
  background: linear-gradient(145deg, var(--primary), #9a7cff); color: white;
  font-size: 40px; font-weight: 900; box-shadow: var(--shadow);
}
.logo i { line-height: 1; }
.logo.small { width: 62px; height: 62px; font-size: 30px; }
.primary, .secondary, .danger, .ghost {
  min-height: 48px; border-radius: 16px; padding: 0 16px; font-weight: 800;
}
.primary { background: var(--primary); color: white; box-shadow: 0 14px 32px rgba(109, 93, 252, .28); }
.primary:hover { background: var(--primary-2); }
.secondary { background: rgba(109, 93, 252, .12); color: var(--primary); }
.danger { background: var(--danger); color: white; box-shadow: 0 14px 32px rgba(233, 79, 100, .2); }
.ghost { background: transparent; color: var(--text); }
.big { width: 100%; font-size: 19px; min-height: 62px; margin-bottom: 8px; }
.bottom { margin-top: auto; width: 100%; }
.gear {
  position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 14px;
  background: var(--card); box-shadow: var(--shadow); color: var(--primary); font-size: 21px;
  display: grid; place-items: center;
}
body.dark .gear { color: #ffffff; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex: 0 0 auto; }
.topbar h2 { margin: 0; }
.card, .centerCard, .modal {
  background: rgba(255,255,255,.72); background: color-mix(in srgb, var(--card) 90%, transparent);
  border: 1px solid var(--border); border-radius: 22px; padding: 16px; box-shadow: var(--shadow);
}
label { display: block; margin: 8px 0 6px; font-weight: 800; }
input, select, textarea {
  width: 100%; border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 14px; padding: 12px; outline: none;
}
#categorySelect option[value="TODAS"] { font-weight: 900; }
.row { display: flex; align-items: center; }
.gap { gap: 8px; }
.sortable { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; overflow: auto; min-height: 0; }
.playerItem { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 9px 10px; }
.drag { user-select: none; color: var(--muted); font-size: 20px; }
.playerItem span.name { flex: 1; font-weight: 800; }
.playerItem button { background: transparent; color: var(--danger); font-weight: 900; }
dialog { border: 0; background: transparent; width: min(92vw, 520px); max-height: 92dvh; overflow: auto; }
dialog::backdrop { background: rgba(7, 7, 18, .58); backdrop-filter: blur(7px); }
.modal { color: var(--text); }
.modal h2 { margin-top: 0; }
.modalActions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.switchLine { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.switchLine input { width: 22px; height: 22px; }
.settingsBlock { display: grid; gap: 8px; margin-top: 12px; }
.settingsBlock .danger { width: 100%; }
.settingsGroupsList { display: grid; gap: 8px; max-height: 180px; overflow: auto; }
.settingsGroupItem {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 10px;
}
.settingsGroupItem strong, .settingsGroupItem small { display: block; text-align: left; }
.settingsGroupItem small { color: var(--muted); margin-top: 2px; }
.groupActions { display: flex; gap: 6px; flex: 0 0 auto; }
.groupActions button { min-height: 38px; border-radius: 12px; padding: 0 10px; font-size: 13px; }
.inlineActions { margin-top: 4px; }
.revealWrap { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: clamp(8px, 2vh, 14px); }
.revealWrap h1 { font-size: clamp(28px, 8vw, 38px); margin: 0 0 4px; }
.secretCard {
  width: 100%; min-height: min(240px, 34dvh); border-radius: 26px; background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow); display: grid; place-items: center; padding: 24px; user-select: none;
}
.secretContent { display: none; }
.secretCard.revealed .tapText { display: none; }
.secretCard.revealed .secretContent { display: grid; gap: 8px; }
.secretContent small, .secretContent em { color: var(--muted); }
.secretContent strong { font-size: clamp(30px, 9vw, 42px); overflow-wrap: anywhere; }
.result h1 { font-size: clamp(30px, 9vw, 42px); margin: 8px 0 20px; overflow-wrap: anywhere; }
.badge { display: inline-flex; padding: 10px 14px; border-radius: 999px; background: rgba(233, 79, 100, .13); color: var(--danger); font-weight: 900; margin: 4px; }
#playersScreen .card { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#playersScreen .bottom { flex: 0 0 auto; margin-top: 10px; }
@media (max-width: 420px) {
  .row { flex-direction: column; }
  .row button { width: 100%; }
  .brand h1 { font-size: 38px; }
  .brand p, .muted { margin: 6px 0; }
  .settingsGroupItem { align-items: stretch; flex-direction: column; }
  .groupActions button { flex: 1; }
}
@media (max-height: 680px) {
  .logo { width: 68px; height: 68px; font-size: 32px; }
  .centerCard h2, .modal h2 { margin: 8px 0; }
  .secretCard { min-height: 190px; }
}
