/* Barebones, minimalist word categories game with Helvetica and square geometry */

:root {
  --font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  
  --color-yellow: #FF5A24;
  --color-green: #19F30C;
  --color-blue: #26c9ff;
  --color-purple: #e60cf3;
  
  --tile-bg: #feecd5;
  --tile-bg-hover: #fae0c2;
  --tile-bg-selected: #1a1a1a;
  --tile-text-selected: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0 !important; /* Strict square corners everywhere */
}

body {
  font-family: var(--font-family);
  background-color: #ffffff;
  color: #121212;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* Header */
.header {
  border-bottom: 2px solid #121212;
  background: #ffffff;
}

.header-content {
  max-width: 820px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-shrink: 0;
}

.logo {
  font-family: var(--font-family);
  font-size: 1.4rem;
  font-weight: 800;
  color: #121212;
  text-decoration: none;
  letter-spacing: -0.5px;
  text-transform: uppercase;
}

.puzzle-id-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: #121212;
  background: #f0f0f0;
  border: 1px solid #121212;
  padding: 2px 6px;
  letter-spacing: 0.5px;
}

/* Quick Play Bar: sits in the middle on desktop */
.quick-play-bar {
  flex: 1;
  display: flex;
  justify-content: center;
}

.quick-play-form {
  display: flex;
  align-items: center;
  gap: 6px;
}

.url-prefix {
  font-size: 0.85rem;
  color: #555;
  font-weight: 700;
}

.quick-play-form input {
  padding: 6px 8px;
  border: 1px solid #121212;
  font-size: 0.85rem;
  font-family: inherit;
  width: 140px;
}

.quick-play-form input:focus {
  outline: 2px solid #121212;
}

.header-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.nav-link {
  background: none;
  border: 1px solid transparent;
  font-size: 0.82rem;
  font-weight: 700;
  color: #121212;
  cursor: pointer;
  padding: 6px 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-link:hover {
  border-color: #121212;
}

.nav-link.highlight {
  border: 1px solid #121212;
  background: #121212;
  color: #ffffff;
}

.nav-link.highlight:hover {
  background: #333333;
}

/* Bottom-Right Controls (? and settings) on desktop & mobile */
.bottom-right-controls {
  position: fixed;
  bottom: 18px;
  right: 18px;
  display: flex;
  gap: 8px;
  z-index: 500;
}

.bottom-right-controls .nav-icon-btn {
  background: #ffffff;
  border: 1.5px solid #121212;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  color: #121212;
}

.bottom-right-controls .nav-icon-btn:hover {
  background: #121212;
  color: #ffffff;
}

/* Mobile responsive layout */
@media (max-width: 650px) {
  .header-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    gap: 10px 0;
  }

  .header-left {
    order: 1;
  }

  /* Make a puzzle button anchors to the right on mobile */
  .header-right {
    order: 2;
    margin-left: auto;
  }

  /* Game ID thing sits beneath on mobile, exactly where it was */
  .quick-play-bar {
    order: 3;
    width: 100%;
    border-top: 1px solid #e0e0e0;
    padding-top: 8px;
    margin-top: 2px;
    display: flex;
    justify-content: center;
  }

  .quick-play-form {
    width: 100%;
    justify-content: center;
  }

  .quick-play-form input {
    max-width: 160px;
    flex: 1;
  }
}

/* Toast */
.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: #121212;
  color: #ffffff;
  padding: 8px 16px;
  border: 1px solid #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  z-index: 1000;
}

/* Main Layout */
.main {
  max-width: 600px;
  margin: 0 auto;
  padding: 24px 16px 48px 16px;
}

.view {
  width: 100%;
}

.game-top-info {
  text-align: center;
  margin-bottom: 18px;
}

.game-instruction {
  font-size: 0.95rem;
  color: #121212;
  font-weight: 500;
}

/* Solved Categories Stack */
.solved-categories {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.solved-cat-box {
  padding: 14px 12px;
  text-align: center;
  border: 1px solid rgba(0,0,0,0.15);
}

.solved-cat-box.yellow { background: var(--color-yellow); color: #000000; }
.solved-cat-box.green { background: var(--color-green); color: #000000; }
.solved-cat-box.blue { background: var(--color-blue); color: #000000; }
.solved-cat-box.purple { background: var(--color-purple); color: #000000; }

.solved-cat-title {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.solved-cat-words {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* 4x4 Word Tiles Grid */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 22px;
}

.tile {
  aspect-ratio: 1.3 / 1;
  background: var(--tile-bg);
  color: #121212;
  border: 1px solid #e2cfb7;
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 6px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.tile:hover:not(.selected) {
  background: var(--tile-bg-hover);
}

.tile.selected {
  background: var(--tile-bg-selected);
  color: var(--tile-text-selected);
  border-color: #000000;
}

@media (max-width: 480px) {
  .tile-grid {
    gap: 6px;
  }
  .tile {
    font-size: 0.76rem;
    aspect-ratio: 1.2 / 1;
    padding: 3px;
  }
}

/* Shake Animation */
.shake {
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Mistakes Row (Square boxes) */
.mistakes-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 22px;
}

.mistakes-text {
  font-size: 0.85rem;
  color: #444;
  font-weight: 600;
}

.mistakes-dots {
  display: flex;
  gap: 8px;
}

.dot {
  width: 12px;
  height: 12px;
  border: 1px solid #121212;
  display: inline-block;
}

.dot.remaining {
  background: #121212;
}

.dot.spent {
  background: #ffffff;
}

/* Square Action Buttons */
.action-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}

.btn-action {
  background: #ffffff;
  border: 1px solid #121212;
  color: #121212;
  padding: 8px 18px;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-action:hover:not(:disabled) {
  background: #f0f0f0;
}

.btn-action:disabled {
  border-color: #d8d8d8;
  color: #a8a8a8;
  cursor: not-allowed;
  background: #fafafa;
}

.btn-submit {
  background: #121212;
  color: #ffffff;
}

.btn-submit:hover:not(:disabled) {
  background: #333333;
}

.board-footer {
  text-align: center;
  margin-top: 12px;
}

.link-btn {
  background: none;
  border: none;
  color: #555;
  text-decoration: underline;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.link-btn:hover {
  color: #000;
}

.btn-sm {
  background: #121212;
  color: #ffffff;
  border: 1px solid #121212;
  padding: 6px 12px;
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.btn-sm:hover {
  background: #333;
}

.btn-text {
  background: none;
  border: none;
  color: #666;
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

/* ================= CREATOR ================= */
.create-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
  border-bottom: 2px solid #121212;
  padding-bottom: 8px;
}

.create-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.3px;
}

.form-error {
  background: #fff0f0;
  color: #b00;
  border: 1px solid #fcc;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.field-row {
  margin-bottom: 16px;
}

.field-row label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.field-row input[type="text"],
.field-row input[type="url"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #121212;
  font-size: 0.9rem;
  font-family: var(--font-family);
}

.field-row small {
  display: block;
  color: #666;
  font-size: 0.75rem;
  margin-top: 4px;
}

.slug-row {
  display: flex;
  align-items: center;
  background: #f9f9f9;
  border: 1px solid #121212;
  padding: 0 8px;
}

.slug-row input {
  border: none !important;
  background: transparent !important;
  padding: 8px 4px !important;
  outline: none;
  font-size: 0.9rem;
  font-family: var(--font-family);
  font-weight: 600;
  width: 100%;
}

.category-forms {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 18px 0;
}

.category-block {
  border: 1px solid #121212;
  border-left-width: 6px;
  padding: 12px;
  background: #ffffff;
}

.category-block.yellow { border-left-color: var(--color-yellow); }
.category-block.green { border-left-color: var(--color-green); }
.category-block.blue { border-left-color: var(--color-blue); }
.category-block.purple { border-left-color: var(--color-purple); }

.cat-label {
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 6px;
  display: inline-block;
}

.cat-label.yellow { background: var(--color-yellow); color: #000; }
.cat-label.green { background: var(--color-green); color: #000; }
.cat-label.blue { background: var(--color-blue); color: #000; }
.cat-label.purple { background: var(--color-purple); color: #000; }

.category-block input[type="text"] {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  font-size: 0.85rem;
  font-family: var(--font-family);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.category-block input[type="text"]:focus {
  border-color: #121212;
  outline: none;
}

.words-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.duplicate-input {
  border-color: #c00 !important;
  background: #fff6f6;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* Published Success */
.publish-success {
  background: #ffffff;
  border: 2px solid #121212;
  padding: 24px;
  text-align: center;
}

.publish-success h3 {
  font-size: 1.25rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.share-box {
  display: flex;
  max-width: 420px;
  margin: 14px auto 18px auto;
  border: 1px solid #121212;
  background: #ffffff;
}

.share-box input {
  flex: 1;
  border: none;
  padding: 8px 10px;
  font-size: 0.85rem;
  font-family: var(--font-family);
  font-weight: 600;
}

.published-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* ================= MODALS ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 500;
}

.modal {
  background: #ffffff;
  border: 2px solid #121212;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #121212;
  background: #fafafa;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  font-weight: 700;
  color: #121212;
  cursor: pointer;
}

.modal-body {
  padding: 18px;
}

/* Results */
.results-sub {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  text-align: center;
  margin-bottom: 12px;
}

.emoji-grid {
  font-size: 1.35rem;
  text-align: center;
  letter-spacing: 4px;
  line-height: 1.35;
  margin-bottom: 18px;
  font-family: var(--font-family);
}

.score-card {
  background: #fafafa;
  border: 1px solid #121212;
  padding: 12px;
  margin-bottom: 16px;
}

.score-saved-msg {
  color: #1a7f37;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
}

.score-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.inline-input-row {
  display: flex;
  gap: 6px;
}

.inline-input-row input {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #121212;
  font-size: 0.85rem;
  font-family: var(--font-family);
}

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.full-width {
  width: 100%;
}

.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }

/* Leaderboard */
.empty-text {
  text-align: center;
  color: #666;
  font-size: 0.85rem;
  padding: 24px 0;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
}

.leaderboard-item {
  border-bottom: 1px solid #ddd;
  padding-bottom: 8px;
}

.leaderboard-item-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.85rem;
}

.lb-player {
  font-weight: 800;
}

.lb-status {
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
}

.lb-emojis {
  font-size: 0.85rem;
  letter-spacing: 2px;
  margin-top: 4px;
  font-family: var(--font-family);
}

/* Help modal legend */
.help-legend {
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legend-item {
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid rgba(0,0,0,0.1);
}

.legend-item.yellow { background: var(--color-yellow); color: #000000; }
.legend-item.green { background: var(--color-green); color: #000000; }
.legend-item.blue { background: var(--color-blue); color: #000000; }
.legend-item.purple { background: var(--color-purple); color: #000000; }

.test-result {
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}
.test-result.success { color: #1a7f37; }
.test-result.error { color: #c00; }

/* Settings modal instructions */
.modal.settings-modal {
  max-width: 520px;
}

.settings-intro {
  font-size: 0.85rem;
  color: #444;
  line-height: 1.4;
}

.instructions-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 2px solid #121212;
}

.instructions-section h4 {
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.step-item {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 0.82rem;
  line-height: 1.4;
}

.step-num {
  width: 20px;
  height: 20px;
  background: #121212;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-item strong {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.step-item p {
  color: #222;
  margin-bottom: 4px;
}

.step-item ul {
  margin-left: 18px;
  margin-top: 4px;
  margin-bottom: 4px;
  color: #333;
}

.step-item code {
  background: #f1f1f1;
  padding: 1px 4px;
  border: 1px solid #ddd;
  font-size: 0.9em;
}

.mt-5 {
  margin-top: 5px;
}

.mt-10 {
  margin-top: 10px;
}

.footer-sep {
  color: var(--text-muted);
  user-select: none;
}

.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 12px auto;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  max-width: 200px;
}

.qr-code {
  display: flex;
  justify-content: center;
  align-items: center;
}

.qr-code img,
.qr-code canvas {
  display: block;
  border-radius: 0 !important;
  image-rendering: pixelated;
}

.qr-hint {
  margin-top: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-align: center;
}

.qr-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 20px;
}

.qr-modal-body .share-box {
  width: 100%;
}


