/* Goggyland – website styles (start page, setup, account, leaderboard, admin). */
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-display: swap;
  font-weight: 300 900;
  src: url('/assets/fonts/figtree-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-display: swap;
  font-weight: 300 900;
  src: url('/assets/fonts/figtree-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --ink: #2b1d4a;
  --ink-2: #5d5080;
  --ink-3: #8c82a8;
  --bg-top: #bfe6ff;
  --bg-bottom: #fde4f3;
  --card: #ffffff;
  --soft: #f4efff;
  --soft-2: #faf8ff;
  --soft-3: #f1eaff;
  --field: #ffffff;
  --line: #2b1d4a;
  --line-soft: #e4dcf8;
  --glass: rgba(255, 255, 255, 0.86);
  --cloud-bg: #ffffff;
  --purple: #7b4dff;
  --purple-2: #a98bff;
  --pink: #ff5d8f;
  --mint: #2fc795;
  --sun: #ffd23f;
  --sky: #5ec8ff;
  --red: #ef4444;
  --amber: #f59e0b;
  --discord: #5865f2;
  --radius: 18px;
  --border: 2.5px solid var(--line);
  --shadow: 0 4px 0 var(--line);
  --font: 'Figtree', ui-rounded, 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
}

/* Dark mode: chosen in the header / phone settings (data-theme on <html>, see js/theme.js). */
:root[data-theme='dark'] {
  color-scheme: dark;
  --ink: #f1edff;
  --ink-2: #c6bde6;
  --ink-3: #9088b3;
  --bg-top: #130e2b;
  --bg-bottom: #2a1338;
  --card: #241d43;
  --soft: #2e2655;
  --soft-2: #29214c;
  --soft-3: #392e6b;
  --field: #1a1433;
  --line: #08050f;
  --line-soft: #3b3268;
  --glass: rgba(24, 18, 48, 0.88);
  --cloud-bg: rgba(150, 125, 255, 0.12);
  --purple: #9b7bff;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom)) fixed;
  min-height: 100vh;
  line-height: 1.5;
  font-size: 16px;
}

a {
  color: var(--purple);
  font-weight: 700;
}

img,
svg,
canvas {
  display: block;
}

.i {
  flex: none;
}

h1,
h2,
h3 {
  line-height: 1.15;
  margin: 0 0 0.5em;
  font-weight: 900;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 0.8em;
}

.muted {
  color: var(--ink-2);
}

.wrap {
  width: min(1180px, 100% - 32px);
  margin-inline: auto;
}

.narrow {
  width: min(760px, 100% - 32px);
  margin-inline: auto;
}

.narrow-wide {
  width: min(980px, 100% - 32px);
  margin-inline: auto;
}

.row {
  display: flex;
  align-items: center;
}

.gap {
  gap: 10px;
}

.center {
  justify-content: center;
}

.end {
  justify-content: flex-end;
}

.between {
  justify-content: space-between;
}

.wrap-row {
  flex-wrap: wrap;
  gap: 8px;
}

.stack {
  display: grid;
  gap: 14px;
}

.pad {
  padding: 16px;
}

/* ------------------------------------------------------------------ sky */
.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.cloud {
  position: absolute;
  width: 180px;
  height: 56px;
  background: var(--cloud-bg);
  border-radius: 60px;
  opacity: 0.75;
  animation: drift 70s linear infinite;
}

.cloud::before,
.cloud::after {
  content: '';
  position: absolute;
  background: var(--cloud-bg);
  border-radius: 50%;
}

.cloud::before {
  width: 80px;
  height: 80px;
  left: 28px;
  top: -40px;
}

.cloud::after {
  width: 60px;
  height: 60px;
  left: 92px;
  top: -26px;
}

.cloud.c1 {
  top: 14%;
  left: -200px;
}

.cloud.c2 {
  top: 46%;
  left: -200px;
  animation-delay: -30s;
  transform: scale(0.7);
}

.cloud.c3 {
  top: 76%;
  left: -200px;
  animation-delay: -52s;
  transform: scale(0.85);
}

@keyframes drift {
  to {
    translate: calc(100vw + 400px) 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cloud {
    animation: none;
    left: 10%;
  }
}

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  min-height: 44px;
  border: var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: 800 15px/1 var(--font);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--line);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
  white-space: nowrap;
}

.btn:hover {
  filter: brightness(1.05);
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--line);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn:focus-visible,
.chip-btn:focus-visible,
input: focus-visible,
select: focus-visible,
textarea: focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--purple);
  color: #fff;
}

.btn-play {
  background: var(--pink);
  color: #fff;
}

.btn-discord {
  background: var(--discord);
  color: #fff;
}

.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn-xl {
  min-height: 56px;
  padding: 14px 26px;
  font-size: 18px;
  border-radius: 18px;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: 800 13px/1 var(--font);
  text-decoration: none;
}

/* ------------------------------------------------------------------ header & footer */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border-bottom: var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand-name {
  font-weight: 900;
  font-size: 24px;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sm .brand-logo {
  width: 34px;
  height: 34px;
}

.brand-sm .brand-name {
  font-size: 19px;
}

.main-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  padding: 8px 12px;
  border-radius: 12px;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 800;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--ink);
  background: var(--soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-main {
  padding: 28px 0 56px;
  min-height: calc(100vh - 220px);
}

.site-footer {
  border-top: var(--border);
  background: var(--glass);
  padding: 22px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
}

.footer-brand p {
  margin: 6px 0 0;
  color: var(--ink-2);
  font-size: 14px;
}

.footer-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14px;
}

.footer-links a:hover {
  color: var(--ink);
}

@media (max-width: 760px) {
  .main-nav {
    display: none;
  }
  .header-inner {
    justify-content: space-between;
  }
  .hide-sm {
    display: none;
  }
  .brand-name {
    font-size: 20px;
  }
  .btn-discord span {
    display: none;
  }
}

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.section {
  margin-top: 44px;
}

.section-title,
.page-title {
  font-size: clamp(26px, 4vw, 36px);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ------------------------------------------------------------------ start page */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 34px;
  align-items: center;
  padding-top: 10px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 2px solid var(--line);
  font-weight: 800;
  font-size: 14px;
}

.hero-title {
  font-size: clamp(52px, 8vw, 92px);
  margin: 14px 0 10px;
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.hero-title span {
  background: linear-gradient(100deg, var(--purple) 10%, var(--pink) 60%, #ff9f43);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  filter: drop-shadow(0 5px 0 var(--ink));
}

.hero-lead {
  font-size: 18px;
  color: var(--ink-2);
  max-width: 34em;
}

.hero-cta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 22px 0 10px;
}

.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 2px solid var(--line);
}

.online-pill .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(47, 199, 149, 0.25);
}

.hero-note {
  font-size: 14px;
  color: var(--ink-3);
  font-weight: 600;
}

.hero-stage {
  padding: 0;
  overflow: hidden;
  aspect-ratio: 7 / 5;
  background: linear-gradient(#fff1f7, #ffd9ea);
}

.demo-canvas {
  width: 100%;
  height: 100%;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.feature h3 {
  font-size: 19px;
  margin-top: 12px;
}

.feature p {
  margin: 0;
  color: var(--ink-2);
}

.feature-icon {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--sun);
}

.feature:nth-child(2) .feature-icon {
  background: var(--sky);
}

.feature:nth-child(3) .feature-icon {
  background: var(--pink);
  color: #fff;
}

.feature:nth-child(4) .feature-icon {
  background: var(--mint);
}

.feature:nth-child(5) .feature-icon {
  background: #ffb347;
}

.feature:nth-child(6) .feature-icon {
  background: var(--purple-2);
  color: #fff;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.step {
  display: flex;
  gap: 14px;
}

.step h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.step p {
  margin: 0;
  color: var(--ink-2);
}

.step-n {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  font-weight: 900;
  font-size: 20px;
  border: 2px solid var(--line);
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .feature-grid,
  .steps {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .feature-grid,
  .steps {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 18px;
  }
}

/* ------------------------------------------------------------------ forms */
.field {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.field small {
  font-weight: 600;
  color: var(--ink-2);
}

.field small.ok {
  color: #138a5f;
}

.field small.bad {
  color: var(--red);
}

input,
select,
textarea {
  font: 600 16px var(--font);
  color: var(--ink);
  background: var(--field);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
}

.row input {
  flex: 1;
  min-width: 0;
}

textarea {
  resize: vertical;
}

/* ------------------------------------------------------------------ welcome / account */
.welcome-card,
.account-card {
  display: grid;
  gap: 20px;
}

.welcome-head,
.account-head {
  display: flex;
  gap: 16px;
  align-items: center;
}

.welcome-head h1 {
  font-size: clamp(26px, 4vw, 34px);
  margin-bottom: 4px;
}

.welcome-head p {
  margin: 0;
  color: var(--ink-2);
}

.welcome-form {
  display: grid;
  gap: 18px;
}

.account-head h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.coin-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.stat {
  background: var(--soft);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  display: grid;
}

.stat small {
  font-weight: 800;
  color: var(--ink-2);
}

.stat strong {
  font-size: 26px;
  line-height: 1.1;
}

.stat span {
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 700;
}

.account-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.danger-zone {
  border: 2px dashed var(--red);
  border-radius: 14px;
  padding: 12px 16px;
}

.danger-zone summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 8px;
}

.danger-zone p {
  margin: 10px 0;
}

@media (max-width: 640px) {
  .stats-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* ------------------------------------------------------------------ goggy figures in the DOM */
.goggy-figure,
.goggy-head {
  display: inline-block;
  flex: none;
}

.goggy-head {
  vertical-align: middle;
}

.goggy-canvas.is-head {
  border-radius: 10px;
  background: var(--soft-3);
}

/* Role pills: --rc is the role colour (set per pill). */
.role-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  vertical-align: middle;
}

.role-pill {
  --rc: var(--purple);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px 2px 7px;
  border-radius: 999px;
  border: 2px solid var(--rc);
  background: color-mix(in srgb, var(--rc) 14%, var(--card));
  color: color-mix(in srgb, var(--rc) 70%, var(--ink));
  font-size: 12px;
  font-weight: 900;
  line-height: 1.3;
  white-space: nowrap;
}

.role-pill .i {
  color: var(--rc);
}

.role-dot {
  display: inline-block;
  flex: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid rgba(43, 29, 74, 0.35);
}

/* ------------------------------------------------------------------ leaderboard */
.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.board h2 {
  font-size: 20px;
}

.board-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.board-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--soft);
}

.board-list .rank {
  width: 26px;
  text-align: center;
  font-weight: 900;
  color: var(--ink-2);
}

.board-list .who {
  flex: 1;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-list .top-1 {
  background: #fff4c2;
  color: #2b1d4a;
}

.board-list .top-2 {
  background: var(--soft);
}

.board-list .top-3 {
  background: #ffe6d1;
  color: #2b1d4a;
}

.board-list .top-1 .rank,
.board-list .top-3 .rank {
  color: #5d5080;
}

/* ------------------------------------------------------------------ legal / message */
.prose h1 {
  font-size: 32px;
}

.prose h2 {
  font-size: 22px;
  margin-top: 1.2em;
}

.message-card {
  text-align: center;
  display: grid;
  justify-items: center;
}

.message-goggy {
  margin-bottom: 10px;
  animation: bounce 2.4s ease-in-out infinite;
}

@keyframes bounce {
  50% {
    transform: translateY(-8px);
  }
}

/* ------------------------------------------------------------------ toasts */
.toasts {
  position: fixed;
  z-index: 100;
  left: 50%;
  top: 14px;
  translate: -50% 0;
  display: grid;
  gap: 8px;
  width: min(420px, 100% - 24px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 2px solid var(--line);
  box-shadow: 0 3px 0 var(--line);
  font-weight: 700;
  animation: toast-in 0.25s ease-out;
  transition: opacity 0.3s, transform 0.3s;
}

.toast.out {
  opacity: 0;
  transform: translateY(-8px);
}

.toast-success .i {
  color: var(--mint);
}

.toast-error {
  background: #fff1f1;
}

.toast-error .i {
  color: var(--red);
}

.toast-coins .i {
  color: #d39e00;
}

.toast-msg .i {
  color: var(--purple);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.97);
  }
}

/* ------------------------------------------------------------------ admin */
.admin-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}

.admin-tab.is-active {
  background: var(--purple);
  color: #fff;
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--pink);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.admin .card {
  margin-bottom: 18px;
}

.admin .card h2,
.admin .card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.admin-grid .card {
  margin: 0;
}

.stat-card {
  display: grid;
  gap: 2px;
}

.stat-card small {
  font-weight: 800;
  color: var(--ink-2);
}

.stat-card strong {
  font-size: 28px;
  white-space: nowrap;
}

.warn-card {
  background: #fff8e6;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.table th,
.table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1.5px solid var(--line-soft);
  white-space: nowrap;
}

.table th {
  font-weight: 900;
  color: var(--ink-2);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table td a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e8fbf3;
  color: #0d7a52;
  font-weight: 800;
  font-size: 13px;
}

.pill-red {
  background: #ffe5e5;
  color: #b91c1c;
}

.pill-amber {
  background: #fff3d6;
  color: #9a6400;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--soft);
  border: 1.5px solid var(--line-soft);
  font-weight: 700;
  font-size: 14px;
}

.chip-x {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: var(--card);
  color: var(--red);
  cursor: pointer;
}

.admin-user .user-head {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.admin-user .user-head p {
  margin: 0 0 4px;
}

.admin-user .user-head p > .i {
  display: inline-block;
  vertical-align: -3px;
}

.admin-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.admin-actions .card {
  margin: 0;
  display: grid;
  gap: 10px;
  align-content: start;
}

.action-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-form input,
.action-form select,
.action-form textarea {
  flex: 1 1 140px;
  width: auto;
}

.report-reason {
  font-weight: 700;
  background: #fff8e6;
  border-radius: 10px;
  padding: 8px 12px;
}

.report-log {
  list-style: none;
  padding: 10px 12px;
  margin: 0 0 12px;
  background: var(--soft);
  border-radius: 12px;
  font-size: 14px;
  display: grid;
  gap: 3px;
}

.report-log .is-target {
  background: #ffe5ee;
  border-radius: 6px;
}

.small {
  font-size: 13px;
}

.action-form.inline {
  display: inline-flex;
}

/* ------------------------------------------------------------------ admin: roles */
.role-list {
  display: grid;
  gap: 0;
  padding-top: 8px;
  padding-bottom: 8px;
}

.role-row {
  display: grid;
  grid-template-columns: auto minmax(120px, 0.8fr) minmax(0, 1.4fr) auto auto;
  grid-template-areas: 'move name bubble info act';
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1.5px solid var(--line-soft);
}

.role-row .role-move {
  grid-area: move;
}

.role-row .role-name {
  grid-area: name;
}

.role-row .bubble-preview {
  grid-area: bubble;
  justify-self: start;
}

.role-row .role-info {
  grid-area: info;
}

.role-row .role-act {
  grid-area: act;
}

.role-row:last-child {
  border-bottom: 0;
}


.role-move {
  display: grid;
  gap: 2px;
  width: 26px;
}

.mini-btn,
.mini-gap {
  display: grid;
  place-items: center;
  width: 26px;
  height: 22px;
}

.mini-btn {
  border: 1.5px solid var(--line-soft);
  border-radius: 7px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  padding: 0;
}

.mini-btn:hover {
  border-color: var(--purple);
  color: var(--purple);
}

.role-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.bubble-preview {
  display: inline-block;
  max-width: 100%;
  padding: 6px 11px;
  border: 1.6px solid;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.bubble-preview strong {
  font-weight: 800;
}

.bp-badge {
  display: inline-block;
  margin-right: 4px;
}

.bp-badge .i {
  display: inline-block;
  vertical-align: -2px;
}

.role-edit .card {
  margin-bottom: 18px;
}

.role-edit fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.role-edit legend {
  padding: 0;
  margin-bottom: 6px;
}

.role-edit-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.color-field input[type='color'] {
  width: 70px;
  height: 46px;
  padding: 4px;
  cursor: pointer;
}

.role-preview-box {
  padding: 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #cfeaff, #e8f8d8);
  border: 2px dashed #c9bdf0;
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice {
  position: relative;
  cursor: pointer;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-bubble,
.choice-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid;
  font-weight: 800;
  font-size: 13px;
  transition: transform 0.1s;
}

.choice-bubble {
  padding: 7px 12px;
  border-radius: 10px;
}

.choice-badge {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border-color: var(--line-soft);
  background: var(--card);
  color: var(--ink);
}

.choice:hover .choice-bubble,
.choice:hover .choice-badge {
  transform: translateY(-1px);
}

.choice input:checked + .choice-bubble,
.choice input:checked + .choice-badge {
  outline: 3px solid var(--purple);
  outline-offset: 2px;
}

.choice input:focus-visible + span {
  outline: 3px dashed var(--purple);
  outline-offset: 2px;
}

.perm-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}

.perm,
.role-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid var(--line-soft);
  background: var(--soft-2);
  font-weight: 700;
  cursor: pointer;
}

.perm input,
.role-check input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  flex: none;
  accent-color: var(--purple);
}

.perm span {
  display: grid;
  gap: 2px;
}

.perm small {
  font-weight: 600;
  color: var(--ink-2);
  font-size: 13px;
}

.perm:has(input:checked),
.role-check:has(input:checked) {
  border-color: var(--purple-2);
  background: var(--soft-3);
}

.perm.is-locked,
.role-check.is-locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.role-checks {
  display: grid;
  gap: 8px;
}

.role-check {
  align-items: center;
  padding: 8px 12px;
}

.role-checks .btn {
  justify-self: start;
}

@media (max-width: 700px) {
  .role-row {
    grid-template-columns: 26px minmax(0, 1fr) auto;
    grid-template-areas: 'move name act' 'move bubble bubble' 'move info info';
    row-gap: 6px;
    align-items: start;
  }
  .role-edit-top {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------------ light / dark switch */
.theme-btn {
  cursor: pointer;
  font: inherit;
}

.theme-btn .th-light,
:root[data-theme='dark'] .theme-btn .th-dark {
  display: none;
}

:root[data-theme='dark'] .theme-btn .th-light {
  display: block;
}

/* dark mode: tinted boxes get dark tints instead of pastel ones */
:root[data-theme='dark'] .toast-error {
  background: #3e1a24;
}

:root[data-theme='dark'] .warn-card,
:root[data-theme='dark'] .report-reason {
  background: #3a2f17;
}

:root[data-theme='dark'] .report-log .is-target {
  background: #4a1f36;
}

/* header: keep everything on one line between phone and desktop width */
@media (max-width: 940px) {
  .header-inner {
    gap: 10px;
  }
  .nav-link {
    padding: 8px 9px;
  }
  .hide-sm {
    display: none;
  }
}

@media (max-width: 480px) {
  .hide-xs {
    display: none;
  }
  .btn-play {
    padding-inline: 12px;
  }
  .header-actions {
    gap: 6px;
  }
}

@media (max-width: 400px) {
  .site-header .brand-name {
    display: none;
  }
}

/* early access note on the start page */
.beta-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  max-width: 560px;
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: 14px;
  border: 2px dashed #f59e0b;
  background: #fff8e6;
  color: #6b4a00;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.beta-note .i {
  flex: none;
  margin-top: 1px;
  color: #d97706;
}

:root[data-theme='dark'] .beta-note {
  background: #3a2f17;
  color: #ffd98a;
}
