:root {
  --tile: 32px;
  --gap: 3px;
  --bg: #0f1115;
  --tile-bg: #121213;
  --tile-border: #3a3a3c;
  --tile-text: #fff;
  --ok: #34d399;
  --bad: #ef4444;
  --accent: #6366f1;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: #e9e9e9;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  height: 100%;
  overflow: hidden;
}

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

.header {
  padding: 0.5rem 1rem 0.25rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo {
  height: 30px;
  max-width: 90%;
  object-fit: contain;
}

.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  width: 100%;
  padding: 0.5rem;
  gap: 0.5rem;
}

.chain {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: 100%;
  justify-content: center;
}

.row {
  display: flex;
  gap: var(--gap);
  transition: transform 0.2s ease;
  justify-content: center;
}

.tile {
  width: var(--tile);
  height: var(--tile);
  display: grid;
  place-items: center;
  border: 2px solid var(--tile-border);
  border-radius: 3px;
  background: var(--tile-bg);
  color: var(--tile-text);
  font-weight: 700;
  font-size: 16px;
  text-transform: uppercase;
  transition: all 0.3s ease;
}

.tile.filled { animation: pop 0.2s ease; border-color: var(--accent); background: #1a1b2e; }
.tile.start  { border-color: var(--ok); background: rgba(52,211,153,0.1); }
.tile.success { border-color: var(--ok); background: rgba(52,211,153,0.2); animation: pulse 0.5s ease; }
.tile.failure { border-color: var(--bad); background: rgba(239,68,68,0.2); animation: shake 0.5s ease; }

@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.05)} }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)} }
@keyframes pop   { 0%,100%{transform:scale(1)} 50%{transform:scale(1.1)} }

.play-row { position: relative; width: fit-content; display: flex; align-items: center; gap: 12px; }
.hint-section { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 90px; }
.hint-controls { display: flex; gap: 4px; align-items: center; }

.undo-btn, .reset-btn {
  font-size: 20px;
  padding: 0;
  border: none;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  opacity: 0.6;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.undo-btn:hover:not(:disabled), .reset-btn:hover:not(:disabled) { opacity:1; transform: scale(1.2); }
.undo-btn:disabled, .reset-btn:disabled { opacity:0.15; cursor:not-allowed; }

.controls { display: flex; justify-content: center; gap: 6px; }

.controls button {
  font-size: 11px;
  padding: 6px 12px;
  border-radius: 5px;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.controls button:hover { background: #7c3aed; transform: translateY(-1px); }

.status {
  font-size: 12px;
  text-align: center;
  min-height: 20px;
  font-weight: 600;
  animation: fadeIn 0.3s ease;
  padding: 0 0.5rem;
}

.bank {
  width: 100%;
  background: #11151c;
  border-top: 2px solid #222a34;
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.bank h4 {
  font-size: 11px;
  margin: 0;
  letter-spacing: 1.5px;
  color: #94a3b8;
  font-weight: 600;
}

.buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 400px;
  padding: 0 0.5rem;
}

.buttons button {
  font-size: 11px;
  padding: 10px 8px;
  border-radius: 4px;
  border: 2px solid #334155;
  background: #1e293b;
  color: #e9f1ff;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.buttons button:hover:not(:disabled) {
  background: #334155;
  border-color: var(--accent);
  transform: translateY(-2px);
}

.buttons button:disabled { opacity: 0.3; cursor: not-allowed; }

.copyright {
  width: 100%;
  text-align: center;
  font-size: 10px;
  color: #94a3b8;
  padding: 6px 0 10px;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  :root { --tile: 28px; }
  .logo { height: 28px; }
  .buttons button { font-size: 9px; }
}
