/* LOOT Chain It. Reusable component styles. */

.ci-stage {
  position: relative;
  width: 100%;
  min-height: 380px;
  padding: 18px 18px 22px;
  border: 2px solid #111111;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 4px 0 #111111;
  overflow: hidden;
  box-sizing: border-box;
}

.ci-stage * { box-sizing: border-box; }

/* ---------------- hud ---------------- */

.ci-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.ci-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 2px solid #111111;
  border-radius: 999px;
  background: #ffffff;
  font: 700 13px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.04em;
  color: #111111;
  box-shadow: 0 3px 0 #111111;
  transition: transform 0.15s;
}

.ci-pill.ci-pop { transform: scale(1.12); }

.ci-coin {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd76a, #c9930a 65%, #8a5f08);
  border: 1.5px solid #8a5f08;
  flex: none;
}

.ci-timer {
  margin-top: 14px;
  height: 12px;
  border: 2px solid #111111;
  border-radius: 999px;
  overflow: hidden;
  background: #ffffff;
}

.ci-timer-fill {
  height: 100%;
  width: 100%;
  transform-origin: left;
  background: #16a04c;
  transition: background 0.2s;
}

.ci-timer-fill.ci-amber { background: #e0651c; }
.ci-timer-fill.ci-red { background: #d21f33; }

/* ---------------- chain stack ---------------- */

.ci-rows {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  min-height: 200px;
}

.ci-row {
  display: flex;
  gap: 5px;
}

.ci-tile {
  width: 34px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #111111;
  border-radius: 8px;
  background: #ffffff;
  font: 700 16px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  text-transform: uppercase;
  color: #111111;
  box-shadow: 0 2px 0 #111111;
}

.ci-row.ci-done .ci-tile {
  background: #111111;
  color: #ffffff;
}

.ci-row.ci-cur .ci-tile {
  border-color: #e0651c;
  box-shadow: 0 2px 0 #a34410;
  animation: ciPop 0.25s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.ci-row.ci-cur .ci-tile.ci-hint {
  background: #ffd76a;
  border-color: #111111;
  box-shadow: 0 2px 0 #111111;
}

.ci-row:not(.ci-done):not(.ci-cur) .ci-tile { opacity: 0.4; }

@keyframes ciPop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ---------------- prompt + input ---------------- */

.ci-msg {
  margin-top: 16px;
  min-height: 18px;
  text-align: center;
  font: 700 12px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.18em;
  color: #d21f33;
}

.ci-need {
  margin-top: 4px;
  text-align: center;
  font: 600 12px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.22em;
  color: #111111;
}

.ci-need-letter {
  display: inline-block;
  min-width: 26px;
  margin-left: 4px;
  padding: 3px 8px;
  border: 2px solid #111111;
  border-radius: 8px;
  background: #ffd76a;
  color: #111111;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow: 0 2px 0 #111111;
}

.ci-msg.ci-wait { color: #1f3a8f; }

.ci-over-title.ci-won { color: #16a04c; }

.ci-form {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}

/* the input is invisible: typing lands in the current row's tiles.
   16px font keeps iOS from zooming on focus */
.ci-input {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  font-size: 16px;
  outline: none;
}

.ci-row.ci-shake { animation: ciShake 0.3s; }

@keyframes ciShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

.ci-row.ci-cur .ci-tile.ci-next {
  animation: ciBlink 1s step-end infinite;
}

@keyframes ciBlink {
  0%, 100% { background: #ffffff; }
  50% { background: #ffe9a8; }
}

.ci-go,
.ci-btn {
  appearance: none;
  cursor: pointer;
  border: 2px solid #111111;
  border-radius: 12px;
  padding: 13px 22px;
  background: #ffffff;
  color: #111111;
  font: 700 15px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 3px 0 #111111;
  transition: transform 0.1s;
}

.ci-go {
  background: #e0651c;
  border-color: #e0651c;
  color: #ffffff;
  box-shadow: 0 3px 0 #a34410;
}

.ci-btn.ci-primary {
  background: #d21f33;
  border-color: #d21f33;
  color: #ffffff;
  box-shadow: 0 3px 0 #9c0f1c;
}

.ci-go:hover, .ci-btn:hover { transform: translateY(-1px); }
.ci-go:active, .ci-btn:active { transform: translateY(1px); }

/* ---------------- overlays ---------------- */

.ci-over,
.ci-intro {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #ffffff;
  border-radius: 16px;
  z-index: 20;
  text-align: center;
  padding: 20px;
}

.ci-over { opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.ci-over.ci-show { opacity: 1; pointer-events: auto; }
.ci-intro.ci-hide { display: none; }

.ci-over-title,
.ci-logo {
  font: 700 26px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.14em;
  color: #111111;
}

.ci-over-title { color: #d21f33; }

.ci-logo {
  padding: 10px 18px;
  border: 2px solid #111111;
  border-radius: 14px;
  background: #ffd76a;
  box-shadow: 0 4px 0 #111111;
}

.ci-how {
  font: 600 12px/1.9 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.16em;
  color: #111111;
}

.ci-over-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font: 600 13px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.14em;
  color: #111111;
}

.ci-over-stats b { color: #e0651c; }

/* ---------------- float ---------------- */

.ci-float {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translate(-50%, 8px);
  font: 700 17px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: #c9930a;
  letter-spacing: 0.06em;
  white-space: nowrap;
  animation: ciFloat 0.95s ease-out forwards;
  pointer-events: none;
  z-index: 40;
}

@keyframes ciFloat {
  0%   { opacity: 0; transform: translate(-50%, 10px); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -58px); }
}

@media (max-width: 600px) {
  .ci-stage { min-height: 340px; padding: 14px 12px 18px; }
  .ci-go { padding: 13px 16px; }
  .ci-input { font-size: 16px; }
  .ci-tile { width: 28px; height: 32px; font-size: 14px; border-radius: 7px; }
  .ci-row { gap: 4px; }
}
