:root {
  --bg: #f7f3ed;
  --bg-glow: #ecdfd0;
  --text: #1a1a1a;
  --muted: #5c5752;
  --border: #2d2a26;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;

  background:
    radial-gradient(circle at 15% 15%, var(--bg-glow) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, var(--bg-glow) 0%, transparent 45%),
    var(--bg);

  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 720px;
  width: 100%;
  text-align: center;
}

.avatar {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 1.5rem;
  display: block;
  box-shadow: 0 8px 24px rgba(26, 26, 26, 0.12);
  border: 3px solid var(--bg);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.avatar,
h1,
.bio,
.links {
  opacity: 0;
  animation: fadeUp 700ms ease-out forwards;
}

.avatar { animation-delay: 0ms; }
h1      { animation-delay: 150ms; }
.bio    { animation-delay: 300ms; }
.links  { animation-delay: 450ms; }

@media (prefers-reduced-motion: reduce) {
  .avatar,
  h1,
  .bio,
  .links {
    opacity: 1;
    animation: none;
  }
}

h1 {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(4rem, 14vw, 9rem);
  font-weight: 400;
  margin: 0 0 1.5rem;
  letter-spacing: -0.02em;
  line-height: 1;
}

.bio {
  color: var(--muted);
  font-size: 1.25rem;
  max-width: 520px;
  margin: 0 auto 3rem;
}

.links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.links a,
.links .link-button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  color: var(--text);
  background: transparent;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 150ms ease, background-color 150ms ease, color 150ms ease;
}

.links a:hover,
.links .link-button:hover {
  background-color: var(--text);
  color: var(--bg);
  transform: translateY(-2px);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 16, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2rem;
  max-width: 540px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  animation: fadeUp 250ms ease-out;
}

.modal-card h2 {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 2.25rem;
  font-weight: 400;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

.modal-card .instructions {
  color: var(--muted);
  margin: 0 0 1rem;
  font-size: 0.95rem;
}

.modal-card kbd {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-glow);
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 1.75rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem 0.5rem;
}

.modal-close:hover {
  color: var(--text);
}

#game-canvas {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  aspect-ratio: 480 / 360;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  touch-action: manipulation;
  cursor: pointer;
}

.reveal {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.1rem;
  margin: 1rem 0 0.25rem;
  letter-spacing: 0.02em;
  word-break: break-all;
}

.game-status {
  margin: 0.5rem 0 0;
  color: var(--muted);
  min-height: 1.5em;
}

.game-status .retry-button {
  margin-left: 0.5rem;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.game-status .retry-button:hover {
  background: var(--text);
  color: var(--bg);
}

.visit-link {
  margin-top: 1rem;
}
