* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: sans-serif;
  background: #0b5d3b;
  color: #fff;
}
#app { max-width: 480px; margin: 0 auto; padding: 20px 16px; }
.hidden { display: none !important; }
h1 { text-align: center; font-size: 32px; margin: 16px 0 24px; }
h2 { text-align: center; margin: 0 0 8px; }
h3 { margin: 20px 0 8px; font-size: 16px; }
label { display: block; margin: 10px 0 4px; font-size: 14px; }
input, select {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  background: #fff;
  color: #222;
}
.btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  font-size: 17px;
  font-weight: bold;
  border: 2px solid #fff;
  border-radius: 10px;
  background: transparent;
  color: #fff;
}
.btn.main { background: #f2c230; border-color: #f2c230; color: #222; }
.btn.sub { border-color: #8bbba5; color: #cfe5da; font-weight: normal; font-size: 14px; }
.btn:disabled { opacity: 0.4; }
.divider { text-align: center; margin: 20px 0 10px; color: #cfe5da; }
.msg { color: #ffd0d0; min-height: 1.4em; text-align: center; }
.small { font-size: 12px; color: #cfe5da; font-weight: normal; }
.roomid { text-align: center; font-size: 18px; }
.roomid b { font-size: 32px; letter-spacing: 4px; }
#player-list { list-style: none; padding: 0; margin: 0; }
#player-list li {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}
.settings { background: rgba(0, 0, 0, 0.2); padding: 8px 12px 14px; border-radius: 10px; }

/* ===== ゲーム画面 ===== */
.g-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px 10px;
  border-radius: 8px;
}
.g-bar b { font-size: 15px; color: #f2c230; }
.g-bar button {
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid #8bbba5;
  border-radius: 6px;
  background: transparent;
  color: #cfe5da;
}
.g-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  grid-template-areas: "top top top" "left field right";
  gap: 6px;
  margin: 8px 0;
}
.g-top { grid-area: top; display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.g-left { grid-area: left; display: flex; flex-direction: column; gap: 6px; }
.g-right { grid-area: right; display: flex; flex-direction: column; gap: 6px; }
.g-field {
  grid-area: field;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  padding: 6px;
  font-size: 12px;
  color: #cfe5da;
}
.seat {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 4px 6px;
  font-size: 12px;
  text-align: center;
  min-width: 70px;
}
.seat.turn { outline: 2px solid #f2c230; }
.seat .nm { font-weight: bold; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 90px; }
.seat .coin { color: #f2c230; }
.backs { display: flex; justify-content: center; flex-wrap: wrap; gap: 1px; margin-top: 3px; }
.me-box { text-align: center; font-size: 14px; margin-top: 4px; }
.hand { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin: 8px 0; }

/* ===== トランプ風カード ===== */
.card {
  position: relative;
  width: 46px;
  height: 66px;
  background: #fff;
  color: #222;
  border-radius: 6px;
  border: 1px solid #999;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  user-select: none;
}
.card .s { font-size: 22px; margin-top: 2px; }
.card.red { color: #d22; }
.card.joker { font-size: 11px; color: #7a2bb8; }
.card.sel { transform: translateY(-10px); outline: 2px solid #f2c230; }
.card.back {
  background: repeating-linear-gradient(45deg, #2a4fa8, #2a4fa8 4px, #1d3a82 4px, #1d3a82 8px);
  border: 2px solid #fff;
}
.card.small { width: 30px; height: 44px; font-size: 12px; }
.card.small .s { font-size: 14px; }
.card.mini { width: 16px; height: 23px; border-radius: 3px; border-width: 1px; }

.passmark { color: #ffd0d0; font-size: 11px; font-weight: bold; }
.g-btns { display: flex; gap: 10px; }
.g-btns .btn { margin-top: 4px; }

.revmark {
  color: #ffd84a;
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 4px;
}
.popup {
  position: fixed;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 22px;
  font-weight: bold;
  text-align: center;
  white-space: pre-line;
  padding: 18px 28px;
  border-radius: 14px;
  z-index: 100;
  pointer-events: none;
}
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  color: #f2c230;
  font-size: 28px;
  font-weight: bold;
  text-align: center;
  white-space: pre-line;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.overlay.foulov {
  flex-direction: column;
  gap: 14px;
  color: #ff9a9a;
}
.overlay.foulov .small { color: #cfe5da; font-size: 14px; }

.choice {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
}
.choice-box {
  background: #0b5d3b;
  border: 2px solid #f2c230;
  border-radius: 14px;
  padding: 16px 20px 20px;
  width: 80%;
  max-width: 320px;
}
.choice-title {
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 6px;
}

/* ===== リザルト・最終順位 ===== */
.overlay.resultov {
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  font-size: 24px;
}
.overlay.resultov .rs { font-size: 16px; color: #fff; font-weight: normal; }
.overlay.resultov .rs.warn { color: #ffb0b0; }
.overlay.resultov .btn { width: 80%; max-width: 320px; margin-top: 16px; }
.rank-list { margin: 16px 0; }
.rank-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  font-size: 14px;
}
.rank-row.first { background: rgba(242, 194, 48, 0.3); font-weight: bold; }

/* 言語の切りかえ(最初の画面)とサイトへのリンク */
.lang-sw { display: flex; justify-content: center; gap: 6px; margin: 0 0 12px; }
.lang-sw button { padding: 5px 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .35); background: transparent; color: #cfe5da; font-size: 12px; font-family: inherit; }
.lang-sw button.on { background: #f2c230; border-color: #f2c230; color: #1b2a22; font-weight: 700; }
.mg-foot { margin: 18px 0 0; font-size: 13px; text-align: center; color: #cfe5da; }
.mg-foot a { color: #cfe5da; }
