* { box-sizing: border-box; border-radius: 0!important; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: #f6f6f6;
  color: #202122;
  font-family: sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 28px;
  background: #ffffff;
  border-left: 1px solid #a2a9b1;
  border-right: 1px solid #a2a9b1;
}

a {
  color: #0645ad;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h2 {
  font-family: Georgia, "Times New Roman", "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-weight: normal;
  border-bottom: 1px solid #a2a9b1;
  padding-bottom: 4px;
  margin: 1em 0 0.5em;
}

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

th, td {
  border: 1px solid #a2a9b1;
  padding: 6px 8px;
}

th {
  background: #eaecf0;
}

button {
  background: #f8f9fa;
  border: 1px solid #a2a9b1;
  color: #202122;
  padding: 10px 20px;
  min-height: 48px;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.2;
}

button:hover:not(:disabled) {
  background: #ffffff;
}

.primary {
  background: #3366cc;
  border-color: #3366cc;
  color: #ffffff;
  font-weight: bold;
}

.primary:hover:not(:disabled) {
  background: #447ff5;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

input, textarea, select {
  border: 1px solid #a2a9b1;
  background: #fff;
  padding: 10px;
  font-size: 1rem;
  color: #202122;
  font-family: inherit;
}

label {
  display: block;
  margin-bottom: 12px;
}

input[type="text"] {
  width: 100%;
  margin-top: 4px;
}

input:focus, textarea:focus, select:focus {
  border-color: #3366cc;
  outline: none;
  box-shadow: inset 0 0 0 1px #3366cc;
}

textarea {
  resize: vertical;
}

.wordmark {
  border-bottom: 1px solid #a2a9b1;
  margin-bottom: 14px;
  padding-bottom: 10px;
}

.site-title {
  font-family: Georgia, "Times New Roman", "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 2rem;
  font-weight: normal;
  margin: 0;
}

.site-subtitle {
  font-size: 0.85rem;
  color: #54595d;
  margin: 2px 0 10px;
}

.lead {
  font-size: 1rem;
  line-height: 1.7;
  margin: 0 0 1em;
}

.passphrase-block {
  background: #f8f9fa;
  border: 1px solid #a2a9b1;
  padding: 14px;
}

.passphrase-block button {
  width: 100%;
}

.solo-block {
  margin-top: 12px;
}

.top-actions {
  display: flex;
  gap: 12px;
}

.top-actions button {
  flex: 1;
}

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

.wait-members li {
  border: 1px solid #a2a9b1;
  background: #f8f9fa;
  padding: 6px 10px;
  margin-bottom: 6px;
}

.wait-members li.me {
  background: #eaecf0;
  font-weight: bold;
}

.wait-actions {
  display: flex;
  gap: 12px;
}

.wait-actions button {
  flex: 1;
}

#wait-pass {
  font-weight: bold;
}

#wait-count {
  color: #54595d;
}

#screen-loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#loading-text {
  color: #54595d;
}

#screen-game {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

section[hidden] {
  display: none!important;
}

.modal[hidden] {
  display: none!important;
}

.game-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.game-head-label {
  font-weight: bold;
}

.small-btn {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.9rem;
}

.players-head {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #eaecf0;
  border: 1px solid #a2a9b1;
  padding: 5px 6px;
  font-size: 0.85rem;
  font-weight: bold;
}

.ph-name {
  flex: 1;
}

.ph-status {
  min-width: 4.5em;
  text-align: right;
}

.ph-score {
  min-width: 3em;
  text-align: right;
}

.players-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid #a2a9b1;
  border-top: none;
  max-height: 30vh;
  overflow-y: auto;
}

.prow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px;
  border-top: 1px solid #a2a9b1;
  background: #f8f9fa;
}

.prow.me {
  background: #eaecf0;
}

.prow.left {
  color: #72777d;
}

.pname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pstatus {
  color: #54595d;
  font-size: 0.85rem;
  min-width: 4.5em;
  text-align: right;
}

.pscore {
  font-weight: bold;
  font-size: 1.1rem;
  min-width: 3em;
  text-align: right;
}

.q-head {
  display: block;
}

#phase-status {
  color: #54595d;
  font-size: 0.9rem;
  margin: 4px 0 0;
}

.question-box {
  background: #f8f9fa;
  border: 1px solid #a2a9b1;
  padding: 12px 14px;
  margin-top: 8px;
}

#question-text {
  font-size: 1.1rem;
  line-height: 1.7;
  margin: 0;
}

#write-area, #choose-area {
  margin-top: 12px;
}

#write-area button {
  width: 100%;
}

#write-area label {
  display: block;
  margin-bottom: 12px;
}

#write-area input {
  width: 100%;
}

.error {
  color: #ba0000;
  font-size: 0.9rem;
  min-height: 1.2em;
}

#my-lie-status, #choose-status, #next-status, #end-rematch-status {
  color: #54595d;
  font-size: 0.9rem;
  min-height: 1.2em;
}

.choices-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice-btn {
  width: 100%;
  text-align: left;
  font-size: 1.05rem;
  background: #fff;
  border: 1px solid #a2a9b1;
  padding: 12px 14px;
}

.choice-btn:hover:not(:disabled) {
  background: #f8f9fa;
}

.choice-btn.mine {
  color: #72777d;
  background: #f8f9fa;
}

.choice-btn.picked {
  background: #eaecf0;
  border-color: #3366cc;
  font-weight: bold;
}

.choice-btn.picked:hover:not(:disabled) {
  background: #eaecf0;
}

#reveal-area, #disconnect-area, #end-panel {
  background: #fff;
  border: 1px solid #a2a9b1;
  padding: 14px;
  margin-top: 12px;
}

#reveal-truth {
  font-size: 1.3rem;
  font-weight: bold;
  margin: 0 0 6px;
}

sup.reference {
  font-size: 0.65em;
  font-weight: normal;
  color: #0645ad;
  vertical-align: super;
  margin-left: 2px;
}

.references {
  font-size: 0.9rem;
  color: #202122;
  padding-left: 1.6em;
  margin: 6px 0;
}

.references a {
  color: #0645ad;
}

.references li:has(> a:empty) {
  display: none;
}

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

.reveal-choices li {
  padding: 8px 10px;
  border-top: 1px solid #a2a9b1;
  line-height: 1.6;
}

.reveal-choices li.truth-row {
  background: #eaecf0;
  font-weight: bold;
}

.tag {
  display: inline-block;
  font-size: 0.75rem;
  border: 1px solid #a2a9b1;
  background: #f8f9fa;
  padding: 1px 6px;
  margin-left: 8px;
  color: #202122;
  font-weight: normal;
  vertical-align: middle;
}

.writers {
  color: #54595d;
  font-size: 0.9rem;
  margin-left: 8px;
  font-weight: normal;
}

.picked-by {
  display: block;
  color: #54595d;
  font-size: 0.85rem;
  font-weight: normal;
}

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

.reveal-gains li {
  padding: 3px 10px;
}

#btn-next {
  width: 100%;
  margin-top: 12px;
}

#end-title {
  font-family: Georgia, "Times New Roman", "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 2rem;
  font-weight: normal;
  margin: 4px 0 6px;
}

#end-message {
  color: #202122;
}

#end-scores {
  max-width: 480px;
  margin: 0 0 14px;
  border: 1px solid #a2a9b1;
}

.end-score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  font-size: 1.15rem;
  background: #f8f9fa;
  border-top: 1px solid #a2a9b1;
}

.end-score-row:first-child {
  border-top: none;
}

.end-score-row strong {
  font-size: 1.6rem;
}

.winner {
  background: #eaecf0;
  font-weight: bold;
}

.left {
  color: #72777d;
}

#end-panel button {
  width: 100%;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.modal-box {
  position: relative;
  z-index: 1;
  background: #fff;
  border: 1px solid #a2a9b1;
  max-width: 560px;
  max-height: 84vh;
  overflow-y: auto;
  margin: 8vh auto 0;
  padding: 20px;
  width: calc(100% - 32px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.modal-box h2 {
  font-family: Georgia, "Times New Roman", "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-weight: normal;
  border-bottom: 1px solid #a2a9b1;
  padding-bottom: 4px;
  margin: 0 0 12px;
}

.modal-body {
  line-height: 1.7;
}

.modal-body ul {
  padding-left: 1.2em;
}

.modal-note {
  font-size: 0.85rem;
  color: #54595d;
}

.modal-box button {
  width: 100%;
  margin-top: 12px;
}

#toasts {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  max-width: 92vw;
}

.toast {
  background: #202122;
  color: #fff;
  padding: 10px 16px;
  font-size: 0.95rem;
  transition: opacity 0.4s;
  text-align: center;
}

.toast.fade {
  opacity: 0;
}

.debug {
  font-size: 0.75rem;
  color: #72777d;
  word-break: break-all;
}

.support-link {
  border-top: 1px solid #a2a9b1;
  margin: 24px 0 4px;
  padding-top: 10px;
  font-size: 12.5px;
  color: #54595d;
  text-align: left;
}

@media (max-width: 640px) {
  main {
    padding: 14px 16px;
  }
}