/* Word Unscrambler – clean, mobile-first styles */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
}

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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
}

header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.logo {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.logo span {
  color: var(--primary);
}

nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
nav a {
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 500;
}
nav a:hover {
  color: var(--primary);
}

.hero {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
}
.hero h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  margin-bottom: 0.5rem;
  line-height: 1.2;
}
.hero p {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 560px;
  margin: 0 auto 1.5rem;
}

.badge {
  display: inline-block;
  background: #dbeafe;
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.tool-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border);
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

input[type="text"],
select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.15s;
}
input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.15);
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  width: 100%;
}
.btn:hover {
  background: var(--primary-dark);
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: #e2e8f0;
}

.results {
  margin-top: 1.5rem;
  min-height: 40px;
}

.result-group {
  margin-bottom: 1.25rem;
}
.result-group h3 {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.word {
  background: #f1f5f9;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}
.word:hover {
  background: #dbeafe;
  color: var(--primary-dark);
}
.word.copied {
  background: #dcfce7;
  color: var(--success);
}

.status {
  text-align: center;
  color: var(--muted);
  padding: 1rem;
  font-size: 0.95rem;
}

.content {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.content h2 {
  font-size: 1.4rem;
  margin: 1.75rem 0 0.75rem;
}
.content h2:first-child {
  margin-top: 0;
}
.content h3 {
  font-size: 1.15rem;
  margin: 1.25rem 0 0.5rem;
}
.content p,
.content li {
  margin-bottom: 0.75rem;
  color: #334155;
}
.content ul {
  padding-left: 1.4rem;
  margin-bottom: 1rem;
}
.content strong {
  color: var(--text);
}

footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}
footer a {
  color: var(--muted);
  margin: 0 0.5rem;
}
footer a:hover {
  color: var(--primary);
}

@media (max-width: 600px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  nav {
    gap: 0.85rem;
  }
  .filters {
    grid-template-columns: 1fr 1fr;
  }
}
