* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.container {
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 30px;
  max-width: 1260px;
  width: 100%;
  text-align: center;
}

h1 {
  color: #333;
  margin: 0 0 18px;
  font-size: 2em;
}

.kontrole {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin-bottom: 18px;
}

.grupa {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.kontrole label {
  font-weight: 600;
  color: #444;
}

select {
  padding: 8px 12px;
  border: 2px solid #667eea;
  border-radius: 8px;
  font-size: 1em;
  background: white;
  cursor: pointer;
}

.gumb {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  background: #667eea;
  color: white;
  transition: transform 0.1s, opacity 0.2s;
}

.gumb:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.gumb#provjeri { background: #f0a500; }
.gumb#otkrij-slovo, .gumb#otkrij-sve { background: #888; }

/* ---------------- mreza ---------------- */

.mreza {
  display: inline-grid;
  gap: 1px;
  background: #333;
  border: 2px solid #333;
  margin: 0 auto;
  max-width: 100%;
  user-select: none;
}

.celija {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  text-transform: uppercase;
}

.celija.slovo {
  background: #fff;
  cursor: pointer;
  color: #222;
  font-size: calc(var(--celija, 34px) * 0.55);
}

.celija.slovo input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  text-align: center;
  font: inherit;
  color: inherit;
  text-transform: uppercase;
  padding: 0;
  outline: none;
  caret-color: transparent;
}

.celija.slovo.aktivna { background: #ffe9a8; }
.celija.slovo.rijec { background: #cfe5ff; }
.celija.slovo.aktivna { background: #ffd54d; }
.celija.slovo.kriva { background: #f8b4b4; }
.celija.slovo.ok { background: #b7e4b7; }

.celija.uputa {
  background: #444;
  color: #eee;
  font-size: calc(var(--celija, 34px) * 0.21);
  line-height: 1.05;
  overflow: hidden;
  padding: 1px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-weight: 400;
}

.celija.uputa .tekst {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.celija.uputa .strel {
  position: absolute;
  right: 1px;
  bottom: -1px;
  font-size: calc(var(--celija, 34px) * 0.28);
  line-height: 1;
  color: #ffb84d;
  font-weight: 700;
}

.celija.uputa .strel.gore {
  right: auto;
  left: 1px;
  bottom: -1px;
}

.celija.uputa.dvojna {
  flex-direction: column;
  padding: 0;
}

.celija.uputa .polovica {
  position: relative;
  display: flex;
  flex: 1 1 50%;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  width: 100%;
  align-items: center;
  justify-content: center;
}

.celija.uputa .polovica:first-child {
  border-bottom: 1px solid #666;
}

.celija.uputa.mrtva {
  background: #1a1a1a;
}

.celija.uputa .facijica {
  position: absolute;
  inset: 14%;
  color: #6e6e6e;
  pointer-events: none;
}

.celija.uputa .facijica svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.opis-traka {
  min-height: 2.2em;
  margin: 8px auto 10px;
  padding: 6px 10px;
  max-width: 640px;
  background: #fff8e1;
  border: 1px solid #e0c97a;
  border-radius: 6px;
  font-size: 0.95em;
  line-height: 1.35;
  text-align: left;
  color: #333;
}

.opis-traka .opis-stavka {
  display: inline-block;
  margin-right: 1.2em;
}

.opis-traka .opis-stavka b {
  color: #f5821f;
}

.status {
  margin-top: 14px;
  min-height: 1.4em;
  font-weight: 600;
  color: #2e7d32;
}

.napredak {
  display: none;
  margin-top: 6px;
  height: 6px;
  border-radius: 3px;
  background: #e0e0e0;
  overflow: hidden;
}

.napredak.radi { display: block; }

.napredak .traka {
  height: 100%;
  width: 30%;
  border-radius: 3px;
  background: #667eea;
  animation: klizi 1.2s ease-in-out infinite;
}

@keyframes klizi {
  0%   { margin-left: -30%; }
  100% { margin-left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .napredak .traka { animation: none; width: 100%; }
}

.napomena {
  color: #777;
  font-size: 0.85em;
  margin: 10px 0 0;
}

@media (max-width: 600px) {
  .container { padding: 12px; }
  h1 { font-size: 1.4em; }
}

/* ekranska tipkovnica */
.kbd {
  margin: 14px auto 4px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-width: 640px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.kbd-red {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.kbd-tipka {
  flex: 1 1 0;
  min-width: 0;
  padding: 9px 0;
  border: none;
  border-radius: 6px;
  background: #d3d9e8;
  color: #222;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
}

.kbd-tipka.duga { flex: 1.6 1 0; background: #b9c2d8; font-size: 0.82em; }

.kbd-tipka:active { background: #667eea; color: #fff; }

@media (max-width: 520px) {
  .kbd-tipka { padding: 8px 0; font-size: 0.85em; }
}
