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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f9f9f7;
  color: #1a1a1a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  gap: 1.2rem;
  text-align: center;
}

h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: .02em; }

.sub, .hint { color: #555; font-size: 1rem; max-width: 480px; line-height: 1.6; }

.error { color: #c0392b; font-size: .9rem; }
.hidden { display: none !important; }

form { display: flex; flex-direction: column; align-items: center; gap: .8rem; width: 100%; max-width: 360px; }

input[type="email"], input[type="text"] {
  width: 100%;
  padding: .6rem .9rem;
  border: 1.5px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  outline: none;
  transition: border-color .2s;
}
input:focus { border-color: #D97757; }

button {
  padding: .6rem 2rem;
  background: #D97757;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background .2s;
}
button:hover { background: #c4623e; }

.btn-secondary {
  background: transparent;
  color: #888;
  border: 1.5px solid #ccc;
}
.btn-secondary:hover { background: #f0f0ee; color: #555; }

.inline-form { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; justify-content: center; }
.inline-form input { width: 120px; }

.four-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; width: 100%; }
.four-inputs input { text-align: center; }

footer {
  text-align: center;
  padding: 1rem;
  font-size: .8rem;
  color: #999;
  line-height: 1.8;
}

#overlay, #sending-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.92);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .3s ease;
  z-index: 100;
}
.overlay-box { text-align: center; }
.check { font-size: 4rem; color: #D97757; animation: pop .4s ease; }
.overlay-box p { font-size: 1.4rem; font-weight: 600; margin-top: .5rem; }

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { 0% { transform: scale(0) } 70% { transform: scale(1.2) } 100% { transform: scale(1) } }
@keyframes spin { to { transform: rotate(360deg) } }

.spinner {
  width: 2.5rem; height: 2.5rem;
  border: 3px solid #eee;
  border-top-color: #D97757;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto .8rem;
}

#ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  grid-template-rows: repeat(3, 64px);
  gap: 6px;
  margin: .6rem auto 0;
  width: fit-content;
}
#ttt-board .cell {
  width: 64px; height: 64px;
  background: #fff;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 1.6rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
#ttt-board .cell:hover:not(.taken) { background: #f5f0ec; }
#ttt-board .cell.taken { cursor: default; }
#ttt-board .cell.win { background: #fde8df; border-color: #D97757; }
