:root { color-scheme: light dark; }

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
  padding: 16px;
  line-height: 1.35;
}

.wrap { max-width: 720px; margin: 0 auto; }

h1 { font-size: 20px; margin: 0 0 12px 0; }

.card {
  border: 1px solid rgba(127,127,127,.35);
  border-radius: 12px;
  padding: 12px;
}

label { font-size: 13px; opacity: .9; display: block; margin-bottom: 6px; }

textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 12px;
  font-size: 16px;
  line-height: 1.35;
  border-radius: 10px;
  border: 1px solid rgba(127,127,127,.45);
  background: transparent;
  color: inherit;
  min-height: 110px;
  resize: vertical;
}

textarea.hasInvalid {
  border-color: rgba(255, 0, 0, 0.65);
  box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.15);
}

.hint { font-size: 12px; opacity: .75; margin-top: 6px; }

.validationMsg {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 800;
  color: #b00020;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

button, input[type="submit"] {
  width: 100%;
  padding: 12px 12px;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid rgba(127,127,127,.45);
  background: transparent;
  color: inherit;
}

.results { margin-bottom: 14px; }

.meta { font-size: 14px; margin: 0 0 8px 0; }

.favorites { margin-top: 14px; font-size: 13px; opacity: .85; }

/* Interface 2.0 */
.ui2Wrap { display: grid; gap: 10px; }

.wordsBox { position: relative; }

.wordsInput { position: relative; background: transparent; }

.ui2Board { display: grid; gap: 10px; }

.guessRow {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.tile {
  border: 1px solid rgba(127,127,127,.45);
  border-radius: 10px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  text-transform: lowercase;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.tile[data-state="0"] { background: #000; color: #fff; border-color: rgba(255,255,255,.15); }
.tile[data-state="1"] { background: #2e7d32; color: #fff; border-color: rgba(255,255,255,.15); }
.tile[data-state="2"] { background: #c9a227; color: #111; border-color: rgba(0,0,0,.15); }

@media (prefers-color-scheme: dark) {
  .tile[data-state="2"] { color: #111; }
}

/* Results in columns (page scroll, no inner scroll box) */
.wordColumns {
  /* Use column-width so the browser packs as many columns as fit */
  column-width: 72px;
  column-gap: 8px;
}

@media (min-width: 520px) {
  .wordColumns {
    column-width: 78px;
    column-gap: 10px;
  }
}

@media (min-width: 820px) {
  .wordColumns {
    column-width: 84px;
    column-gap: 12px;
  }
}

.wordItem {
  display: block;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  padding: 6px 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  text-decoration: none;
  color: inherit;
}

.wordItem:hover {
  background-color: rgba(127,127,127,0.15);
}

/* Debug panel */
.debugPanel {
  margin-top: 10px;
  border: 1px dashed rgba(127,127,127,.55);
  border-radius: 12px;
  padding: 10px 12px;
}

.debugPanel h2 {
  font-size: 14px;
  margin: 0 0 8px 0;
}

.debugPanel pre {
  margin: 0;
  font-size: 12px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
