/* Periodic Speller — theme vars, page chrome, app shell, basic tile
   styling, and the "no match" hint. */

:root {
  --bg: var(--surface-0);
  --surface: var(--surface-1);
  --border: var(--hairline-strong);
  --text: var(--text-1);
  --text-muted: var(--text-2);
  /* Page chrome accent routes to brand violet. The element-category
     palette below is kept as-is — those colors are data, not chrome. */
  --accent: var(--accent-primary);
  --accent-glow: var(--accent-primary-soft);
  --tile-bg: var(--surface-1);
  --tile-border: var(--accent-primary);
  --tile-symbol: var(--text-1);
  --tile-number: var(--accent-primary);
  --tile-name: var(--text-2);
  --unmatched-bg: var(--hairline-strong);
  --unmatched-text: var(--text-3);
  --category-nonmetal: #22d3ee;
  --category-noble: var(--accent-primary);
  --category-alkali: #f87171;
  --category-alkaline: #fb923c;
  --category-metalloid: #34d399;
  --category-halogen: #facc15;
  --category-transition: #60a5fa;
  --category-post-transition: #4ade80;
  --category-lanthanide: #f472b6;
  --category-actinide: #e879f9;
  --category-custom: #f59e0b;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header {
  text-align: center;
  padding: 3rem 1rem 1rem;
}

header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent), var(--accent-primary-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 0.4rem;
  font-size: 1rem;
}

main {
  width: 100%;
  max-width: 720px;
  padding: 1rem 1.5rem 3rem;
}

.input-area {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 2rem;
  position: relative;
}

.input-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
}

#wordInput {
  width: 100%;
  padding: 1rem 2.5rem 1rem 1.25rem;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#wordInput::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

#wordInput {
  resize: vertical;
  font-family: inherit;
  line-height: 1.4;
}

#wordInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

#clearBtn {
  position: absolute;
  right: 0.75rem;
  top: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
  display: none;
}

#clearBtn:hover {
  color: var(--text);
  background: var(--border);
}

.tiles {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: center;
  min-height: 120px;
}

.tile-word {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
}

.tile {
  width: 100px;
  height: 120px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--tile-border);
  background: var(--tile-bg);
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: tileIn 0.3s ease-out both;
}

.tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--pure-black) 30%, transparent);
}

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

.tile-number {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--tile-number);
  position: absolute;
  top: 6px;
  left: 8px;
}

.tile-symbol {
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--tile-symbol);
  line-height: 1;
}

.tile-name {
  font-size: 0.65rem;
  color: var(--tile-name);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

.tile-mass {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.tile-unmatched {
  width: 100px;
  height: 120px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--unmatched-text);
  background: var(--unmatched-bg);
  animation: tileIn 0.3s ease-out both;
}

.tile-unmatched .tile-symbol {
  color: var(--unmatched-text);
  font-size: 2.6rem;
  font-weight: 800;
}

.tile-unmatched .tile-name {
  font-size: 0.65rem;
  color: var(--unmatched-text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

.no-match {
  text-align: center;
  padding: 1rem 0 0.5rem;
  color: var(--text-muted);
}

.no-match-icon {
  font-size: 2rem;
}

.no-match p {
  margin-top: 0.3rem;
}

.no-match-hint {
  font-size: 0.85rem;
  color: var(--unmatched-text);
}
