/* Host a game (games/new, game_nights/new|edit), the game host page (games/show,
   game_nights/show), games/index, games/edit and games/qr_code. */

/* ---------- Page heading ---------- */

.gtf-host-heading {
  margin: 14px 0 28px;
  font-size: clamp(44px, 6vw, 80px);
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 900;
}

.gtf-host-heading--page {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.gtf-host-page .gtf-page-head .gtf-host-heading {
  margin: 0;
}

/* ---------- One game / Game night toggle ---------- */

.gtf-mode-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px;
  border-radius: 18px;
  background: var(--gtf-surface-2);
}

.gtf-mode-toggle__option {
  flex: 1 1 280px;
  display: block;
  padding: 18px 26px;
  border-radius: var(--gtf-radius-card);
  background: var(--gtf-ink);
  transition: background-color 0.15s, color 0.15s;

  body.gtf & {
    color: var(--gtf-text-2);
  }

  body.gtf &:hover {
    color: var(--gtf-cream);
    background: var(--gtf-ink-hover);
  }

  body.gtf &[aria-current="page"] {
    background: var(--gtf-orange);
    color: var(--gtf-ink);
  }
}

.gtf-mode-toggle__title {
  display: block;
  font-weight: 900;
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.gtf-mode-toggle__body {
  display: block;
  margin-top: 4px;
  font-size: 16px;
  opacity: 0.85;
}

/* ---------- Form layout: main column + sticky summary ---------- */

.gtf-host-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 40px;
  padding-top: 40px;
}

.gtf-host-layout__main {
  flex: 2 1 520px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 44px;
}

.gtf-host-name__label {
  font-size: 16px;
  font-weight: 600;
  color: var(--gtf-text-2);
}

.gtf-host-name__input {
  font-size: 18px;
}

.gtf-host-section {
  min-width: 0;
}

.gtf-host-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 6px;
}

.gtf-host-section__title {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.02em;

  .gtf-host-section__head & {
    margin: 0;
  }
}

.gtf-host-section__title--sm {
  font-size: 22px;
}

.gtf-host-section__hint {
  max-width: 38em;
  margin: 0 0 18px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--gtf-text-2);

  .gtf-card--yellow & {
    color: var(--gtf-ink);
  }
}

/* ---------- Game tiles ---------- */

.gtf-host-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.gtf-host-tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 0;
  border-radius: var(--gtf-radius-card);
  background: var(--gtf-surface-2);
  color: var(--gtf-cream);
  font-family: var(--gtf-font);
  font-weight: 800;
  font-size: 17px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.15s;

  &:hover {
    background: var(--gtf-surface-4);
  }

  & input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }

  &:has(input:checked) {
    box-shadow: inset 0 0 0 3px var(--gtf-orange);
  }

  &:has(input:focus-visible) {
    outline: 3px solid var(--gtf-yellow);
    outline-offset: 2px;
  }

  &:active {
    transform: translateY(1px);
  }
}

.gtf-host-tile__name {
  flex: 1;
  min-width: 0;
  line-height: 1.15;
}

.gtf-host-tile__count {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--gtf-orange);
  color: var(--gtf-ink);
  font-family: var(--gtf-mono);
  font-size: 13px;
  text-align: center;

  &[hidden] {
    display: none;
  }
}

/* ---------- Line-up builder ---------- */

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

.gtf-lineup-empty {
  margin: 0;
  padding: 24px 0;
  border-top: 2px solid var(--gtf-surface-2);
  font-size: 17px;
  color: var(--gtf-text-4);
}

.gtf-lineup-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 -12px;
  padding: 12px;
  border-top: 2px solid var(--gtf-surface-2);
  border-radius: 0;
  color: var(--gtf-cream);
  cursor: grab;
  transition: background-color 0.12s, border-color 0.12s;

  &:hover {
    background: var(--gtf-surface-2);
  }

  &.is-over {
    border-top-color: var(--gtf-orange);
  }

  &.is-dragging {
    background: var(--gtf-yellow);
    color: var(--gtf-ink);
    cursor: grabbing;

    & .gtf-lineup-row__handle,
    & .gtf-lineup-row__number,
    & .gtf-lineup-row__note {
      color: var(--gtf-ink);
    }
  }
}

.gtf-lineup-row__handle {
  flex: none;
  width: 18px;
  font-size: 20px;
  letter-spacing: -3px;
  color: var(--gtf-text-4);
  user-select: none;
}

.gtf-lineup-row__number {
  flex: none;
  width: 22px;
  font-family: var(--gtf-mono);
  font-size: 14px;
  color: var(--gtf-text-4);
}

.gtf-lineup-row__main {
  flex: 1;
  min-width: 0;
}

.gtf-lineup-row__name {
  display: block;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.gtf-lineup-row__note {
  display: block;
  margin-top: 2px;
  font-family: var(--gtf-mono);
  font-size: 13px;
  color: var(--gtf-text-4);
}

.gtf-lineup-row__actions {
  flex: none;
  display: flex;
  gap: 4px;
}

.gtf-lineup-row__btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--gtf-radius-btn);
  background: var(--gtf-surface-2);
  color: var(--gtf-cream);
  font-size: 16px;
  cursor: pointer;

  &:hover {
    background: var(--gtf-surface-4);
  }

  .gtf-lineup-row:hover & {
    background: var(--gtf-surface-4);
  }
}

.gtf-lineup-row__btn--remove {
  color: #EE5F4B;
  color: oklch(0.72 0.19 20);
}

@media (max-width: 520px) {
  .gtf-lineup-row {
    gap: 10px;
    margin: 0;
    padding: 12px 0;
  }

  .gtf-lineup-row__handle {
    display: none;
  }

  .gtf-lineup-row .gtf-game-icon {
    --size: 36px !important;
  }

  .gtf-lineup-row__name {
    font-size: 17px;
  }

  .gtf-lineup-row__btn {
    width: 32px;
    height: 32px;
  }
}

/* ---------- Players pills ---------- */

.gtf-host-pills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.gtf-host-pill {
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--gtf-radius-card);
  border-color: var(--gtf-surface-2);
  background: var(--gtf-surface-2);

  &:hover {
    border-color: var(--gtf-line);
  }

  &.gtf-pill--dashed {
    border-color: var(--gtf-line);
  }

  & .gtf-pill__sub {
    font-family: var(--gtf-mono);
    color: var(--gtf-text-2);
  }
}

.gtf-host-pill__value {
  font-weight: 900;
  font-size: 30px;
  letter-spacing: -0.02em;
  line-height: 1;
}

.gtf-host-pill:has(input:checked) {
  border-style: solid;
}

/* ---------- Admin avatar options ---------- */

.gtf-host-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 10px;
}

.gtf-host-check {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--gtf-surface-4);
  border-radius: var(--gtf-radius-input);
  cursor: pointer;

  & input {
    width: 20px;
    height: 20px;
    accent-color: var(--gtf-yellow);
  }

  &:hover {
    border-color: var(--gtf-line);
  }
}

.gtf-host-check__title {
  display: block;
  font-weight: 800;
}

.gtf-host-check__hint {
  display: block;
  font-size: 14px;
  color: var(--gtf-text-2);
}

/* ---------- Summary card ---------- */

.gtf-host-summary {
  flex: 1 1 300px;
  min-width: 0;
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px;
  border-radius: var(--gtf-radius-card);
  background: var(--gtf-yellow);
  color: var(--gtf-ink);
}

.gtf-host-summary__label {
  font-size: 16px;
  font-weight: 800;
}

.gtf-host-summary__title {
  font-weight: 900;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.gtf-host-summary__lines {
  font-size: 18px;
  line-height: 1.45;
}

.gtf-host-summary__hint {
  font-size: 15px;
}

body.gtf .gtf-host-summary__cancel {
  align-self: center;
  font-weight: 700;
  color: var(--gtf-ink);
  text-decoration: underline;
}

@media (max-width: 860px) {
  .gtf-host-summary {
    position: static;
  }
}

/* ---------- Game host page: header ---------- */

.gtf-host-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-top: 16px;
}

.gtf-host-head__main {
  min-width: 0;
}

.gtf-host-head__main .gtf-back-link {
  margin: 0;
}

.gtf-host-head__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
}

.gtf-host-head__icon {
  flex: none;
  display: inline-flex;

  & .gtf-game-icon {
    border-radius: 17px;
  }
}

.gtf-host-head__icon--night {
  --game: var(--gtf-yellow);
}

.gtf-host-chip {
  padding: 6px 14px;
  border-radius: var(--gtf-radius-btn);
  background: var(--gtf-yellow);
  color: var(--gtf-ink);
  font-weight: 800;
  font-size: 16px;
  white-space: nowrap;
}

.gtf-host-chip--active,
.gtf-host-chip--playing,
.gtf-host-chip--up_next,
.gtf-host-chip--intermission,
.gtf-host-chip--on_break {
  background: var(--gtf-success);
}

.gtf-host-chip--finished {
  background: var(--gtf-surface-4);
  color: var(--gtf-cream);
}

.gtf-host-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;

  & form {
    margin: 0;
  }
}

/* ---------- Game host page: columns ---------- */

.gtf-host-columns {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 48px 64px;
  padding-top: 56px;
}

.gtf-host-columns__main {
  flex: 1 1 440px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.gtf-host-columns__aside {
  flex: 1 1 400px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Join card */
.gtf-host-join__code-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.gtf-host-join__code {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.gtf-host-join__code-text {
  font-size: clamp(56px, 8vw, 96px);
  letter-spacing: 0.04em;
}

.gtf-host-copy {
  min-width: 96px;
  padding: 12px 20px;

  &.is-copied {
    background: var(--gtf-success);
    color: var(--gtf-ink);
  }
}

.gtf-host-rows {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 2px solid var(--gtf-surface-2);
}

.gtf-host-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  & + & {
    padding-top: 20px;
    border-top: 2px solid var(--gtf-surface-2);
  }
}

.gtf-host-row--count {
  align-items: baseline;
}

.gtf-host-row--stack {
  display: block;
}

.gtf-host-row__main {
  min-width: 0;
}

.gtf-host-row__label {
  font-size: 16px;
  font-weight: 600;
  color: var(--gtf-text-2);
}

.gtf-host-row__value {
  margin-top: 4px;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.gtf-host-row__count {
  font-size: 22px;
  font-weight: 900;
}

.gtf-host-row__text {
  max-width: 30em;
  margin-top: 6px;
  font-size: 18px;
  line-height: 1.5;
}

/* Line-up (nights) */
.gtf-host-lineup__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.gtf-host-lineup__title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.gtf-host-lineup__edit {
  font-size: 15px;
  font-weight: 600;
}

.gtf-host-lineup {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gtf-host-lineup__row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 2px solid var(--gtf-surface-2);
}

.gtf-host-lineup__number {
  flex: none;
  width: 22px;
  font-family: var(--gtf-mono);
  font-size: 14px;
  color: var(--gtf-text-2);
}

.gtf-host-lineup__name {
  flex: 1;
  min-width: 0;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.gtf-host-lineup__tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

/* Players card */
.gtf-host-players__title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 22px;
  font-weight: 800;
}

.gtf-host-players__count {
  font-family: var(--gtf-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--gtf-text-2);
}

.gtf-host-players__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gtf-host-player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--gtf-radius-input);
  background: var(--gtf-surface-2);
  min-width: 0;
}

.gtf-host-player__name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.gtf-host-player__time {
  flex: none;
  font-family: var(--gtf-mono);
  font-size: 13px;
  color: var(--gtf-text-3);
}

.gtf-host-players__empty {
  padding: 28px 20px;
}

.gtf-host-players__share {
  margin-top: 8px;
  font-size: 15px;
  color: var(--gtf-text-2);
}

/* The night roster partial belongs to the host controls (Part B) and is live-replaced over
   Turbo, so it keeps its own markup; these rules fit it into the Players card. */
.gtf-host-players--roster {
  & #game_night_host_roster {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  & #game_night_host_roster > h2 {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 22px;
    font-weight: 800;
  }

  & #game_night_host_roster > h2 span {
    font-family: var(--gtf-mono);
    font-size: 14px;
    font-weight: 500;
    color: var(--gtf-text-2);
  }

  & #game_night_host_roster ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  & #game_night_host_roster li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--gtf-radius-input);
    background: var(--gtf-surface-2);
    font-weight: 700;
  }

  & #game_night_host_roster > p {
    color: var(--gtf-text-2);
  }
}

/* Run it from your phone */
.gtf-host-phone {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: clamp(24px, 3vw, 36px);
}

.gtf-host-phone__lede {
  font-size: 17px;
  line-height: 1.45;
}

.gtf-host-phone__qr {
  align-self: center;
  display: grid;
  place-items: center;
  width: min(100%, 300px);
  aspect-ratio: 1;
  padding: 20px;
  border-radius: var(--gtf-radius-card);
  background: #fff;
  line-height: 0;

  & svg {
    display: block;
    width: 100%;
    height: auto;
  }
}

.gtf-host-phone__url {
  display: flex;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
}

.gtf-host-phone__url-text {
  flex: 1;
  min-width: 0;
  max-height: 76px;
  overflow: hidden;
  padding: 12px 14px;
  border-radius: var(--gtf-radius-btn);
  background: var(--gtf-ink);
  color: var(--gtf-cream);
  font-family: var(--gtf-mono);
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.gtf-host-phone__url .gtf-host-copy {
  padding: 0 20px;
}

body.gtf .gtf-host-phone__download {
  align-self: flex-start;
}

body.gtf .gtf-host-phone__download:hover {
  background: var(--gtf-ink);
  color: var(--gtf-yellow);
}

/* Running the night: the host-controls panel keeps its markup (Part B); tone it down here. */
.gtf-host-running {
  & #game_night_host_controls {
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }

  & #game_night_host_controls > h2 {
    display: none;
  }

  & #game_night_host_controls form {
    display: inline;
  }
}

/* ---------- games/index ---------- */

.gtf-games-index__section {
  margin-bottom: 48px;
}

.gtf-games-index__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gtf-games-index__grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 16px;
}

.gtf-games-index__game {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
}

.gtf-games-index__game-head {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.gtf-games-index__game-main {
  min-width: 0;
}

.gtf-games-index__game-title {
  font-weight: 800;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.gtf-games-index__game-meta {
  font-size: 14px;
  color: var(--gtf-text-2);
}

.gtf-games-index__game-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

/* ---------- games/edit ---------- */

.gtf-host-edit {
  gap: 24px;
}

.gtf-host-edit__number {
  max-width: 200px;
}

.gtf-host-edit__group {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 24px;
  border-top: 2px solid var(--gtf-surface-3);
}

/* ---------- games/qr_code ---------- */

.gtf-qr-page__layout {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 32px;
  padding-top: 16px;
}

.gtf-qr-page__main {
  flex: 2 1 420px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.gtf-qr-page__qr {
  width: min(100%, 360px);
}

.gtf-qr-page__code {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.gtf-qr-page__code-label {
  font-family: var(--gtf-mono);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.gtf-qr-page__code-value {
  font-family: var(--gtf-mono);
  font-weight: 500;
  font-size: clamp(40px, 6vw, 64px);
  letter-spacing: 0.08em;
  line-height: 1;
}

.gtf-qr-page__info {
  flex: 1 1 300px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.gtf-qr-page__game {
  display: flex;
  align-items: center;
  gap: 14px;
}

.gtf-qr-page__game-name {
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .gtf-lineup-row,
  .gtf-host-tile,
  .gtf-mode-toggle__option {
    transition: none;
  }
}

/* "Open on another device": emailed host links, inside the yellow "Run it from your phone" card */
.gtf-host-phone__access {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 18px;
  border-top: 2px solid rgba(28, 24, 20, 0.2);
}

.gtf-host-phone__access-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: normal;
}

.gtf-host-phone__access-lede {
  font-size: 15px;
  line-height: 1.45;
}

.gtf-host-phone__access form {
  margin: 0;
}
