/* Ordsprint Viewport Frame - Responsive Container */
.ordsprint-native-frame {
  position: relative !important;
  width: 100% !important;
  max-width: 450px !important;
  height: 750px !important;
  max-height: 85vh !important;
  min-height: 540px !important;
  background: #000a24 !important;
  border: 1.5px solid rgba(16, 185, 129, 0.4) !important;
  border-radius: 24px !important;
  overflow: hidden !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6) !important;
  margin: 0 auto 1.8rem auto !important;
  box-sizing: border-box !important;
}

@media (min-width: 901px) {
  .ordsprint-native-frame {
    max-width: 100% !important;
    height: 860px !important;
  }
}

.ordsprint-game-iframe {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  background: #000a24 !important;
  display: block !important;
}

.ordsprint-game-wrapper {
  width: 100%;
  max-width: 960px;
  margin: 0 auto 2rem auto;
  background: linear-gradient(135deg, #090d16 0%, #0f172a 100%);
  border: 1.5px solid rgba(16, 185, 129, 0.35);
  border-radius: 28px;
  padding: 1.8rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(16, 185, 129, 0.1);
  color: #f8fafc;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

/* --- HEADER BAR --- */
.ordsprint-web-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.2rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ordsprint-brand h2 {
  font-size: 1.8rem;
  font-weight: 900;
  margin: 0;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ordsprint-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ordsprint-btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.2rem;
  padding: 0.6rem 1rem;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ordsprint-btn-icon:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
}

/* --- MAIN LAYOUT (2 COLUMNS ON PC) --- */
.ordsprint-web-layout {
  display: grid;
  grid-template-columns: 440px 1fr;
  gap: 2rem;
  align-items: start;
}

/* --- BOARD SECTION --- */
.ordsprint-word-display {
  width: 100%;
  background: rgba(15, 23, 42, 0.8);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 0.8rem 1.2rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: #94a3b8;
  margin-bottom: 1.2rem;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.ordsprint-word-display.active {
  color: #38bdf8;
  border-color: #38bdf8;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.08);
}

.ordsprint-board-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-width: 440px;
  touch-action: none;
  user-select: none;
}

.ordsprint-svg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.ordsprint-svg-polyline {
  fill: none;
  stroke: #10b981;
  stroke-width: 9;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 10px #10b981);
  opacity: 0.9;
}

.ordsprint-board-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  width: 100%;
  height: 100%;
}

.ordsprint-tile {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ordsprint-tile:hover {
  border-color: rgba(16, 185, 129, 0.5);
  transform: translateY(-2px);
}

.ordsprint-tile.selected {
  background: linear-gradient(145deg, #059669 0%, #10b981 100%);
  border-color: #34d399;
  transform: scale(0.96);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

.ordsprint-tile.selected.head {
  background: linear-gradient(145deg, #0284c7 0%, #38bdf8 100%);
  border-color: #7dd3fc;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.6);
}

.tile-letter {
  font-size: 2.1rem;
  font-weight: 900;
  color: #ffffff;
  pointer-events: none;
}

.tile-pts {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  pointer-events: none;
}

.tile-bonus-badge {
  position: absolute;
  top: 5px;
  left: 6px;
  font-size: 0.65rem;
  font-weight: 900;
  padding: 2px 5px;
  border-radius: 6px;
  pointer-events: none;
  text-transform: uppercase;
}

.bonus-dl .tile-bonus-badge { background: #0284c7; color: #fff; }
.bonus-tl .tile-bonus-badge { background: #7c3aed; color: #fff; }
.bonus-dw .tile-bonus-badge { background: #d97706; color: #fff; }
.bonus-tw .tile-bonus-badge { background: #dc2626; color: #fff; }

/* --- SIDE DASHBOARD --- */
.ordsprint-dashboard {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  width: 100%;
}

.ordsprint-stat-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 1rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 900;
  color: #10b981;
}

/* TIMER RING */
.ordsprint-timer-container {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 1rem 1.4rem;
}

.timer-ring-wrapper {
  position: relative;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-ring-svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.timer-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 6;
}

.timer-ring-progress {
  fill: none;
  stroke: #10b981;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 226;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.timer-text-overlay {
  position: absolute;
  font-size: 1.5rem;
  font-weight: 900;
  color: #ffffff;
}

/* FOUND WORDS FEED */
.ordsprint-words-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 180px;
  overflow-y: auto;
}

.words-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
}

.ordsprint-found-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ordsprint-word-badge {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-pts {
  color: #fbbf24;
  font-size: 0.75rem;
}

/* ==========================================================================
   KAMPER / MATCH CARDS SECTION
   ========================================================================== */

.ordsprint-matches-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.matches-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.matches-section-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-new-match {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid #10b981;
  color: #34d399;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-new-match:hover {
  background: #10b981;
  color: #ffffff;
}

.ordsprint-matches-grid {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.ordsprint-match-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1.5px solid rgba(16, 185, 129, 0.3);
  border-radius: 18px;
  padding: 0.9rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ordsprint-match-card:hover {
  transform: translateY(-2px);
  border-color: #10b981;
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.2);
}

.ordsprint-match-card.finished-win {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.ordsprint-match-card.finished-loss {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.ordsprint-match-card.finished-tie {
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.08);
}

.match-card-left {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.match-bot-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #10b981;
  object-fit: cover;
}

.match-bot-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.match-bot-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.match-diff-tag {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #38bdf8;
  text-transform: uppercase;
}

.match-round-tag {
  font-size: 0.8rem;
  font-weight: 700;
  color: #94a3b8;
}

.match-card-right {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.match-scores-col {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 900;
  font-size: 1rem;
}

.match-score-player { color: #10b981; }
.match-vs-divider { color: #64748b; font-size: 0.8rem; }
.match-score-bot { color: #f43f5e; }

.match-action-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  font-size: 0.85rem;
  font-weight: 900;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: all 0.2s ease;
}

.match-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.ordsprint-no-matches {
  text-align: center;
  padding: 1.5rem;
  color: #94a3b8;
  font-size: 0.95rem;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 16px;
}

/* BUTTON PRIMARY */
.btn-ordsprint-primary {
  width: 100%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 900;
  padding: 0.9rem;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-ordsprint-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(16, 185, 129, 0.4);
}

/* MODAL OVERLAY */
.ordsprint-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(9, 13, 22, 0.88);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-sizing: border-box;
}

.ordsprint-modal-card {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border: 1.5px solid rgba(16, 185, 129, 0.4);
  border-radius: 24px;
  padding: 2.2rem;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0,0,0,0.7);
}

.ordsprint-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e293b;
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 30px;
  font-weight: 800;
  font-size: 0.95rem;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 200;
  border: 1px solid rgba(255,255,255,0.2);
}

.ordsprint-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ordsprint-toast.success { background: #059669; border-color: #34d399; }
.ordsprint-toast.error { background: #dc2626; border-color: #f87171; }
.ordsprint-toast.warning { background: #d97706; border-color: #fbbf24; }

/* RESPONSIVE LAYOUT FOR MOBILE (<900px) */
@media (max-width: 900px) {
  .ordsprint-web-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .ordsprint-game-wrapper {
    padding: 1.2rem;
    border-radius: 20px;
  }
  .ordsprint-match-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }
  .match-card-right {
    width: 100%;
    justify-content: space-between;
  }
  .tile-letter {
    font-size: 1.7rem;
  }
}
