/* ============================================
   Word Unscrambler — Mobile-First Stylesheet
   ============================================ */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

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

/* Layout */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  margin-left: 16px;
}

.site-nav a:hover {
  color: var(--primary);
}

/* Ad Slots */
.ad-slot {
  background: var(--border);
  border: 1px dashed var(--text-muted);
  text-align: center;
  padding: 20px;
  margin: 16px 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-radius: var(--radius);
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-slot-header {
  min-height: 90px;
}

.ad-slot-sidebar {
  min-height: 250px;
}

.ad-slot-between {
  min-height: 90px;
}

/* Hero / Tool Section */
.tool-section {
  padding: 32px 0;
  text-align: center;
}

.tool-section h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
}

.tool-section .subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Input Area */
.input-group {
  display: flex;
  gap: 8px;
  max-width: 500px;
  margin: 0 auto 16px;
}

.input-group input {
  flex: 1;
  padding: 14px 16px;
  font-size: 1.125rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 600;
}

.input-group input:focus {
  border-color: var(--primary);
}

.input-group input::placeholder {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  color: var(--text-muted);
}

.btn-primary {
  padding: 14px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.input-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Results */
.results-container {
  text-align: left;
  margin-top: 24px;
}

.results-summary {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.results-summary strong {
  color: var(--text);
}

.word-group {
  margin-bottom: 24px;
}

.word-group-header {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
  padding: 4px 0;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
}

.word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.word-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.word-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.word-item .points {
  font-size: 0.7rem;
  background: var(--primary);
  color: #fff;
  padding: 2px 5px;
  border-radius: 4px;
  font-weight: 700;
}

/* Word Definition Popup */
.word-popup {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
  padding: 20px;
  z-index: 200;
  max-height: 40vh;
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
}

.word-popup.active {
  display: block;
}

.word-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.word-popup-header h3 {
  font-size: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.word-popup-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
}

.word-popup-points {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.word-popup-points span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.word-popup-points strong {
  color: var(--text);
}

.word-popup-definition {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.6;
}

/* Features Section */
.features {
  padding: 32px 0;
  border-top: 1px solid var(--border);
}

.features h2 {
  font-size: 1.25rem;
  margin-bottom: 20px;
  text-align: center;
}

/* How It Works Steps */
.how-steps {
  display: flex;
  gap: 20px;
  margin-bottom: 32px;
  justify-content: center;
  flex-wrap: wrap;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 280px;
}

.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.step p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.step p strong {
  color: var(--text);
}

.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.feature-card h3 {
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--text);
}

.feature-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Internal Links Section */
.internal-links {
  padding: 24px 0;
  border-top: 1px solid var(--border);
}

.internal-links h2 {
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.internal-links-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.internal-links-list a {
  display: inline-block;
  padding: 6px 12px;
  font-size: 0.8rem;
  color: var(--primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
}

.internal-links-list a:hover {
  border-color: var(--primary);
}

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: 32px;
  text-align: center;
}

.site-footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.site-footer nav {
  margin-top: 8px;
}

.site-footer nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  margin: 0 8px;
}

.site-footer nav a:hover {
  color: var(--primary);
}

/* Loading State */
.loading {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* No Results */
.no-results {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.no-results p {
  font-size: 1rem;
  margin-bottom: 8px;
}

/* ============================================
   Tablet & Desktop
   ============================================ */

@media (min-width: 640px) {
  .tool-section h1 {
    font-size: 2.25rem;
  }

  .features-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ad-slot-header {
    min-height: 90px;
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: 900px;
  }

  .features-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .word-popup {
    bottom: auto;
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
    border-radius: var(--radius);
    max-width: 480px;
    width: 90%;
    max-height: 60vh;
    border: 1px solid var(--border);
  }
}


/* ============================================
   Cookie Consent Banner
   Slim, non-blocking, GDPR/UK PECR compliant
   ============================================ */

#consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--text);
  color: #fff;
  padding: 14px 16px;
  z-index: 9999;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
}

.consent-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.consent-text {
  font-size: 0.82rem;
  line-height: 1.4;
  flex: 1;
  min-width: 200px;
}

.consent-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.consent-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.consent-accept {
  background: #16a34a;
  color: #fff;
}

.consent-accept:hover {
  background: #15803d;
}

.consent-reject {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
}

.consent-reject:hover {
  border-color: #fff;
}

.consent-link {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
  text-decoration: underline;
}

.consent-link:hover {
  color: #fff;
}

@media (max-width: 500px) {
  .consent-inner {
    flex-direction: column;
    text-align: center;
  }
  .consent-actions {
    width: 100%;
    justify-content: center;
  }
}
