:root {
  /* Two primary colors */
  --teal: #2e5e5a;
  --cream: #f6f1e7;

  /* Tints derived from the two primaries */
  --teal-dark: #1f3f3c;
  --teal-soft: #e3ece9;
  --cream-card: #fffdf8;
  --line: #ddd5c5;
  --muted: #6f7f7c;

  --radius: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 3rem 1.25rem 4rem;
  background: var(--cream);
  color: var(--teal-dark);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

/* Layout */
.app {
     max-width: 640px;
       margin: 0 auto;
        display: flex;
         flex-direction: column;
          gap: 1.5rem;
}

.app-header {
     text-align: center;
       margin-bottom: 0.5rem;
       }

h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
    letter-spacing: -0.02em;
  color: var(--teal);
  }

  .subtitle {
    margin: 0.4rem 0 0;
    color: var(--muted);
    }

    .card {
        background: var(--cream-card);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        padding: 1.75rem;
    }

h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--teal);
}

.hint {
    margin: 0.25rem 0 1.25rem;
    font-size: 0.9rem;
    color: var(--muted);
}

/* Input*/

input[type="text"] {
      font: inherit;
      color: var(--teal-dark);
      background: var(--cream);
      border: 1.5px solid var(--line);
      border-radius: var(--radius-sm);
      outline: none;
       transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input[type="text"]:focus {
  border-color: var(--teal);
  background: #fff;
  box-shadow: 0 0 0 4px var(--teal-soft);
}

input[type="text"]::placeholder {
  color: #b3b9b4;
}

/* Green letters */

#green-inputs {
  display: flex;
  gap: 0.75rem;
}

.green-input {
  width: 3.5rem;
  height: 3.5rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0;
}

.green-input:not(:placeholder-shown),
.green-input:valid:not(:placeholder-shown) {
  border-color: var(--teal);
}

#gray-input {
  width: 100%;
  height: 3.25rem;
  padding: 0 1rem;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#gray-input::placeholder {
  text-transform: none;
  letter-spacing: normal;
}

/* Yellow */

#yellow-entries {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#yellow-entries:not(:empty) {
  margin-bottom: 1.25rem;
}

.yellow-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.yellow-letter-input {
  width: 3.25rem;
  height: 3.25rem;
  flex-shrink: 0;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0;
  background: #fff;
}

.yellow-position-checkboxes {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  flex-wrap: wrap;
}

.cannot-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-right: 0.25rem;
}

/* Position chips */

.pos-chip {
  position: relative;
  cursor: pointer;
}

.pos-chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.pos-chip span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--teal);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.pos-chip:hover span {
  border-color: var(--teal);
}

.pos-chip input:checked + span {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--cream);
}

.pos-chip input:focus-visible + span {
  box-shadow: 0 0 0 4px var(--teal-soft);
}

/* Positions locked by a green letter: crossed out */
.pos-chip input:disabled {
  cursor: not-allowed;
}

.pos-chip input:disabled + span {
  background: transparent;
  border-style: dashed;
  border-color: var(--line);
  color: #a9b1ad;
  text-decoration: line-through;
}

.pos-chip:hover input:disabled + span {
  border-color: var(--line);
}

/* Buttons */

#add-yellow-btn {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--teal);
  background: transparent;
  border: 1.5px solid var(--teal);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1.25rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

#add-yellow-btn:hover {
  background: var(--teal);
  color: var(--cream);
}

.remove-yellow-btn {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.remove-yellow-btn:hover {
  background: var(--teal-soft);
  color: var(--teal);
}

/* Results */

#results-count {
  margin-bottom: 1.25rem;
  font-size: 1.15rem;
}

#results-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.result-word {
  padding: 0.45rem 0.9rem;
  background: var(--teal-soft);
  color: var(--teal-dark);
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Help icon (top right) */

.help {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 10;
}

.help-icon {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--teal);
  background: var(--cream-card);
  border: 1.5px solid var(--teal);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.help:hover .help-icon,
.help:focus-within .help-icon,
.help.open .help-icon {
  background: var(--teal);
  color: var(--cream);
}

.help-panel {
  position: absolute;
  top: calc(100% + 0.75rem);
  right: 0;
  width: 19rem;
  max-width: calc(100vw - 2.5rem);
  padding: 1.25rem 1.4rem;
  background: var(--cream-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(31, 63, 60, 0.12);
  transform-origin: top right;
  transform: scale(0.85);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.2s ease, opacity 0.2s ease, visibility 0.2s;
}

.help:hover .help-panel,
.help:focus-within .help-panel,
.help.open .help-panel {
  transform: scale(1);
  opacity: 1;
  visibility: visible;
}

.help-panel h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--teal);
}

.help-item {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
}

.help-item + .help-item {
  margin-top: 0.9rem;
}

.help-item p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--teal-dark);
}

.swatch {
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 6px;
  margin-top: 0.1rem;
}

/* Small recognizable tile colors used only in the help box */
.swatch-green  { background: #7fa88a; }
.swatch-yellow { background: #d9bf73; }
.swatch-gray   { background: #a6aeab; }

/* Small screens */

@media (max-width: 520px) {
  body {
    padding-top: 4.5rem;
  }

  .card {
    padding: 1.25rem;
  }

  #green-inputs {
    gap: 0.5rem;
  }

  .green-input {
    width: 100%;
    min-width: 0;
    height: 3.25rem;
  }

  .yellow-row {
    flex-wrap: wrap;
  }
}
