/* DragusLive — mobile-first, dark theme da master */
:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --surface2:  #252837;
  --border:    #2e3248;
  --accent:    #7c5cbf;
  --accent2:   #a07fd4;
  --danger:    #c0392b;
  --warn:      #d97706;
  --ok:        #27ae60;
  --text:      #e8e9f0;
  --muted:     #8b8fa8;
  --radius:    10px;
}

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

html { font-size: 16px; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
}

/* Layout */
.page { max-width: 600px; margin: 0 auto; padding: 0 1rem 5rem; }
.page-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
}
.page-header h1 { font-size: 1.1rem; font-weight: 700; }
.page-header .sub { font-size: .8rem; color: var(--muted); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: .75rem 0;
}
.card-title { font-weight: 700; font-size: .95rem; margin-bottom: .4rem; }
.card-sub   { font-size: .8rem; color: var(--muted); }

/* Bottoni */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .4rem;
  padding: .75rem 1.25rem;
  border-radius: var(--radius);
  border: none; cursor: pointer;
  font-size: 1rem; font-weight: 600;
  text-decoration: none;
  transition: opacity .15s;
  min-height: 48px;
}
.btn:active { opacity: .75; }
.btn-full  { width: 100%; }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-ok        { background: var(--ok); color: #fff; }
.btn-warn      { background: var(--warn); color: #fff; }
.btn-sm { padding: .4rem .85rem; font-size: .85rem; min-height: 36px; }

/* Form */
.form-group { margin: .75rem 0; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }
input, select, textarea {
  width: 100%; padding: .7rem .9rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 1rem;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
textarea { resize: vertical; min-height: 80px; }

/* Badge allineamento */
.badge {
  display: inline-block; padding: .2rem .6rem; border-radius: 20px;
  font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.badge-drago    { background: #5a1a1a; color: #ff6b6b; }
.badge-buono    { background: #1a3a5a; color: #6bc5ff; }
.badge-cattivo  { background: #3a2a1a; color: #ffaa50; }
.badge-vampiro  { background: #3a1a5a; color: #d48eff; }
.badge-dragonide{ background: #1a3a2a; color: #5aff9a; }

/* Player list */
.player-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .85rem 1rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); margin: .5rem 0;
  cursor: pointer; text-decoration: none; color: var(--text);
}
.player-item:active { opacity: .7; }
.player-item.done   { border-color: var(--ok); opacity: .65; }
.player-item.dead   { opacity: .4; }
.player-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--accent); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem; flex-shrink: 0;
}
.player-info { flex: 1; min-width: 0; }
.player-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-role { font-size: .8rem; color: var(--muted); }

/* Status pill */
.pill {
  display: inline-block; padding: .15rem .55rem;
  border-radius: 20px; font-size: .72rem; font-weight: 600;
}
.pill-alive   { background: #1a3a1a; color: #5aff5a; }
.pill-dead    { background: #3a1a1a; color: #ff5a5a; }
.pill-ghost   { background: #2a2a3a; color: #aaa; }
.pill-vampire { background: #3a1a5a; color: #d48eff; }
.pill-mannaro { background: #3a3a1a; color: #ffd75a; }

/* Win condition bar */
.win-bar { margin: .75rem 0; }
.win-bar-label { display: flex; justify-content: space-between; font-size: .8rem; margin-bottom: .3rem; }
.win-bar-track { height: 10px; background: var(--surface2); border-radius: 5px; overflow: hidden; }
.win-bar-fill  { height: 100%; border-radius: 5px; transition: width .4s; }
.fill-danger   { background: var(--danger); }
.fill-ok       { background: var(--ok); }
.fill-warn     { background: var(--warn); }

/* Alert */
.alert {
  padding: .85rem 1rem; border-radius: var(--radius);
  margin: .75rem 0; font-weight: 600;
}
.alert-danger { background: #3a1a1a; border: 1px solid var(--danger); color: #ff8080; }
.alert-ok     { background: #1a3a1a; border: 1px solid var(--ok); color: #80ff80; }
.alert-warn   { background: #3a2a1a; border: 1px solid var(--warn); color: #ffcc80; }

/* Sezione */
.section-title {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
  margin: 1.25rem 0 .5rem;
}

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tab {
  flex: 1; padding: .65rem; text-align: center; cursor: pointer;
  font-size: .85rem; font-weight: 600; color: var(--muted);
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--accent2); border-color: var(--accent2); }

/* Bottom nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; z-index: 20;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: .6rem .25rem; text-decoration: none; color: var(--muted);
  font-size: .7rem; font-weight: 600; gap: .2rem;
}
.nav-item.active { color: var(--accent2); }
.nav-icon { font-size: 1.3rem; }

/* Divider */
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* Checklist notte */
.night-queue { list-style: none; }
.night-queue li {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--border); margin: .4rem 0;
  background: var(--surface2);
}
.night-queue li.done { border-color: var(--ok); opacity: .6; }
.night-queue li .check { font-size: 1.2rem; }

/* Modal overlay */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  z-index: 100; display: flex; align-items: flex-end;
}
.modal-sheet {
  background: var(--surface); border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.5rem 1rem 2rem; width: 100%; max-height: 90dvh; overflow-y: auto;
}
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none; color: var(--muted); font-size: 1.5rem; cursor: pointer;
}

/* Loader */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Utils */
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.text-muted  { color: var(--muted); }
.text-sm     { font-size: .85rem; }
.text-center { text-align: center; }
.text-danger { color: #ff6b6b; }
.text-ok     { color: #5aff5a; }
.text-warn   { color: #ffd75a; }
.hidden { display: none !important; }

/* Login */
.login-wrap {
  width: 100%; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.75rem 1.5rem;
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
}
.login-head { text-align: center; margin-bottom: 1.5rem; }
.login-logo { font-size: 2.75rem; line-height: 1; margin-bottom: .4rem; }
.login-title {
  font-family: 'Cinzel', serif;
  color: var(--accent2);
  font-size: 1.35rem; font-weight: 600;
}
.login-sub { color: var(--muted); font-size: .8rem; margin-top: .35rem; }
.password-field { position: relative; }
.password-field input { padding-right: 2.6rem; }
.password-toggle {
  position: absolute; right: .6rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 1.1rem; line-height: 1;
  padding: .3rem;
}
.password-toggle:hover { color: var(--accent2); }
.login-card a { color: var(--accent2); text-decoration: none; }
.login-card a:hover { text-decoration: underline; }
