:root {
  --green: #6aaa64;
  --yellow: #c9b458;
  --grey: #787c7f;
  --border: #d3d6da;
  --bg: #ffffff;
  --text: #1a1a1b;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

#app-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

#app-header h1 {
  font-size: 1.3rem;
  margin: 0;
  color: #1a73e8;
}

#app {
  width: 100%;
  max-width: 480px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.screen {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  min-height: 0;
}

#screen-game {
  flex: 1 1 auto;
  min-height: 0;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 1rem;
  background: var(--grey);
  color: white;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.link-button {
  background: none;
  color: #555;
  text-decoration: underline;
  padding: 4px;
}

#form-auth {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}

#form-auth label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
}

#form-auth input {
  padding: 10px;
  font-size: 1.1rem;
  border: 2px solid var(--border);
  border-radius: 6px;
}

.error-text {
  color: #d93025;
  margin: 0;
}

#length-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

#length-buttons button {
  background: #1a73e8;
  min-width: 48px;
  font-size: 1.2rem;
}

#guess-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

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

.tile {
  width: 48px;
  height: 48px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: bold;
  text-transform: none;
}

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

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

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

.tile.invalid {
  border-color: #d93025;
  color: #d93025;
}

#solved-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  flex-shrink: 0;
}

#solved-message {
  font-size: 1.2rem;
  font-weight: bold;
}

#solved-panel button {
  background: #1a73e8;
}

#keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  align-items: center;
  flex-shrink: 0;
}

.keyboard-row {
  display: flex;
  gap: 5px;
  justify-content: center;
  direction: ltr;
}

.key {
  min-width: 32px;
  height: 42px;
  padding: 0 8px;
  background: #d3d6da;
  color: var(--text);
  font-size: 1.1rem;
  border-radius: 4px;
}

.action-key {
  min-width: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.key.green {
  background: var(--green);
  color: white;
}

.key.yellow {
  background: var(--yellow);
  color: white;
}

.key.grey {
  background: var(--grey);
  color: white;
}
