.sgo {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px 56px;
}
.sgo [hidden] {
  display: none !important;
}
body.busy .sgo button {
  cursor: progress;
}
.narrow {
  max-width: 460px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}
.center {
  text-align: center;
}
.muted {
  color: #6b6461;
  margin: 0;
}
.small {
  font-size: 14px;
}
.right {
  margin-left: auto;
}
.stack {
  display: grid;
  gap: 12px;
}
.h2 {
  font-size: 20px;
  margin: 0 0 10px;
}
.tag {
  display: inline-block;
  font-size: 12px;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 999px;
  background: #efe9dd;
  color: var(--sg-ink);
  font-weight: 500;
  white-space: nowrap;
}
.tag.you {
  background: var(--sg-blue);
  color: #fff;
}
.tag.red {
  background: var(--sg-red);
  color: #fff;
}
.dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22b573;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px #22b573;
}
.dot.off {
  background: #bbb;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px #bbb;
}

/* ---------- home ---------- */
.sgo-hero {
  text-align: center;
}
.sgo-hero h1,
.sgo-hero div.sg-logo {
  font-family: var(--sg-font-card);
  font-size: 56px;
  line-height: 1.05;
  margin: 4px 0 8px;
}
.sgo-hero p {
  margin: 0;
  line-height: 1.6;
}
.field {
  display: grid;
  gap: 6px;
  font-weight: 500;
}
.or {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #8b8481;
  font-size: 14px;
}
.or::before,
.or::after {
  content: "";
  flex: 1;
  height: 2px;
  background: #e8e1d3;
}
.join {
  display: flex;
  gap: 8px;
}
.join .code {
  font-family: var(--sg-font-card);
  font-size: 22px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
  min-width: 0;
}
.join .code::placeholder {
  font-family: var(--sg-font-th);
  font-size: 16px;
  letter-spacing: 0;
}
.join .sg-btn {
  white-space: nowrap;
  flex: 0 0 auto;
}
.rules summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 17px;
}
.rules p,
.rules ul {
  font-size: 15px;
  line-height: 1.7;
  margin: 10px 0 0;
}
.powers {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 14px;
}
.powers td {
  padding: 6px 4px;
  border-top: 1px solid #eee6d6;
  vertical-align: top;
}
.powers td:first-child {
  white-space: nowrap;
  font-family: var(--sg-font-card);
  width: 1%;
  padding-right: 12px;
}

/* ---------- lobby ---------- */
.room-code {
  font-family: var(--sg-font-card);
  font-size: 64px;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1;
  color: var(--sg-ink);
}
.link {
  color: #6b6461;
  font-size: 12px;
  word-break: break-all;
}
.seats {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 6px;
}
.seat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid #e8e1d3;
  border-radius: 12px;
  background: #fff;
}
.seat.me {
  border-color: var(--sg-blue);
}
.seat.empty {
  border-style: dashed;
  color: #b9b1a5;
  justify-content: center;
}
.seat-name {
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
#startBtn {
  margin-top: 10px;
}
.ghost {
  margin-top: 8px;
  border-color: transparent;
  box-shadow: none;
  background: transparent;
  color: #6b6461;
}

/* ---------- game ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid #e8e1d3;
  font-size: 14px;
  min-height: 34px;
}
.chip b {
  font-family: var(--sg-font-card);
}
.chip.discard {
  padding: 2px 8px;
}
.chip.discard .sg-card {
  border-width: 2px;
  box-shadow: none;
}
.turn {
  flex: 1;
  text-align: right;
  font-size: 16px;
  min-width: 120px;
}
.turn .you {
  color: var(--sg-blue);
  font-size: 18px;
}
.endat {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff3cc;
  font-size: 14px;
}

.opps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.opp {
  --pill-h: 26px;
  --row-gap: 4px;
  background: #fff;
  border: 2.5px solid #e8e1d3;
  border-radius: 14px;
  padding: 8px 10px 10px;
}
.opp.cur {
  border-color: var(--sg-yellow);
  box-shadow: 0 0 0 2px var(--sg-yellow);
}
.opp-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 15px;
}
.opp-name {
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.opp-hand {
  font-family: var(--sg-font-card);
  font-weight: 600;
}

.banner {
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff;
  border: 2px solid #e8e1d3;
  margin-bottom: 12px;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.banner.you {
  background: #e6f4fe;
  border-color: var(--sg-blue);
}
.banner.warn {
  background: #fff3cc;
  border-color: var(--sg-yellow);
}

.me {
  --pill-h: 50px;
  background: #fff;
  border: 3px solid var(--sg-ink);
  border-radius: 20px;
  box-shadow: 0 4px 0 var(--sg-ink);
  padding: 14px;
  margin-bottom: 14px;
}
.me.cur {
  box-shadow: 0 0 0 4px var(--sg-yellow), 0 4px 0 var(--sg-ink);
}
.me-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 16px;
}
.my-row {
  margin-bottom: 14px;
}
.hand {
  --card-w: 66px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 2px 8px;
  margin: 0 -4px;
  scroll-snap-type: x proximity;
}
.hand .sg-card {
  scroll-snap-align: start;
}
.hand .sg-card.new {
  outline: 3px dashed var(--sg-blue);
  outline-offset: 2px;
}
.hand .empty,
.actions .empty {
  color: #8b8481;
  margin: 8px 0;
}
.actions {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.actions .sg-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}
.actions .sg-btn small {
  font-size: 13px;
  font-weight: 400;
  opacity: 0.85;
}

.log-box summary {
  cursor: pointer;
  font-weight: 500;
}
.log {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.65;
  color: #6b6461;
}
.log li:first-child {
  color: var(--sg-ink);
}

/* ---------- sheets (target picker, end) ---------- */
.sheet {
  position: fixed;
  inset: 0;
  background: rgba(35, 31, 32, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
@media (min-width: 640px) {
  .sheet {
    align-items: center;
  }
}
.sheet-card {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.sheet-head h3 {
  font-size: 18px;
  margin: 0;
}
.targets {
  display: grid;
  gap: 8px;
}
.target {
  --pill-h: 24px;
  --row-gap: 4px;
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 10px 12px;
  border: 2.5px solid var(--sg-ink);
  border-radius: 14px;
  background: #fff;
  font-family: var(--sg-font-th);
  color: var(--sg-ink);
  cursor: pointer;
}
.target:hover:not(:disabled) {
  background: #fff8e2;
}
.target.picked {
  background: #e6f4fe;
  border-color: var(--sg-blue);
  box-shadow: 0 0 0 2px var(--sg-blue);
}
.target:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.t-name {
  font-weight: 500;
  font-size: 16px;
}
.t-meta {
  font-size: 13px;
  color: #6b6461;
}
.sheet-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}
.sheet-actions .sg-btn {
  flex: 1 1 140px;
}
.winner {
  font-size: 36px;
  margin: 4px 0;
}
.stats {
  font-family: var(--sg-font-card);
  font-size: 16px;
  margin: 8px 0;
}
.end-table {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 6px;
  text-align: left;
}
.end-table li {
  --pill-h: 22px;
  --row-gap: 3px;
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 2px solid #e8e1d3;
}
.end-table li.win {
  border-color: var(--sg-yellow);
  background: #fffbea;
}

/* ---------- Take: pick from the discard pile ---------- */
.discard-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px;
}
.discard-pick button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

/* ---------- dev bar ---------- */
.devbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  margin-bottom: 12px;
  background: #231f20;
  color: #ffc21a;
  border-radius: 12px;
  font-size: 13px;
}

@media (max-width: 480px) {
  .sgo-hero h1,
.sgo-hero div.sg-logo {
    font-size: 46px;
  }
  .room-code {
    font-size: 52px;
  }
  .me {
    --pill-h: 40px;
    padding: 12px;
  }
  .hand {
    --card-w: 58px;
  }
  .opps {
    grid-template-columns: 1fr 1fr;
  }
  .opp {
    --pill-h: 20px;
    --row-gap: 3px;
    padding: 6px 8px 8px;
  }
  .opp-head {
    font-size: 13px;
  }
  .turn {
    min-width: 0;
    flex-basis: 100%;
    order: 9;
    text-align: left;
  }
  .shout-btn {
    font-size: 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .shout-btn {
    animation: none;
  }
}

#againWait {
  flex-basis: 100%;
}

/* ---------- card info (tap a card in hand) ---------- */
.card-info {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #fff8e6;
  border: 2.5px solid var(--sg-ink);
  border-radius: 14px;
  padding: 10px 12px;
}
.card-info .sg-card {
  border-width: 2px;
  box-shadow: none;
}
.card-info b {
  font-size: 17px;
}
.card-info p {
  margin: 2px 0 0;
  font-size: 14px;
  line-height: 1.5;
}
.card-info .fit {
  display: inline-block;
  margin-top: 6px;
  font-size: 13px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #f3eee4;
}
.card-info .fit.need {
  background: var(--sg-yellow);
  font-weight: 600;
}

/* ---------- hand guide (while discarding / giving) ---------- */
.hand-guide {
  margin-top: 6px;
  border: 2px dashed #c9c3b8;
  border-radius: 14px;
  padding: 8px 10px;
}
.hand-guide .guide-title {
  margin: 0 0 6px;
  font-size: 13px;
  color: #6b6461;
}
.hand-guide ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.hand-guide li {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 4px 6px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
}
.hand-guide li:hover,
.hand-guide li.on {
  background: #fff3d6;
}
.hand-guide li .sg-card {
  border-width: 2px;
  box-shadow: none;
}
.hand-guide li span {
  color: #4a4446;
}
.hand-guide li em {
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  background: var(--sg-yellow);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}
.hand-guide li i {
  font-style: normal;
  font-family: var(--sg-font-card);
  font-weight: 600;
  color: var(--sg-blue);
}
.hand-guide { margin-top: 10px; }
