/* --- Reset --------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; width: 100%; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  font-family: "Nunito", sans-serif; color: var(--ink);
  overflow-x: hidden;
  background:
    radial-gradient(1100px 420px at 12% -10%, rgba(34,197,94,.25), transparent 58%),
    radial-gradient(900px 420px at 95% 5%, rgba(14,165,233,.18), transparent 60%),
    linear-gradient(145deg, #f7fbf8, #e5f6ec);
}
h1, h2, h3, h4, strong, button { font-family: "Baloo 2", sans-serif; }

/* --- App shell ----------------------------------- */
.app-shell {
  width: min(1280px, calc(100% - 18px));
  max-width: calc(100vw - 18px);
  margin: 8px auto; display: grid; gap: 8px;
}

/* --- Header -------------------------------------- */
.main-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(255,255,255,.94), rgba(238,255,249,.9));
  border: 1px solid #d8e7de;
  border-radius: 14px;
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: hidden;
}
.main-header h1 { font-size: clamp(0.65rem,1.8vw,1.6rem); line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main-header p  { color: var(--muted); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main-header > div:first-child { min-width: 0; overflow: hidden; flex-shrink: 1; }
.header-right   { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.header-player-badge {
  height: 34px;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 10px 0 12px;
  color: #ffffff;
  font-weight: 800;
  font-size: clamp(0.6rem, 2vw, 0.86rem);
  background: linear-gradient(120deg, #0c6d99, #0ea5e9);
  border: 1px solid rgba(255,255,255,.35);
  box-shadow: 0 6px 14px rgba(14,165,233,.26);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 44vw;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 150ms, box-shadow 150ms, transform 90ms;
}
.header-player-badge:hover {
  background: linear-gradient(120deg, #0f84bb, #22bfff);
  box-shadow: 0 8px 18px rgba(14,165,233,.4);
  transform: translateY(-1px);
}
.header-player-badge:hover .header-badge-edit-hint {
  opacity: 1;
}
.header-player-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header-badge-edit-hint {
  font-size: 0.82em;
  opacity: 0.45;
  flex-shrink: 0;
  transition: opacity 150ms;
  line-height: 1;
}
.header-rename-btn {
  display: none;
}

.header-leave-btn {
  height: 34px;
  min-height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.35);
  background: linear-gradient(120deg, #ff6f7f, #e63946);
  color: #fff;
  font-size: clamp(0.6rem, 2vw, 0.94rem);
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  cursor: pointer;
  transition: transform 90ms, box-shadow 120ms, background 120ms;
  box-shadow: 0 6px 12px rgba(230,57,70,.22);
  white-space: nowrap;
  flex-shrink: 0;
}

.header-leave-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  font-size: 0.78rem;
  line-height: 1;
}

.header-leave-text {
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.header-leave-btn:hover {
  transform: translateY(-1px) scale(1.04);
  background: linear-gradient(120deg, #ff4558, #c42230);
}

/* --- Pills & badges ------------------------------ */
.status-pill {
  padding: 4px 10px; border-radius: 999px;
  background: #ecf5ff; color: #1654cb;
  border: 1px solid #cfe0ff; font-size: 0.85rem;
}
.phase-pill {
  padding: 4px 10px; border-radius: 999px;
  background: #f2fff8; color: #166534;
  border: 1px solid #b2e4c8; font-size: 1.64rem; font-weight: 700;
}
.badge {
  border-radius: 999px; padding: 2px 8px;
  background: #e8f4ff; border: 1px solid #c9e3ff;
  color: #1e5ccf; font-size: 0.78rem;
}
.badge.badge-active {
  background: linear-gradient(120deg,#5da8ff,#2864d8);
  color: #fff; border-color: transparent;
}

/* --- Buttons ------------------------------------- */
input, select, button { font: inherit; border-radius: 10px; }
input, select { border: 1px solid #cddce3; background: #fff; padding: 9px; color: var(--ink); min-height: 40px; }
.btn {
  border: 1px solid #cddce3; background: #fff; color: var(--ink);
  padding: 8px 12px; min-height: 40px; cursor: pointer;
  transition: transform 90ms, box-shadow 120ms, background 120ms, border-color 120ms;
  white-space: nowrap;
  font-weight: 800;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(20,35,55,.12); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: linear-gradient(120deg,#5da8ff,#2864d8); color: #fff; border: none; }
.btn-danger  { background: linear-gradient(120deg,#f46d75,var(--danger)); color: #fff; border: none; }
.btn:not(.btn-primary):not(.btn-danger) {
  background: linear-gradient(140deg, #ffffff, #f0fffa);
}
