@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;500;600;700&display=swap');

:root {
  --bg-0: #0a0d0a;
  --bg-1: #11150f;
  --bg-2: #171c14;
  --line: #2b331f;
  --accent: #ff7a1a;
  --accent-2: #9dff5e;
  --danger: #ff4d4d;
  --text: #e9efe0;
  --text-dim: #93a082;
  --shadow: 0 0 24px rgba(157, 255, 94, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, #131810 0%, var(--bg-0) 55%),
              repeating-linear-gradient(135deg, rgba(157,255,94,0.02) 0 2px, transparent 2px 40px);
  color: var(--text);
  font-family: 'Chakra Petch', 'Noto Sans Thai', sans-serif;
  overflow-x: hidden;
}

.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ---------- Scanline / HUD frame ---------- */
.hud-frame {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  border: 2px solid rgba(157, 255, 94, 0.25);
  box-shadow: inset 0 0 60px rgba(0,0,0,0.7);
}
.hud-frame::before, .hud-frame::after {
  content: "";
  position: absolute;
  width: 26px; height: 26px;
  border: 2px solid var(--accent-2);
  opacity: 0.7;
}
.hud-frame::before { top: 10px; left: 10px; border-right: none; border-bottom: none; }
.hud-frame::after { bottom: 10px; right: 10px; border-left: none; border-top: none; }

/* ---------- Lobby ---------- */
#lobby {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 22px;
  padding: 24px;
}
.tag {
  letter-spacing: 4px;
  font-size: 13px;
  color: var(--accent-2);
  text-transform: uppercase;
  opacity: 0.85;
}
.title-main {
  font-size: clamp(28px, 6vw, 56px);
  font-weight: 700;
  margin: 0;
  letter-spacing: 2px;
  text-shadow: 0 0 18px rgba(255,122,26,0.45);
}
.title-main span { color: var(--accent); }
.subtitle {
  color: var(--text-dim);
  font-size: 15px;
  max-width: 480px;
}
.deploy-btn {
  margin-top: 12px;
  padding: 18px 54px;
  font-family: inherit;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #0a0d0a;
  background: linear-gradient(180deg, var(--accent-2), #6fd93c);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
  box-shadow: 0 0 30px rgba(157,255,94,0.35);
  transition: transform .15s ease, box-shadow .15s ease;
}
.deploy-btn:hover { transform: translateY(-2px); box-shadow: 0 0 40px rgba(157,255,94,0.55); }
.deploy-btn:active { transform: translateY(1px); }
.counter-line {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-dim);
}
.counter-line b { color: var(--accent); }

/* ---------- Game screen ---------- */
#game {
  padding: 14px clamp(10px, 3vw, 28px) 40px;
  gap: 18px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  flex-wrap: wrap;
}
.topbar h1 {
  font-size: clamp(18px, 3vw, 26px);
  margin: 0;
  letter-spacing: 1px;
}
.topbar h1 span { color: var(--accent); }
.mute-btn {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}
.mute-btn.active { color: var(--accent-2); border-color: var(--accent-2); }

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 380px) 1fr;
  gap: 20px;
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
}

/* ---------- Submit panel ---------- */
.panel {
  background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.panel h2 {
  font-size: 15px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-2);
  margin: 0 0 14px;
}
label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin: 12px 0 6px;
  letter-spacing: 1px;
}
input[type="text"], textarea {
  width: 100%;
  background: #0d100c;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}
input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-2);
}
.char-count { text-align: right; font-size: 11px; color: var(--text-dim); margin-top: 4px; }

.clip-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.btn {
  flex: 1;
  min-width: 130px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.5px;
}
.btn:hover { border-color: var(--accent-2); color: var(--accent-2); }
.btn.recording { border-color: var(--danger); color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

video.preview {
  width: 100%;
  margin-top: 10px;
  border-radius: 4px;
  border: 1px solid var(--line);
  max-height: 220px;
  background: #000;
}
.clip-remove { font-size: 12px; color: var(--danger); background: none; border: none; cursor: pointer; margin-top: 6px; text-decoration: underline; }

.submit-btn {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 2px;
  color: #0a0d0a;
  background: linear-gradient(180deg, var(--accent), #d9600f);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.status-msg { font-size: 12px; margin-top: 10px; min-height: 16px; }
.status-msg.ok { color: var(--accent-2); }
.status-msg.err { color: var(--danger); }
.progress-wrap { width: 100%; height: 6px; background: var(--bg-2); border-radius: 3px; overflow: hidden; margin-top: 10px; display: none; }
.progress-bar { height: 100%; width: 0%; background: var(--accent-2); transition: width .2s ease; }

/* ---------- Kill feed ---------- */
.feed-panel {
  background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px;
  min-height: 400px;
  box-shadow: var(--shadow);
}
.feed-panel h2 { font-size: 15px; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); margin: 0 0 14px; }
.feed-list { display: flex; flex-direction: column; gap: 10px; }
.feed-empty { color: var(--text-dim); font-size: 13px; padding: 20px 0; text-align: center; }

.feed-item {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-2);
  background: rgba(157,255,94,0.03);
  padding: 10px 12px;
  border-radius: 4px;
  animation: slideIn .35s ease;
}
@keyframes slideIn {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.feed-item .row1 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--accent-2);
  font-weight: 600;
}
.feed-item .row1 time { color: var(--text-dim); font-weight: 400; font-size: 11px; white-space: nowrap; }
.feed-item .msg { font-size: 14px; margin-top: 6px; line-height: 1.5; word-break: break-word; }
.feed-item video { width: 100%; margin-top: 8px; border-radius: 4px; max-height: 260px; background: #000; }

.footer-note {
  text-align: center;
  color: var(--text-dim);
  font-size: 11px;
  padding-top: 10px;
}
