:root {
  --bg: #fff8e7;
  --fg: #333;
  --accent: #ff9c4a;
  --accent-dark: #e07a25;
  --accent-light: #ffd9b3;
  --card: #fff;
  --border: #f0d9b0;
  --muted: #888;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
}
body {
  padding: 16px;
  color: var(--fg);
  font-family: 'Comic Sans MS', 'Hiragino Maru Gothic ProN', 'Yu Gothic UI', sans-serif;
  font-size: 18px;
  max-width: 1100px;
  margin: 0 auto;
  line-height: 1.6;
}
header { text-align: center; }
h1 { font-size: 32px; margin: 8px 0; }
h2 { font-size: 22px; margin: 20px 0 12px; }
.hint { color: #666; font-size: 15px; margin: 4px 0 24px; }

section { margin-bottom: 24px; }

textarea {
  width: 100%;
  min-height: 140px;
  padding: 14px;
  font-size: 18px;
  border-radius: 14px;
  border: 2px solid var(--border);
  resize: vertical;
  font-family: inherit;
  background: #fff;
  outline: none;
}
textarea:focus { border-color: var(--accent); }

button {
  font-size: 20px;
  padding: 12px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  transition: transform 0.08s, background 0.15s;
}
button:hover { background: var(--accent-dark); }
button:active { transform: scale(0.96); }
button:disabled { opacity: 0.5; cursor: wait; }
button.ghost {
  background: transparent;
  color: var(--accent-dark);
  border: 2px solid var(--border);
}
button.ghost:hover { background: var(--accent-light); }

#gen-btn {
  display: block;
  margin: 16px auto 0;
  font-size: 24px;
  padding: 16px 40px;
}

#status {
  text-align: center;
  font-size: 16px;
  color: var(--accent-dark);
  min-height: 24px;
  margin: 12px 0;
}

#play iframe {
  display: block;
  width: min(100%, 640px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border: 3px solid var(--border);
  border-radius: 14px;
  background: white;
}
.play-actions {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.play-actions button { font-size: 16px; padding: 10px 18px; }

.refine-box {
  margin-top: 24px;
  padding: 16px;
  background: #fff;
  border: 2px dashed var(--border);
  border-radius: 14px;
}
.refine-box h3 {
  margin: 0 0 10px;
  font-size: 18px;
  color: var(--accent-dark);
}
.refine-box textarea {
  min-height: 80px;
  margin-bottom: 10px;
}
.refine-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.refine-actions button {
  font-size: 16px;
  padding: 10px 14px;
  flex: 1 1 200px;
  min-width: 0;
}
.btn-fast {
  background: #ffce5c;
  color: #4a3000;
}
.btn-fast:hover { background: #e8b132; }
.btn-smart {
  background: #6ec5ff;
  color: white;
}
.btn-smart:hover { background: #3e9adf; }
.ws-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 4px 0 10px;
  background: #f7f1e3;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
}
.ws-toggle input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}
#refine-status {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--accent-dark);
  min-height: 18px;
}

#games {
  list-style: none;
  padding: 0;
  margin: 0;
}
#games li {
  background: var(--card);
  padding: 12px 16px;
  margin-bottom: 8px;
  border-radius: 14px;
  border: 2px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
#games li .title {
  flex: 1;
  font-size: 16px;
  word-break: break-word;
}
#games li .actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
#games li button {
  font-size: 14px;
  padding: 6px 12px;
}
#games li .del-btn { background: var(--muted); }
#games .empty { color: var(--muted); border: 2px dashed var(--border); background: transparent; justify-content: center; }

/* === 画面下の設定リンク === */
.site-footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  text-align: center;
}
.link-btn {
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 4px 10px;
  font-weight: normal;
  border-radius: 8px;
}
.link-btn:hover { background: var(--accent-light); color: var(--accent-dark); }

/* === あいことば モーダル === */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(50, 30, 10, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--bg);
  border: 3px solid var(--accent);
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  text-align: center;
}
.modal-card h2 {
  margin: 0 0 12px;
  font-size: 24px;
  color: var(--accent-dark);
}
.modal-hint {
  font-size: 15px;
  color: var(--fg);
  margin: 0 0 16px;
  line-height: 1.5;
}
.modal-hint code {
  background: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  color: var(--accent-dark);
  font-size: 14px;
}
#key-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border-radius: 12px;
  border: 2px solid var(--border);
  font-family: 'Courier New', monospace;
  background: #fff;
  outline: none;
  letter-spacing: 0.5px;
}
#key-input:focus { border-color: var(--accent); }
.key-error {
  color: #d04040;
  font-size: 14px;
  margin: 8px 0 0;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 18px 0 12px;
}
.modal-actions button {
  font-size: 17px;
  padding: 10px 22px;
}
.modal-foot {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 0;
  line-height: 1.5;
}
