@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-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 16px 0 24px;
  padding: 12px 14px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.mode-switcher label {
  font-weight: bold;
}
.mode-switcher select {
  flex: 1;
  min-width: 220px;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 15px;
}

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

.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;
}

.invite-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.invite-form label {
  font-weight: bold;
  width: 100%;
}
.invite-form input[type="text"] {
  flex: 1;
  min-width: 160px;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
}
.invite-form button {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  background: #009900;
  color: #fff;
  cursor: pointer;
}

.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;
}
.empty-note {
  color: #888;
  padding: 10px 4px;
}

.players-label,
.score-label {
  font-weight: bold;
  margin: 8px 0 4px;
}
.status-label {
  min-height: 1.4em;
  margin: 8px 0;
  color: #333;
}

.board-container {
  display: flex;
  justify-content: center;
  margin: 12px 0;
}

.othello-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  width: min(92vw, 420px);
  aspect-ratio: 1 / 1;
  background: #006622;
  border: 4px solid #004411;
  border-radius: 6px;
  gap: 2px;
  padding: 2px;
}

.cell {
  position: relative;
  background: #009933;
  border: none;
  padding: 0;
  cursor: default;
}
.cell::before {
  content: "";
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  transition: background 0.15s, transform 0.15s;
}
.cell.black::before {
  background: #111;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.cell.white::before {
  background: #f5f5f5;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.cell.legal {
  cursor: pointer;
  background: #00b33c;
}
.cell.legal::before {
  inset: 38%;
  background: rgba(255, 255, 255, 0.5);
}
.cell.legal:hover::before {
  background: rgba(255, 255, 255, 0.8);
}

#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;
}

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;
  }
}
