:root {
  --bg: #121213;
  --border-default: #3a3a3c;
  --border-active: #565758;
  --text: #ffffff;
  --text-dim: #818384;
  --correct: #0467b1;
  --present: #fadb04;
  --present-text: #121213;
  --absent: #3a3a3c;
  --accent: #0467b1;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header {
  width: 100%;
  max-width: 500px;
  border-bottom: 1px solid var(--border-default);
  padding: 12px 0;
}

.header-inner {
  position: relative;
  height: 36px;
  padding: 0 12px;
}

h1.title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.04em;
  font-weight: 400;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  font-family: 'Archivo Black', 'Helvetica Neue', Arial, sans-serif;
}

.help-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lang-select {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.lang-select-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0 10px;
  height: 30px;
  cursor: pointer;
}

.lang-select-btn:hover {
  border-color: var(--border-active);
}

.lang-chevron {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 140px;
  background: var(--bg);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  list-style: none;
  margin: 0;
  padding: 4px;
  z-index: 15;
}

.lang-menu.hidden {
  display: none;
}

.lang-option {
  padding: 8px 10px;
  border-radius: 3px;
  font-size: 0.85rem;
  cursor: pointer;
}

.lang-option:hover {
  background: var(--border-default);
}

.lang-option.selected {
  color: var(--accent);
  font-weight: 700;
}

.help-btn:hover {
  border-color: var(--border-active);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  padding: 24px 12px;
}

.message {
  min-height: 24px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  padding: 6px 14px;
  border-radius: 4px;
  transition: opacity 0.15s ease;
}

.message.error {
  background: #b3261e;
  color: white;
}

.message.success {
  background: var(--correct);
  color: white;
}

.message.info {
  color: var(--text-dim);
}

.board {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 6px;
}

.row {
  display: grid;
  grid-auto-flow: column;
  gap: 6px;
}

.tile {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  font-weight: 700;
  text-transform: uppercase;
  border: 2px solid var(--border-default);
  color: var(--text);
  user-select: none;
  transition: transform 0.12s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.tile.filled {
  border-color: var(--border-active);
}

.tile.pop {
  transform: scale(1.06);
}

.tile.correct {
  background: var(--correct);
  border-color: var(--correct);
}

.tile.present {
  background: var(--present);
  border-color: var(--present);
  color: var(--present-text);
}

.tile.absent {
  background: var(--absent);
  border-color: var(--absent);
}

.tile.flip {
  animation: flip 0.5s ease forwards;
}

@keyframes flip {
  0% { transform: rotateX(0deg); }
  50% { transform: rotateX(90deg); }
  100% { transform: rotateX(0deg); }
}

.tile.shake {
  animation: shake 0.25s ease;
}

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

footer {
  width: 100%;
  max-width: 500px;
  text-align: center;
  padding: 10px 12px 20px;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.footer-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.footer-buttons .new-game-btn {
  margin-top: 0;
}

.new-game-btn {
  margin-top: 10px;
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.new-game-btn:hover {
  border-color: var(--border-active);
}

.footer-legal {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.footer-copyright {
  color: var(--text-dim);
}

.footer-link {
  display: inline-block;
  margin-top: 0;
  color: var(--text-dim);
  font-size: 0.75rem;
  text-decoration: none;
}

.footer-link:hover {
  color: var(--text);
  text-decoration: underline;
}

/* --- How-to-play modal ------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10;
}

.overlay.hidden {
  display: none;
}

.help-modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 24px 20px;
}

.help-modal h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  letter-spacing: 0.03em;
}

.help-modal h3 {
  margin: 20px 0 10px;
  font-size: 0.95rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.help-modal p {
  margin: 0 0 8px;
  line-height: 1.4;
  font-size: 0.95rem;
}

.help-modal ul {
  margin: 0;
  padding-left: 18px;
}

.help-modal li {
  margin-bottom: 8px;
  line-height: 1.4;
  font-size: 0.9rem;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.close-btn:hover {
  background: var(--border-default);
}

.example {
  margin-bottom: 16px;
}

.example-row {
  display: flex;
  justify-content: flex-start;
  gap: 3px;
  margin-bottom: 6px;
}

.example p {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.tile.small {
  width: 34px;
  height: 34px;
  font-size: 1rem;
  border-width: 2px;
}

/* --- Welcome screen ------------------------------------------------- */

.welcome-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 30;
}

.welcome-screen.hidden {
  display: none;
}

.welcome-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 380px;
}

.welcome-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
  margin-bottom: 20px;
}

h1.welcome-title {
  position: static;
  left: auto;
  top: auto;
  transform: none;
  margin-bottom: 22px;
  text-align: center;
}

.welcome-tagline {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-weight: 400;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
  margin: 0 0 28px;
}

.start-btn {
  background: var(--accent);
  border: none;
  color: #ffffff;
  padding: 10px 28px;
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.start-btn:hover {
  filter: brightness(1.1);
}

/* --- PT (Puter) coming-soon placeholder ---------------------------------
   Remove this whole block, plus the matching HTML block in index.html
   (marked "PT COMING SOON") and the "PT availability" section in
   script.js, once the Puter word list is ready.
   -------------------------------------------------------------------- */

.pt-hidden {
  display: none;
}

.pt-coming-soon {
  max-width: 304px;
  padding: 16px 12px;
  text-align: center;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
}

/* --- Finish-game modal (stats) ------------------------------------------ */

.finish-modal {
  max-width: 340px;
}

#finish-title {
  margin: 0 0 16px;
  font-size: 1.15rem;
  line-height: 1.4;
}

.finish-solution-tiles {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin: 0 0 20px;
}

.finish-solution-tiles.hidden {
  display: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 4px;
}

.guess-distribution {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 24px;
}

.dist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.dist-label {
  width: 12px;
  text-align: right;
  color: var(--text-dim);
}

.dist-bar-wrap {
  flex: 1;
}

.dist-bar {
  min-width: 22px;
  background: var(--border-default);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: right;
  padding: 2px 6px;
  border-radius: 2px;
  box-sizing: border-box;
}

.dist-bar.highlight {
  background: var(--accent);
}

.finish-buttons {
  display: flex;
  gap: 10px;
}

.finish-buttons button {
  flex: 1;
  min-width: 0;
  margin-top: 0;
  padding: 10px 8px;
  font-size: 0.85rem;
  text-align: center;
  white-space: normal;
  line-height: 1.2;
}

/* --- Güdar (feedback) modal & form ---------------------------------- */

.gudar-modal {
  max-width: 340px;
}

#gudar-title {
  margin: 0 0 16px;
}

.gudar-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gudar-form.hidden {
  display: none;
}

.gudar-form label {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: -6px;
}

.gudar-form input[type="text"],
.gudar-form input[type="email"],
.gudar-form select,
.gudar-form textarea {
  background: var(--bg);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 8px 10px;
  width: 100%;
  box-sizing: border-box;
}

.gudar-form input:focus,
.gudar-form select:focus,
.gudar-form textarea:focus {
  outline: none;
  border-color: var(--border-active);
}

.gudar-form textarea {
  resize: vertical;
}

.gudar-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.gudar-submit-btn {
  margin-top: 4px;
  width: 100%;
}

.gudar-submit-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.gudar-error {
  color: #e5484d;
  font-size: 0.8rem;
  text-align: center;
  margin: 4px 0 0;
}

.gudar-error.hidden {
  display: none;
}

.gudar-success {
  text-align: center;
  font-size: 0.95rem;
  padding: 12px 0;
}

.gudar-success.hidden {
  display: none;
}

/* --- Impressum page ---------------------------------------------------- */

.back-link {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.back-link:hover {
  color: var(--text-dim);
}

.impressum-main {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 32px 16px;
}

.impressum-content {
  max-width: 480px;
  width: 100%;
}

.impressum-content section {
  margin-bottom: 24px;
}

.impressum-content h2 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin: 0 0 8px;
}

.impressum-content h2.impressum-page-title {
  font-size: 1.4rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  margin: 0 0 28px;
}

.impressum-content p {
  margin: 0;
  line-height: 1.6;
}