/* ==============================================================================
   Künstlich Komisch - Mobile Multiplayer Player UI Stylesheet
   Optimized for smartphones, touchscreens, and desktop browsers
   ============================================================================== */

:root {
  --bg-dark: #0a0d14;
  --bg-card: rgba(18, 25, 38, 0.95);
  --bg-card-subtle: rgba(26, 36, 54, 0.7);
  --border-color: rgba(255, 255, 255, 0.12);
  --accent-cyan: #00e5ff;
  --accent-magenta: #ff3366;
  --accent-amber: #ffb300;
  --accent-green: #00e676;
  --text-main: #ffffff;
  --text-muted: #8c9ba5;

  --font-display: 'Chakra Petch', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 12px);
  overflow-x: hidden;
}

/* Header */
.mobile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: rgba(10, 13, 20, 0.98);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  color: var(--accent-magenta);
  font-size: 14px;
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.logo-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #fff;
}

.connection-status {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.connection-status.connected {
  background: rgba(0, 230, 118, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(0, 230, 118, 0.4);
}

/* Turn Alert Banner */
.turn-alert-banner {
  background: linear-gradient(90deg, #00b0ff, #00e676);
  color: #000;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-align: center;
  padding: 10px 14px;
  animation: banner-glow 1s infinite alternate;
  box-shadow: 0 4px 15px rgba(0, 230, 118, 0.4);
}

@keyframes banner-glow {
  0% { filter: brightness(1); }
  100% { filter: brightness(1.2); }
}

/* Main Container */
.mobile-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* Cards */
.card-view {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.hero-badge {
  display: inline-block;
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(0, 229, 255, 0.15);
  color: var(--accent-cyan);
  border: 1px solid var(--accent-cyan);
  margin-bottom: 12px;
}

.badge-amber {
  background: rgba(255, 179, 0, 0.15);
  color: var(--accent-amber);
  border-color: var(--accent-amber);
}

.view-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1.15;
  margin-bottom: 10px;
  color: #fff;
}

.view-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 20px;
}

.view-desc strong {
  color: #fff;
}

/* Forms & Inputs */
.join-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

.input-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.5px;
}

.text-input {
  background: #0f1522;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 16px;
  color: #fff;
  font-family: var(--font-mono);
  outline: none;
  transition: border-color 0.2s;
  user-select: text;
}

.text-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.25);
}

/* Buttons */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #00b0ff, #00e5ff);
  color: #06090f;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 16px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 229, 255, 0.4);
  transition: transform 0.1s, filter 0.2s;
}

.btn-primary:active {
  transform: scale(0.98);
  filter: brightness(0.9);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  text-align: center;
  margin-top: 15px;
}

.btn-tiny {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
}

.btn-tiny.btn-danger {
  color: var(--accent-magenta);
  border-color: rgba(255, 51, 102, 0.4);
}

/* Info Box */
.info-box {
  background: var(--bg-card-subtle);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.info-icon {
  font-size: 16px;
}

/* Waiting Room */
.queue-status-box {
  display: flex;
  align-items: center;
  gap: 18px;
  background: rgba(255, 179, 0, 0.08);
  border: 1px solid var(--accent-amber);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.queue-number-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffb300;
  color: #000;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 900;
}

.queue-label {
  font-size: 9px;
  letter-spacing: 0.5px;
}

.queue-number {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1;
}

.queue-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.queue-meta-row {
  font-family: var(--font-mono);
  font-size: 12px;
}

.qm-label {
  color: var(--text-muted);
}

.qm-val {
  font-weight: 800;
  color: #fff;
  margin-left: 6px;
}

/* Pulse Radar */
.pulse-radar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 10px;
  margin-bottom: 20px;
}

.radar-circle {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--accent-amber);
  animation: radar-wave 2s infinite ease-out;
}

.circle-1 {
  width: 90px;
  height: 90px;
  animation-delay: 0s;
}

.circle-2 {
  width: 140px;
  height: 140px;
  animation-delay: 0.8s;
}

@keyframes radar-wave {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(1.3); opacity: 0; }
}

.radar-text {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  z-index: 2;
  position: relative;
}

/* Stream Preview Card */
.stream-preview-card {
  background: #0d121c;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
}

.spc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.spc-dot {
  color: var(--accent-cyan);
  animation: pulse-dot 1s infinite;
}

.spc-dialogue {
  font-size: 13px;
  font-style: italic;
  color: #e0e6ed;
  line-height: 1.4;
}

/* Game View */
.game-view {
  padding: 12px;
}

.match-hud-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.player-pill {
  flex: 1;
  background: rgba(14, 20, 31, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pill-role {
  font-size: 10px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.clock-display {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}

.player-pill.active-turn {
  border-color: var(--accent-green);
  box-shadow: 0 0 12px rgba(0, 230, 118, 0.3);
}

.player-pill.active-turn .clock-display {
  color: var(--accent-green);
}

.versus-divider {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  color: var(--text-muted);
}

.session-timer-bar {
  display: flex;
  justify-content: space-between;
  background: rgba(255, 179, 0, 0.08);
  border: 1px solid rgba(255, 179, 0, 0.3);
  border-radius: 6px;
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  margin-bottom: 10px;
}

.st-label {
  color: var(--accent-amber);
  font-weight: 700;
}

.st-val {
  color: #fff;
  font-weight: 800;
}

/* Chessboard Container */
.mobile-board-container {
  width: 100%;
  aspect-ratio: 1;
  background: #090c13;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  margin-bottom: 10px;
}

.mobile-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
}

.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
}

.square.light {
  background-color: #ccd4dc;
}

.square.dark {
  background-color: #4a5c6d;
}

.square.selected {
  background-color: rgba(0, 229, 255, 0.6) !important;
}

.square.last-move {
  background-color: rgba(255, 179, 0, 0.45) !important;
}

.square.legal-target::after {
  content: '';
  position: absolute;
  width: 32%;
  height: 32%;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0, 230, 118, 0.8);
  pointer-events: none;
}

.square.legal-capture::after {
  content: '';
  position: absolute;
  width: 85%;
  height: 85%;
  border: 3px solid var(--accent-magenta);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 51, 102, 0.8);
  pointer-events: none;
}

/* Chess Glyphs */
.piece-glyph {
  font-size: clamp(28px, 9vw, 48px);
  line-height: 1;
  display: inline-block;
  pointer-events: none;
  font-family: 'Segoe UI Symbol', 'Apple Symbols', 'DejaVu Sans', 'Arial Unicode MS', sans-serif;
}

.piece-glyph.white-piece {
  color: #ffffff;
  text-shadow: 0 0 2px #000, 0 1px 4px rgba(0,0,0,0.8);
}

.piece-glyph.black-piece {
  color: #1a1a1a;
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.5), 0 1px 3px rgba(0,0,0,0.9);
}

/* Move Status Bar */
.move-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 4px;
  margin-bottom: 10px;
}

.msb-state {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.msb-actions {
  display: flex;
  gap: 8px;
}

/* Commentary Box */
.mobile-commentary-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(10, 14, 22, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
}

.mcb-avatar img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--accent-cyan);
  object-fit: cover;
}

.mcb-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.mcb-name {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-cyan);
  letter-spacing: 0.5px;
}

.mcb-text {
  font-size: 12px;
  font-style: italic;
  color: #e0e6ed;
  line-height: 1.35;
}

.hp-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.queue-cap-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.queue-cap-pill strong {
  color: var(--accent-cyan);
}

.captcha-box {
  background: rgba(15, 21, 34, 0.9);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.captcha-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-cyan);
}

.btn-refresh {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}

.captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.captcha-img {
  height: 54px;
  width: 190px;
  border-radius: 8px;
  border: 1px solid rgba(0, 229, 255, 0.25);
  background: #0b1120;
  flex-shrink: 0;
}

.captcha-input {
  flex: 1;
  min-width: 0;
  padding: 12px 10px;
  text-align: center;
  font-weight: 800;
}

.join-error {
  background: rgba(255, 51, 102, 0.14);
  border: 1px solid rgba(255, 51, 102, 0.45);
  color: #ff809f;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}
