* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: #fff;
  color: #000;
  color-scheme: light;
  font-family: system-ui, sans-serif;
  font-size: 15px;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid #ccc;
}

main { flex: 1; min-height: 0; }

.screen { display: none; height: 100%; }
.screen.active { display: block; }
#screen-home, #screen-lobby { padding: 12px; max-width: 480px; }
#screen-game.active { display: flex; }

h1 { font-size: 20px; }
h2 { font-size: 14px; }

label { display: block; font-size: 12px; }

input, select { padding: 5px; font: inherit; }
button { padding: 5px 10px; font: inherit; cursor: pointer; }

ul { list-style: none; margin: 0 0 12px; padding: 0; }
li { padding: 3px 0; display: flex; align-items: center; gap: 6px; }
li.dead { opacity: 0.5; text-decoration: line-through; }

.swatch { width: 10px; height: 10px; flex: 0 0 auto; }
.tag { margin-left: auto; font-size: 11px; }

#chat { flex: 1; min-width: 0; display: flex; flex-direction: column; }

#phase-bar {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #ccc;
  font-weight: bold;
}

#phase-timer { font-variant-numeric: tabular-nums; }

#messages { flex: 1; overflow-y: auto; padding: 12px; }

.msg { margin-bottom: 4px; }
.msg .author { font-weight: bold; margin-right: 6px; }
.msg.system { font-style: italic; }
.msg.private { border-left: 2px solid #999; padding-left: 6px; }
.msg img { max-width: 200px; display: block; }

#composer { display: flex; gap: 6px; padding: 8px 12px; border-top: 1px solid #ccc; }
#composer input { flex: 1; }

#spectator-bar { padding: 8px 12px; border-top: 1px solid #ccc; }

aside {
  width: 240px;
  flex: 0 0 240px;
  border-left: 1px solid #ccc;
  padding: 12px;
  overflow-y: auto;
}

#vote-options button { display: flex; align-items: center; gap: 6px; width: 100%; margin-bottom: 4px; }
#vote-options button.chosen { outline: 2px solid #333; }
.vote-count { margin-left: auto; }

#result-banner { border: 1px solid #ccc; padding: 8px; text-align: center; font-weight: bold; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  background: #fff;
  padding: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
}

#gif-results { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
#gif-results img { width: 120px; height: 90px; object-fit: cover; cursor: pointer; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 4px; border-bottom: 1px solid #ccc; }
td.num, th.num { text-align: right; }
