html, body { height: 100%; overflow: hidden; }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 20px; }

.logo-sm {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--accent);
  text-shadow: 0 2px 0 #8a5f1e;
  text-align: center;
}
.logo-sub { color: var(--dim); font-size: 13px; text-align: center; margin: 6px 0 22px; letter-spacing: 1px; }

.code-row { display: flex; gap: 10px; justify-content: center; }
.code-row input {
  flex: 1;
  max-width: 220px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
  font-size: 22px;
  letter-spacing: 6px;
  text-align: center;
  text-transform: uppercase;
  padding: 10px;
  outline: none;
}
.code-row input:focus { border-color: var(--accent); }
.err-msg { color: var(--danger); font-size: 13px; text-align: center; margin-top: 10px; min-height: 18px; }

/* customize */
.custom-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.sec-title { font-size: 13px; color: var(--dim); letter-spacing: 1px; margin-bottom: 8px; display: block; }
.preview-wrap { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.preview-wrap canvas {
  width: 84px; height: 84px;
  image-rendering: pixelated;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.preview-wrap input {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  padding: 10px;
  width: 180px;
  outline: none;
}
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.swatch {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 3px solid transparent;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.25);
}
.swatch.sel { border-color: var(--ink); transform: scale(1.08); }
.swatch.taken { cursor: default; }

.controller { padding: 0; }
.ctrl-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  gap: 8px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
}
.chip-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 4px 12px 4px 6px; }
.chip-btn canvas { width: 24px; height: 24px; image-rendering: pixelated; }
#status-line { flex: 1; text-align: center; font-size: 12px; color: var(--dim); }

.player-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
}
.hud-stat { font-size: 13px; color: var(--dim); }
.hud-stat b { color: var(--ink); }
.hand-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px 8px;
}
.hand-item img { width: 30px; height: 30px; image-rendering: pixelated; }
.hand-item .hand-state { font-size: 11px; color: var(--dim); }

.joy-zone {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  width: min(52vw, 220px);
  height: min(52vw, 220px);
  z-index: 5;
  touch-action: none;
}
.joy-base {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(30, 15, 15, 0.55);
  border: 2px solid var(--line);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.joy-knob {
  position: absolute;
  width: 44%;
  height: 44%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd93d, #e8b53c);
  border: 3px solid #8a5f1e;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 0 rgba(0,0,0,0.3);
}

.act-btn {
  position: absolute;
  right: 14px;
  bottom: 40px;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff5a5f, #c93a3a);
  border: 4px solid #8f2a2a;
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 1px;
  box-shadow: 0 6px 0 #6f1f1f, 0 0 30px rgba(255, 90, 95, 0.35);
  z-index: 6;
  touch-action: none;
}
.act-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #6f1f1f; }
.act-btn .act-sub { display: block; font-size: 9px; font-weight: 400; color: rgba(255,255,255,0.75); }

.fx-overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 8; }
.toast-msg {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(20, 10, 10, 0.85);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  animation: toast-in 2.2s ease forwards;
}
@keyframes toast-in {
  0% { opacity: 0; transform: translate(-50%, -30%); }
  12% { opacity: 1; transform: translate(-50%, -50%); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%); }
}
.banner {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 30px;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 3px 0 #8a5f1e;
  white-space: nowrap;
  animation: banner-in 2.6s ease forwards;
}
@keyframes banner-in {
  0% { opacity: 0; transform: translateX(-50%) scale(0.5); }
  15% { opacity: 1; transform: translateX(-50%) scale(1.15); }
  25% { transform: translateX(-50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) scale(0.9); }
}
