@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/poppins-400.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/poppins-500.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/poppins-600.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/poppins-700.woff2") format("woff2");
}

:root {
  --bs-body-font-family: "Poppins", sans-serif;
}

body {
  font-family: "Poppins", sans-serif;
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #111;
  overflow: hidden;
}

.app {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1rem;
  text-align: center;
  background: #fff;
  color: #111;
  overflow-y: auto;
  overflow-x: hidden;
}

/* On the login page the content is a single full-bleed panel that should fill
   the area under the navbar. */
.app:has(.auth-page) {
  display: flex;
  flex-direction: column;
  max-width: none;
  padding: 0;
}

/* The lobby and game views are full-width multi-panel layouts; let them fill the
   content area edge to edge instead of the narrow centered column. */
.app:has(.lobby) {
  max-width: none;
  padding: 0;
}

/* Admin layout styles live in assets/css/admin.css, loaded only on /admin. */

.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  aspect-ratio: 1 / 1;
  background: #1b1b1b;
  padding: 2px;
  border-radius: 4px;
  position: relative;
}

.guide {
  position: absolute;
  width: 7px;
  height: 7px;
  background: #111;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.resign-btn {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.6rem;
  padding: 0 0.5rem;
  line-height: 1;
  background: #f5c518;
  border: 1px solid #111;
}

.board-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-weight: 600;
  border-radius: 4px;
  pointer-events: none;
  z-index: 5;
}

.cell {
  background: #2e8b57;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  touch-action: manipulation;
}

.cell.legal:focus-visible {
  outline: 2px solid #f5c518;
  outline-offset: -2px;
}

.disc {
  width: 78%;
  height: 78%;
  border-radius: 50%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}

.disc::before,
.disc::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  backface-visibility: hidden;
}

.disc::before {
  background: #111;
}

.disc::after {
  background: #f5f5f5;
  transform: rotateY(180deg);
}

.disc.white {
  transform: rotateY(180deg);
}

.disc.empty {
  display: none;
}

.cell.last {
  box-shadow: inset 0 0 0 1px #f5c518;
}

.cell.legal {
  cursor: pointer;
}

.cell.legal::after {
  content: "";
  position: absolute;
  width: 12%;
  height: 12%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}

.reversi-nav {
  background-color: #0b3d27;
}

.reversi-nav .navbar-toggler {
  padding: 0.2rem 0.4rem;
  font-size: 0.9rem;
}

.reversi-nav .navbar-toggler-icon {
  width: 1.1em;
  height: 1.1em;
}

.reversi-logo {
  display: block;
  flex: 0 0 auto;
}

/* The navbar dropdowns are toggled by hand (no Bootstrap JS), so the
   [data-bs-popper] rules that right-align the menus never apply. Position them
   here so they drop below the toggle and stay on screen. */
.reversi-nav .dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  left: auto;
  margin-top: 0.25rem;
}

/* Below the navbar's expand breakpoint the menu collapses into the hamburger, so
   the user dropdown flows inline and is styled like the rest of the navbar
   items rather than as a floating panel. */
@media (max-width: 767.98px) {
  /* Stack every navbar group flush left (the right-hand group uses
     align-items-center, which is !important, so override in kind). */
  .reversi-nav .navbar-nav {
    align-items: flex-start !important;
  }

  .reversi-nav .dropdown-menu {
    position: static;
    margin-top: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .reversi-nav .dropdown-item {
    padding: 0.5rem 0;
    color: var(--bs-navbar-color, rgba(255, 255, 255, 0.55));
  }

  .reversi-nav .dropdown-divider {
    border-top-color: rgba(255, 255, 255, 0.15);
  }
}

.user-menu .dropdown-item:hover,
.user-menu .dropdown-item:focus {
  background-color: transparent;
}

.reversi-footer {
  position: sticky;
  bottom: 0;
  z-index: 1020;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  height: 2.5rem;
  background-color: #0b3d27;
  color: #e6f4ea;
  font-size: 0.85rem;
}

.reversi-footer .footer-copy {
  color: #9cc7b0;
}

.notif-panel {
  width: 300px;
  padding: 0;
  overflow: hidden;
}

.notif-scroll {
  max-height: 320px;
  overflow-y: auto;
}

.notif-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.notif-item {
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.notif-item.unread {
  font-weight: 600;
}

.notif-item.read {
  color: #6c757d;
}

.notif-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

a {
  transition: color 0.15s ease, text-shadow 0.15s ease;
}

a:hover {
  color: #f5c518;
  text-shadow: 0 0 8px rgba(245, 197, 24, 0.7);
  text-decoration: none;
}

.opp-link {
  color: #111;
}

/* A username that links to its profile blends into the surrounding text and
   only underlines on hover, so it reads as a name, not a loud link. */
.profile-link {
  color: inherit;
  text-decoration: none;
}

button:not(.btn):not(.btn-close):not(.dropdown-item):not(.chair-hot):not(.report-flag) {
  padding: 0.5rem 0.9rem;
  border: 0;
  border-radius: 4px;
  background: #2e8b57;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
}

button:not(.btn):not(.dropdown-item):not(.chair-hot):not(.report-flag):hover {
  filter: brightness(1.12);
}

button:not(.btn):not(.dropdown-item):not(.chair-hot):not(.report-flag):active {
  transform: translateY(1px);
}

button:not(.btn):not(.dropdown-item):not(.chair-hot):not(.report-flag):disabled {
  opacity: 0.5;
  cursor: default;
}

.form-narrow {
  max-width: 26rem;
}

.auth-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
  background-image: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.45)),
    url("/img/board.jpg");
  background-size: cover;
  background-position: center;
}

.auth-card {
  margin: 0;
  width: 100%;
  max-width: 22rem;
  padding: 1.75rem;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 8px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.45);
}

.auth-card a {
  color: #0b3d27;
}

.auth-card a:hover {
  color: #000;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.45);
}

.scorebar {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.scorebar .side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 1.6rem;
  padding: 0 0.5rem;
  border-radius: 4px;
  background: #e6f4ea;
  border: 2px solid transparent;
  color: #111;
}

.scorebar .side.active {
  border-color: #f5c518;
}

.scorebar .count {
  font-weight: 700;
  font-size: 1rem;
}

.scorebar .clock {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

@media (max-width: 600px) {
  .app {
    margin: 0 auto;
  }
}

.lobby {
  display: flex;
  align-items: stretch;
  text-align: left;
  height: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.lobby-main {
  flex: 1;
  min-width: 14rem;
  min-height: 0;
  overflow-y: auto;
  background: #d8d8d8;
}

/* The tiled floor is the lobby's backdrop only, not the game room (which reuses
   the same layout classes). */
.lobby-home .lobby-main {
  background: #d8d8d8 url("/img/floor.svg") repeat;
  background-size: 56px 56px;
}

.game-board {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
  box-sizing: border-box;
  text-align: center;
}

.lobby-side {
  flex: 0 0 auto;
  display: flex;
  gap: 0.5rem;
  min-width: 0;
  min-height: 0;
}

/* The chat/players tab bar is mobile-only; the wide layout shows both panes. */
.lobby-tabs {
  display: none;
}

.nav-tabs .nav-link:not(.active) {
  color: #0b3d27;
}

/* The resize handle between the table pool and the side panel is mobile-only. */
.lobby-divider {
  display: none;
}

.lobby-side .chatcol {
  flex: 0 0 24rem;
  width: 24rem;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.lobby-side .users {
  flex: none;
  width: max-content;
  min-width: 14rem;
  min-height: 0;
  overflow-y: auto;
  background: #e6f4ea;
  border-radius: 4px;
  padding: 0.25rem 0.75rem;
}

.chat-form {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.5rem;
  padding-left: 4px;
  padding-bottom: 4px;
}

.chat-input {
  flex: 1;
  min-width: 0;
  padding: 0.4rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font: inherit;
}

button.send {
  flex: none;
  padding: 0.4rem 0.6rem;
}

.player {
  cursor: pointer;
  padding: 0.2rem 0 0.2rem 8px;
  white-space: nowrap;
}

.player:hover {
  background: #0b3d27;
  color: #fff;
}

/* The color disc beside a player's name in the game's players list. A neutral
   border keeps both discs visible on the light row and the dark hover state. */
.player .disc-chip {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  vertical-align: middle;
}

.player .disc-chip.black {
  background: #111;
  border: 1px solid #888;
}

.player .disc-chip.white {
  background: #f5f5f5;
  border: 1px solid #888;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.25rem;
  margin: 0;
  list-style: none;
}

.messages li {
  padding: 0.15rem 0 0.15rem 8px;
}

.report-flag {
  background: none;
  border: 0;
  padding: 0 0.2rem;
  margin-left: 0.25rem;
  color: #999;
  cursor: pointer;
  opacity: 0;
  font-size: 0.75rem;
  line-height: 1;
}

.messages li:hover .report-flag,
.report-flag:focus {
  opacity: 1;
}

.report-flag:hover {
  color: #c0392b;
}

.users ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.users-table {
  border-collapse: collapse;
  width: 100%;
}

.users-table th {
  cursor: pointer;
  user-select: none;
  text-align: left;
  white-space: nowrap;
  padding: 0.2rem 0.5rem;
}

.users-table td {
  padding: 0.2rem 0.5rem;
}

.users-table .rating-col {
  text-align: right;
}

th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.sort-arrow {
  font-size: 0.7em;
  margin-left: 0.2rem;
  opacity: 0.6;
}

.sort-arrow.placeholder {
  visibility: hidden;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.75rem;
  padding: 0.75rem;
}

.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  padding: 0.75rem;
}

.table-card {
  background: transparent;
  border-radius: 4px;
  padding: 0.4rem;
  box-sizing: border-box;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* An in-progress table is a link to go watch the game. */
.table-watch {
  text-decoration: none;
  color: inherit;
}

.table-art {
  position: relative;
  line-height: 0;
  height: 100%;
}

.table-art img {
  height: 100%;
  width: auto;
  display: block;
}

/* The seat zones over the table art: black chair on top, white on the bottom.
   Used both for the clickable open chairs and for the occupant name overlay on
   an in-progress table. */
.chair-hot,
.table-seat-name {
  position: absolute;
  left: 17%;
  width: 66%;
  height: 17%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0;
  color: #fff;
  font-size: 0.7rem;
  line-height: 1.1;
  overflow: hidden;
}

.chair-hot.black,
.table-seat-name.black {
  top: 3%;
}

.chair-hot.white,
.table-seat-name.white {
  top: 80%;
  color: #111;
}

.chair-hot {
  background: transparent;
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: default;
}

.chair-hot.open {
  cursor: pointer;
}

.chair-hot.open:hover {
  color: #f5c518;
  text-shadow: 0 0 8px rgba(245, 197, 24, 0.7);
}

.chair-hot.occupied {
  font-weight: 600;
}

.chair-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.ready-dot {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #2e8b57;
  box-shadow: 0 0 0 1px #fff;
}

.table-controls {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.3rem;
}

.table-seats-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.75rem auto;
  max-width: 560px;
}

.table-seats-row > span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.mini {
  text-decoration: none;
  color: inherit;
  display: block;
  padding: 0.6rem;
  background: #fff;
  border-radius: 4px;
}

.mini .board {
  width: 100%;
}

.mini .guide {
  width: 5px;
  height: 5px;
}

.mini-players {
  font-size: 0.62rem;
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
  color: #111;
  text-shadow: none;
}

.mini-players > span {
  display: flex;
  align-items: center;
}

.mini-players > span:first-child {
  padding-left: 0.3rem;
}

.mini-players > span:last-child {
  padding-right: 0.3rem;
}

.mini-players .disc-chip {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 0.2rem;
}

.mini-players .disc-chip.black {
  background: #111;
  border: 1px solid #555;
}

.mini-players .disc-chip.white {
  background: #f5f5f5;
  border: 1px solid #999;
}

@media (max-width: 768px) {
  .notif-panel {
    width: 100%;
  }

  .lobby {
    flex-direction: column;
  }

  .lobby-main {
    flex: 0 0 auto;
    height: var(--main-h, 50%);
    max-height: none;
    overflow-y: auto;
  }

  /* The game page leads with the board, so it starts taller than the lobby. */
  .lobby:not(.lobby-home) .lobby-main {
    height: var(--main-h, 65%);
  }

  .table-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .lobby-divider {
    display: block;
    flex: 0 0 auto;
    height: 12px;
    background: #0b3d27;
    cursor: row-resize;
    touch-action: none;
  }

  .lobby-divider::after {
    content: "";
    display: block;
    width: 2.5rem;
    height: 3px;
    margin: 4px auto 0;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.6);
  }

  .lobby-side {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
  }

  /* Chat and players become tabs; only the chosen pane shows. */
  .lobby-tabs {
    display: flex;
  }

  .lobby-side .lobby-pane {
    flex: 1 1 auto;
    width: auto;
    min-height: 0;
  }

  .lobby-side .lobby-pane:not(.active) {
    display: none;
  }

  .chat-form button.send {
    margin-right: 4px;
  }
}
