:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --accent: #7b2cbf;
  --error: #c0392b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: system-ui, sans-serif; background: var(--bg); color: var(--text); }
.topbar { display: flex; gap: 2rem; align-items: center; padding: .75rem 1.5rem; background: #2d1e3e; color: #fff; }
.topbar a { color: #fff; }
main { max-width: 860px; margin: 0 auto; padding: 1rem 1.5rem 3rem; }
.card { background: var(--card); border-radius: 10px; padding: 1rem 1.25rem; margin: 1rem 0; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.card h2 { margin-top: 0; font-size: 1.05rem; }
.hint { color: var(--muted); }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row input[type=text] { flex: 1; min-width: 12rem; }
input, button { font: inherit; padding: .45rem .6rem; border-radius: 6px; border: 1px solid #ccc; }
input[type=number] { width: 4.5rem; }
input[type=color] { padding: 0; width: 3rem; height: 2.2rem; }
button { background: var(--accent); color: #fff; border: none; cursor: pointer; min-width: 3.5rem; }
button:hover { filter: brightness(1.1); }
.buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.log { list-style: none; padding: 0; margin: 0; font-family: ui-monospace, monospace; }
.log li { padding: .25rem 0; border-bottom: 1px solid #eee; }
.log li.error { color: var(--error); }

.topbar nav { display: flex; gap: 1.25rem; }
.topbar nav a { text-decoration: none; opacity: .8; }
.topbar nav a[aria-current=page] { opacity: 1; text-decoration: underline; }
.topbar .logout { margin-left: auto; }
.topbar .logout button { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.5); }
.narrow { max-width: 420px; margin: 3rem auto; }
.narrow form { display: grid; gap: .75rem; }
.narrow label { display: grid; gap: .25rem; }
.flash { padding: .6rem .9rem; border-radius: 8px; }
.flash.ok { background: #e7f6ec; color: #1d6b39; }
.flash.error { background: #fdecea; color: #a8281e; }
button.secondary { background: #e8e3ef; color: var(--text); }
button.danger { background: var(--error); }
.danger-zone { border: 1px solid #f3c7c2; }
.push-right { margin-left: auto; }
.badge { background: #2d1e3e; color: #fff; border-radius: 999px; padding: .1rem .55rem; font-size: .8rem; }
input[type=search] { width: 100%; }
select { font: inherit; padding: .4rem; border-radius: 6px; border: 1px solid #ccc; }
.members { list-style: none; padding: 0; margin: .5rem 0 0; }
.members li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px solid #eee; }
details { margin-top: 1rem; }
.player { border-top: 1px solid #eee; padding: .9rem 0; }
.player:first-of-type { border-top: none; }
.player form { margin-top: .5rem; }
.player .row { margin-top: .5rem; }
.texture-thumb { display: block; width: 2.5rem; height: 2.5rem; border-radius: 6px; object-fit: cover; border: 1px solid rgba(0,0,0,.15); }
.swatch { display: inline-block; width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 2px solid rgba(0,0,0,.2); vertical-align: middle; }
.swatch.big { width: 2rem; height: 2rem; }
.swatch.default { outline: 2px dashed #999; outline-offset: 1px; }
.colors { border: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem .9rem; }
.colors legend { font-weight: 600; margin-bottom: .3rem; }
.color-choice { display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; }
table.list, table.stats { width: 100%; border-collapse: collapse; }
table.list th, table.list td, table.stats th, table.stats td { text-align: left; padding: .35rem .4rem; border-bottom: 1px solid #eee; }
table.stats input[type=text] { width: 100%; }
table.stats input[type=number] { width: 6rem; }
.card form + form { margin-top: .75rem; }
.card > .row + .row, .card form .row { margin-top: .5rem; }
.settings-form { display: grid; gap: .9rem; }
.settings-form h2 { margin: .5rem 0 0; }
.settings-form label { display: grid; gap: .3rem; max-width: 22rem; }
.settings-form .row label { display: inline-grid; }
.settings-form output { font-weight: 600; }
.settings-form button[type=submit] { justify-self: start; }
.positions { border: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .8rem; }
.positions legend { font-weight: 600; margin-bottom: .4rem; }
.position-choice { display: grid !important; justify-items: center; gap: .3rem; cursor: pointer; font-size: .9rem; }
.position-choice .screen { position: relative; width: 96px; height: 54px; border: 2px solid #999; border-radius: 4px; background: #eee; }
.position-choice .spot { position: absolute; width: 28px; height: 14px; border-radius: 3px; background: var(--accent); }
.position-bottom-center .spot { bottom: 4px; left: 50%; transform: translateX(-50%); }
.position-bottom-left .spot { bottom: 4px; left: 4px; }
.position-bottom-right .spot { bottom: 4px; right: 4px; }
.position-top-left .spot { top: 4px; left: 4px; }
.position-top-right .spot { top: 4px; right: 4px; }
.position-choice input:checked + .screen { border-color: var(--accent); background: #f1e8fb; }
.textures { border: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem .9rem; }
.textures legend { font-weight: 600; margin-bottom: .3rem; }
.texture-choice { display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; }
.dice-preview-wrap { display: grid; justify-items: center; gap: .3rem; }
#dice-preview { width: 180px; height: 150px; border-radius: 10px; background: #15111d; overflow: hidden; }
.dice-preview-wrap .hint { margin: 0; text-align: center; max-width: 180px; }
