:root {
  --bg: #f2f0eb;
  --bg-accent: #e8e4dc;
  --ink: #1a1a18;
  --muted: #6b6860;
  --line: #cfcabe;
  --focus: #2c4a3e;
  --surface: #faf9f6;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Noto Sans SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% 0%, #ebe7df 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 100%, #e4e0d6 0%, transparent 50%),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem;
}

main {
  width: 100%;
  max-width: 28rem;
}

h1 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.4rem;
}

.rule {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 2.25rem;
}

.rule code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8em;
  color: var(--ink);
}

fieldset {
  border: none;
  margin-bottom: 1.75rem;
}

legend,
label.question {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.hint {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.55;
  margin-top: 0.35rem;
  margin-bottom: 0.75rem;
}

.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.options label {
  cursor: pointer;
}

.options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.options span {
  display: block;
  text-align: center;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.9rem;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.options label:hover span {
  border-color: var(--focus);
}

.options input:checked + span {
  border-color: var(--focus);
  background: var(--focus);
  color: #f7f5f0;
}

.options input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

input[type="text"] {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus {
  border-color: var(--focus);
}

input[type="text"]::placeholder {
  color: #a39e92;
}

.conditional {
  display: none;
}

.conditional.visible {
  display: block;
}

button {
  width: 100%;
  margin-top: 0.5rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.85rem 1rem;
  border: none;
  background: var(--ink);
  color: #f7f5f0;
  cursor: pointer;
  transition: opacity 0.15s;
}

button:hover {
  opacity: 0.88;
}

button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

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

.result {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: none;
}

.result.visible {
  display: block;
}

.result-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.result-note {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.result-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.nickname {
  flex: 1;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.85rem 0.9rem;
  background: var(--bg-accent);
  border: 1px solid var(--line);
  word-break: break-all;
  line-height: 1.4;
}

.copy {
  width: auto;
  margin: 0;
  padding: 0 1.1rem;
  white-space: nowrap;
  background: var(--focus);
}

.error {
  margin-top: 0.85rem;
  font-size: 0.8rem;
  color: #8b3a2f;
  display: none;
}

.error.visible {
  display: block;
}
