@charset "UTF-8";

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: #eeffee;
  color: #222;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  line-height: 1.6;
}

header,
main,
footer {
  display: block;
}

a {
  color: #00aaff;
  transition: color 0.2s;
}
a:hover {
  color: #0077aa;
}

header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 15px 20px;
  background: rgba(255, 255, 255, 0.8);
  position: sticky;
  top: 0;
  z-index: 1;
}
header h1 {
  margin: 0;
  font-size: 22px;
  color: #009900;
}
header nav ul {
  list-style: none;
  display: flex;
  gap: 12px;
  margin: 0;
  padding: 0;
}

.link_button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #00aaff;
  cursor: pointer;
  text-decoration: underline;
}
.link_button:hover {
  color: #0077aa;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.lead {
  color: #444;
}

.mode-panel {
  background: #fff;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
}
.mode-panel h2 {
  font-size: 16px;
  margin: 0 0 8px;
  color: #009900;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0 20px;
}
.mode-tabs a {
  padding: 8px 14px;
  border-radius: 8px;
  background: #fff;
  color: #444;
  text-decoration: none;
  font-size: 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.mode-tabs a.active {
  background: #009900;
  color: #fff;
}

.inline-form {
  display: inline-block;
  margin: 4px 8px 4px 0;
}

details > summary {
  cursor: pointer;
}
details textarea {
  width: 100%;
  margin-top: 6px;
  font-family: monospace;
  font-size: 12px;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.status-label {
  min-height: 1.4em;
  margin: 8px 0;
  color: #333;
}

.button {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 8px;
  background: #009900;
  color: #fff;
  text-decoration: none;
  border: none;
  font-size: 15px;
  cursor: pointer;
  margin: 4px 8px 4px 0;
}
.button:hover {
  background: #007700;
  color: #fff;
}
.button.secondary {
  background: #00aaff;
}
.button.secondary:hover {
  background: #0077aa;
}

.small-button {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background: #009900;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  margin: 2px 4px 2px 0;
}
.small-button:hover {
  background: #007700;
}
.small-button.ghost {
  background: none;
  border: 1px solid #999;
  color: #555;
}
.small-button.ghost:hover {
  background: #f0f0f0;
}

.note {
  font-size: 13px;
  color: #666;
}

.form-message {
  width: 100%;
  margin: 6px 0 0;
  font-size: 13px;
  min-height: 1.4em;
}
.form-message.ok {
  color: #009900;
}
.form-message.error {
  color: #cc3333;
}

.match-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.match-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid #eee;
}
.match-row-info {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
}
.match-status {
  font-size: 13px;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.empty-note {
  color: #888;
  padding: 10px 4px;
}

.players-label {
  font-weight: bold;
  margin: 8px 0 4px;
}

.pchat-secret-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #333;
  color: #fff;
  font-size: 11px;
  font-weight: normal;
  vertical-align: middle;
}

.pchat-secret-details {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed #ccc;
}
.pchat-secret-details summary {
  font-size: 13px;
}

.mode-panel input[type="text"] {
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font: inherit;
  margin-right: 6px;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  margin: 10px 0;
  min-height: 240px;
  max-height: 55vh;
  overflow-y: auto;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.chat-message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 80%;
}
.chat-message.mine {
  align-self: flex-end;
  align-items: flex-end;
}
.chat-message-body {
  background: #f0f0f0;
  border-radius: 12px;
  padding: 8px 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-message.mine .chat-message-body {
  background: #009900;
  color: #fff;
}
.chat-message-time {
  font-size: 11px;
  color: #999;
  margin-top: 2px;
}
.chat-read-tick {
  margin-left: 6px;
  color: #009900;
}

.chat-send-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-send-form textarea {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  resize: vertical;
  font: inherit;
}
.chat-send-form button {
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  background: #009900;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
.chat-send-form button:hover {
  background: #007700;
}

#p2p-host-block textarea,
#p2p-guest-block textarea {
  width: 100%;
  font-family: monospace;
  font-size: 12px;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
  resize: vertical;
}

.pchat-share-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 4px 0 10px;
}
.pchat-unavailable-note {
  margin: 0;
}

/* JS不要のCSS onlyモーダル(pipsの .modal + :target と同じ考え方)。
   :target非対応の極端に古いブラウザではdisplay:noneのままになるため、
   モーダル内には必ず同じ内容の通常ページへのリンクも併記し、
   モーダルを機能の唯一の入口にしない。 */
.pchat-modal-target {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 16px;
}
.pchat-modal-target:target {
  display: flex;
}
.pchat-modal-target-inner {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  max-width: 480px;
  width: 100%;
}
.pchat-modal-target-inner h2 {
  margin-top: 0;
  color: #009900;
  font-size: 16px;
}

.pchat-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.pchat-modal {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}
.pchat-modal h3 {
  margin: 0 0 12px;
  color: #009900;
  font-size: 16px;
}
.pchat-modal-body {
  margin-bottom: 14px;
}
.pchat-qr-image {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 0 auto 10px;
  image-rendering: pixelated;
}
.pchat-scan-video {
  display: block;
  width: 100%;
  border-radius: 8px;
  background: #000;
}

footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  font-size: 12px;
  color: #777;
}

@media (max-width: 480px) {
  main {
    padding: 14px 10px 50px;
  }
  .mode-panel {
    padding: 12px;
  }
  .chat-message {
    max-width: 92%;
  }
}
