/* Joseph Harris */

:root {
  color-scheme: dark;
  --bg: #0b1220;
  --panel: #172235;
  --outline: #2c3b52;
  --text: #edf3ff;
  --muted: #a3b0c3;
  --accent: #ff944d;
  --secondary: #69d4d2;
  --shadow: 0 20px 55px #03091666;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(ellipse at top, #24334e 0%, #0b1220 58%);
  color: var(--text);
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
}
.app {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 20px 24px;
}
.page-header {
  position: relative;
  text-align: center;
  margin-bottom: 30px;
}
.share-button {
  margin-top: 12px;
}
@media (min-width: 541px) {
  .share-button {
    position: absolute;
    right: 0;
    top: 50%;
    margin: 0;
    transform: translateY(-50%);
  }
}
h1 {
  font-size: clamp(2.7rem, 8vw, 4.2rem);
  letter-spacing: -0.065em;
  line-height: 1.1;
  margin: 0;
}
.accent {
  color: var(--accent);
}
.panel {
  border: 1px solid var(--outline);
  border-radius: 22px;
  background: linear-gradient(160deg, #19263a, #131d2d);
  box-shadow: var(--shadow);
  padding: 25px;
  margin-bottom: 20px;
}
.game h2 {
  margin: 0;
  font-size: 1.18rem;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 21px 0 0;
}
legend {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.83rem;
  margin-bottom: 10px;
}
.segmented,
.symbols {
  display: grid;
  gap: 10px;
}
.segmented {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.symbols {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
label {
  position: relative;
  cursor: pointer;
}
label input {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}
label span {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--outline);
  background: #111b2b;
  border-radius: 12px;
  min-height: 45px;
  font-size: 0.88rem;
  font-weight: 700;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.15s;
}
label input:checked + span {
  background: #423021;
  border-color: var(--accent);
  color: #ffbe87;
}
label input:focus-visible + span {
  outline: 3px solid var(--secondary);
  outline-offset: 3px;
}
.symbols span {
  font-size: 1.8rem;
  line-height: 1;
}
.symbols label:hover span,
.segmented label:hover span {
  border-color: #8191a8;
}
.player-preview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--outline);
  padding-top: 21px;
  margin-top: 22px;
}
.player-chip {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 1;
}
.player-chip:last-child {
  justify-content: flex-end;
}
.player-chip strong {
  font-size: 1.13rem;
}
.avatar {
  border-radius: 12px;
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  background: #174246;
  color: var(--secondary);
  flex-shrink: 0;
}
.human-avatar {
  background: #473321;
  color: #ffb16e;
  font-size: 1.6rem;
}
.versus {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  font-weight: 900;
  color: var(--muted);
}
.game {
  padding: 26px 25px 21px;
}
.game-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 24px;
}
.game-topline h2 {
  font-size: 1.25rem;
}
.reset {
  border: 1px solid #715039;
  color: #ffc393;
  background: #38271f;
  border-radius: 10px;
  padding: 10px 13px;
  font-weight: 750;
  white-space: nowrap;
}
.reset:hover {
  background: #533625;
}
.reset:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 3px;
}
.game-tip {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin: 18px 0 0;
}
@media (max-width: 540px) {
  .app {
    padding: 27px 13px;
  }
  .panel {
    padding: 19px;
    border-radius: 18px;
  }
  .game-topline {
    align-items: flex-start;
  }
  .reset {
    font-size: 0.8rem;
    padding: 9px;
  }
  .player-chip {
    gap: 7px;
  }
  .avatar {
    width: 40px;
    height: 40px;
  }
  .versus {
    font-size: 0.65rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    transition: none !important;
    animation: none !important;
  }
}

.board-canvas {
  display: block;
  width: min(100%, 390px);
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto;
  cursor: pointer;
  touch-action: manipulation;
  border-radius: 16px;
}
.board-canvas:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 5px;
}
.symbols canvas {
  width: 36px;
  height: 36px;
  display: block;
}
.avatar canvas {
  display: block;
  width: 29px;
  height: 29px;
}
.symbols label input:disabled + span {
  opacity: 0.35;
  cursor: not-allowed;
}
@media (max-width: 540px) {
  .board-canvas {
    border-radius: 12px;
  }
}

.mode-picker {
  margin-top: 0;
}
.join-form {
  margin-top: 20px;
}
.join-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.join-fields label,
.text-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--muted);
}
.join-fields input,
.text-field input,
.text-field select {
  position: static;
  display: block;
  width: 100%;
  height: auto;
  opacity: 1;
  cursor: text;
  font-size: 1rem;
  border: 1px solid var(--outline);
  border-radius: 10px;
  padding: 10px;
  color: var(--text);
  background: #111b2b;
}
.join-fields input:focus-visible,
.text-field input:focus-visible,
.text-field select:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
}
.connection-note {
  color: var(--muted);
  font-size: 0.84rem;
  min-height: 1.2em;
  margin: 10px 0 0;
}
#join-note:empty,
#private-join-note:empty {
  display: none;
}
.player-chip strong {
  display: block;
  width: auto;
  height: auto;
  min-width: 0;
  overflow-wrap: anywhere;
}
.player-chip:last-child {
  text-align: right;
}
.reset:disabled {
  cursor: default;
  opacity: 0.45;
}
[hidden] {
  display: none !important;
}
@media (max-width: 540px) {
  .join-fields > * {
    grid-column: 1 / -1;
  }
}

.lobby,
.current-table {
  margin-top: 20px;
}
.lobby h2,
.current-table h2 {
  margin: 0;
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}
.table-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.55fr) auto;
  align-items: end;
  gap: 10px;
  margin-top: 14px;
}
.table-password-field {
  grid-column: 1 / 3;
}
.text-field select {
  cursor: pointer;
  font: inherit;
}
.table-list {
  display: grid;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}
.table-list li,
.current-table {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.table-list li {
  padding: 10px 12px;
  border: 1px solid var(--outline);
  border-radius: 12px;
  background: #111b2b;
  overflow-wrap: anywhere;
}
.table-list small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}
.table-actions,
.dialog-actions {
  display: flex;
  gap: 6px;
}
.watch-button {
  background: #172235;
  border-color: var(--outline);
  color: var(--text);
}
.watch-button:hover {
  background: #24334e;
}
.modal {
  width: min(420px, calc(100% - 32px));
  border: 1px solid var(--outline);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  padding: 22px;
  box-shadow: var(--shadow);
}
.modal::backdrop {
  background: rgb(5 10 18 / 75%);
}
.modal h2 {
  margin: 0 0 16px;
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}
.share-dialog {
  text-align: center;
}
.share-qr {
  display: block;
  width: min(222px, 100%);
  height: auto;
  margin: 0 auto 12px;
  image-rendering: pixelated;
}
.share-dialog a {
  color: var(--secondary);
  overflow-wrap: anywhere;
}
.share-dialog form {
  margin-top: 16px;
}
.dialog-actions {
  justify-content: flex-end;
  margin-top: 15px;
}
#spectating-label {
  margin-top: 3px;
}
@media (max-width: 540px) {
  .table-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.65fr);
  }
  .table-form button,
  .table-password-field {
    grid-column: 1 / -1;
  }
  .table-form button {
    justify-self: start;
  }
}
#lobby-note:empty {
  display: none;
}
@media (max-width: 640px) {
  .segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
