/**
 * Tool Simulator 3D - Stylesheet
 * Copyright (c) 2024 Domi
 * Unauthorized copying, modification or distribution is prohibited.
 * This file is part of Tool Simulator 3D WordPress Plugin.
 * License: Proprietary - All Rights Reserved
 */

/* ═══════════════════════════════════════════════════════════════════════════
   ROOT & RESET
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-root {
  font-family: inherit;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  --tsim-border: #2D3748;
  --tsim-bg: #1A202C;
  --tsim-bg-dark: #0D1117;
  --tsim-text: #F8F9FA;
  --tsim-text-muted: #94A3B8;
  --tsim-accent: #0066CC;
  --tsim-badge-text: #fff;
  --viz-border-radius: 12px;
  position: relative !important;
}

.tsim-root input,
.tsim-root textarea {
  user-select: text;
  -webkit-user-select: text;
}

.tsim-root *,
.tsim-root *::before,
.tsim-root *::after {
  box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FULL WIDTH LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-fullwidth {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
  padding-left: 0;
  padding-right: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOPBAR - INSIDE CANVAS (overlay)
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #000000 !important; /* Jednolicie czarny pasek */
  border-bottom: 1px solid var(--tsim-border, #2D3748);
  flex-wrap: nowrap;
}

.tsim-topbar__left,
.tsim-topbar__mid,
.tsim-topbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.tsim-modeBtns {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE MENU (HAMBURGER)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ───────────────────────────────────────────────────────────────────────── (N/A)
   TOPBAR - MOBILE MODE (Smart Attribute Toggle)
   ───────────────────────────────────────────────────────────────────────── */

/* Domyślnie chowa przycisk hamburgera */
.tsim-mobile-menu-btn {
  display: none !important;
}

/* Kiedy JS wykryje, że przyciski się nie mieszczą, przełącza data-mobile-mode="true" */
.tsim-topbar[data-mobile-mode="true"] {
  overflow: visible;
  position: relative;
}

.tsim-topbar[data-mobile-mode="true"] .tsim-mobile-menu-btn {
  display: block !important;
  margin-left: auto;
  font-size: 20px;
  line-height: 1;
  padding: 4px 10px;
}

.tsim-topbar[data-mobile-mode="true"] .tsim-topbar__collapsible {
  display: none; /* schowany domyślnie w trybie mobile */
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
  flex-direction: column;
  gap: 12px;
  z-index: 2000;
  animation: tsim-fade-in-down 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tsim-topbar__actions {
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 2001;
}

.tsim-topbar[data-mobile-mode="true"] .tsim-topbar__actions {
  display: flex;
  margin-left: auto;
}

.tsim-fullscreen-btn {
  font-size: 18px;
  padding: 6px 10px !important;
}

.tsim-topbar[data-mobile-mode="true"] .tsim-topbar__right .tsim-fullscreen-btn {
  display: none !important;
}

@keyframes tsim-fade-in-down {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Otwieranie menu po kliknięciu w hamburger (JS ustawia data-mobile-open="true") */
.tsim-topbar[data-mobile-mode="true"][data-mobile-open="true"] .tsim-topbar__collapsible {
  display: flex !important;
}

.tsim-topbar[data-mobile-mode="true"] .tsim-topbar__mid, 
.tsim-topbar[data-mobile-mode="true"] .tsim-topbar__right {
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  gap: 10px;
}

.tsim-topbar[data-mobile-mode="true"] .tsim-topbar__right > div {
  flex-direction: column;
  align-items: stretch;
}

.tsim-topbar[data-mobile-mode="true"] .tsim-topbar__collapsible .tsim-btn, 
.tsim-topbar[data-mobile-mode="true"] .tsim-topbar__collapsible .tsim-lang-select {
  width: 100%;
  margin: 0 !important;
  text-align: left;
  justify-content: flex-start;
}

/* Fallback dla bardzo wąskich ekranów (poniżej 480px) */
@media (max-width: 480px) {
  .tsim-topbar[data-mobile-open="true"] .tsim-topbar__collapsible {
    width: calc(100% - 24px);
    right: 12px;
    left: 12px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOPBAR - DESKTOP (GRID 3-COLUMN)
   ═══════════════════════════════════════════════════════════════════════════ */

@media (min-width: 981px) {
  /* Ten breakpoint jest teraz tylko fallbackiem. Dynamiczny tryb JS jest preferowany. */
}

/* Układ poziomy aktywny tylko gdy data-mobile-mode="false" */
.tsim-topbar[data-mobile-mode="false"] {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: "left mid right";
  align-items: center;
  gap: 8px;
}

.tsim-topbar[data-mobile-mode="false"] .tsim-topbar__collapsible {
  display: contents;
}

.tsim-topbar[data-mobile-mode="false"] .tsim-topbar__actions {
  display: none;
}

.tsim-topbar[data-mobile-mode="false"] .tsim-topbar__left {
  grid-area: left;
  justify-self: start;
}

.tsim-topbar[data-mobile-mode="false"] .tsim-topbar__mid {
  grid-area: mid;
  justify-self: center;
}

.tsim-topbar[data-mobile-mode="false"] .tsim-topbar__right {
  grid-area: right;
  justify-self: end;
}

.tsim-badge {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS — OUTLINE STYLE (no filled background)
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-btn {
  background: transparent !important;
  color: rgba(255, 255, 255, 0.9) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.35) !important;
  border-radius: var(--viz-btn-radius, 6px);
  padding: var(--viz-btn-padding, 6px 14px);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.01em;
  text-transform: none;
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

.tsim-btn:hover,
.tsim-btn:focus,
.tsim-btn:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.65) !important;
  color: #fff !important;
}

.tsim-btn:active {
  background: rgba(255, 255, 255, 0.18) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS — BELOW CANVAS (Native theme via wp-block-button__link)
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-btn-astra {
  cursor: pointer;
  white-space: nowrap;
}

.tsim-btn-astra:disabled {
  opacity: 0.45;
  filter: grayscale(0.7);
  cursor: not-allowed !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LANGUAGE SELECTOR (outline style)
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-lang-select {
  background: transparent;
  color: rgba(255, 255, 255, 0.9) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--viz-btn-radius, 6px);
  padding: var(--viz-btn-padding, 5px 24px 5px 8px);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg fill='rgba(255,255,255,0.7)' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.23 7.21a.75.75 0 011.06 0L10 10.94l3.71-3.73a.75.75 0 011.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.23 8.27a.75.75 0 010-1.06z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
  background-size: 14px;
  min-width: 75px;
  backdrop-filter: blur(4px);
}

.tsim-lang-select:hover,
.tsim-lang-select:focus,
.tsim-lang-select:focus-visible,
.tsim-lang-select:active {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.65) !important;
  color: #fff !important;
  outline: none !important;
}

.tsim-lang-select option {
  background: #1e293b;
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CANVAS WRAPPER
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-canvasWrap {
  position: relative;
  border: 1px solid var(--tsim-border);
  border-radius: var(--viz-border-radius);
  overflow: hidden;
  background: var(--tsim-bg-dark);
}

.tsim-canvas {
  width: 100%;
  height: min(70vh, 720px);
  min-height: 420px;
}

.tsim-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   EKRAN STARTOWY (PREMIUM)
   ═══════════════════════════════════════════════════════════════════════════ */

.viz3d-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.4s ease;
  padding: 20px;
}

.viz3d-overlay--hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

.viz3d-overlay--preview {
  background: #ffffff;
  padding: 0;
  overflow: hidden;
  border-radius: var(--viz-border-radius);
}

.viz3d-preview-branding {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 110;
  color: rgba(0, 30, 80, 0.9);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  pointer-events: none;
}

.viz3d-preview-image-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viz3d-preview-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border: none;
}

.viz3d-preview-overlay-shadow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 280px;
  height: 80px;
  background: rgba(0, 0, 0, 0.35);
  filter: blur(25px);
  border-radius: 50px;
  pointer-events: none;
  z-index: 101;
}

.viz3d-btn-load-3d {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 105;
  background: rgba(0, 30, 80, 0.6);
  color: #ffffff;
  border: none;
  padding: 16px 40px;
  border-radius: var(--viz-border-radius-md, 12px);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 0 4px rgba(233, 69, 96, 0.2);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.viz3d-btn-load-3d:hover {
  transform: translate(-50%, -52%) scale(1.05);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7), 0 0 0 6px rgba(233, 69, 96, 0.3);
  background: rgba(0, 40, 100, 0.8);
  color: #ffffff;
}

.viz3d-btn-load-3d:active {
  transform: translate(-50%, -49%) scale(0.98);
}

.viz3d-preview-bottom {
  position: absolute;
  bottom: 15px;
  width: 100%;
  text-align: center;
  z-index: 110;
}

.viz3d-preview-hint {
  color: rgba(0, 0, 0, 0.4);
  font-size: 12px;
  text-align: center;
  font-family: 'Segoe UI', system-ui, sans-serif;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRE-ROLL AD OVERLAY
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-preroll {
  position: absolute;
  inset: 0;
  z-index: 110;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 21, 35, 0.97);
  border-radius: 12px;
}

.tsim-preroll[data-state="hidden"] {
  display: none;
}

.tsim-preroll__ad {
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 30px 60px;
  text-align: center;
  margin-bottom: 16px;
}

.tsim-preroll__icon {
  font-size: 40px;
  display: block;
  margin-bottom: 10px;
}

.tsim-preroll__label {
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
}

.tsim-preroll__size {
  color: rgba(255, 255, 255, 0.3);
  font-size: 11px;
  margin-top: 6px;
}

.tsim-preroll__text {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ROTATE OVERLAY (MOBILE PORTRAIT)
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-rotate {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 10;
  padding: 20px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   UNDER PANELS CONTAINER
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-under {
  margin-top: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTIONS
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-section {
  border: 1px solid var(--tsim-border);
  border-radius: var(--viz-border-radius);
  padding: 12px;
  background: var(--tsim-bg);
  color: var(--tsim-text);
  margin-top: 12px;
}

.tsim-section[data-state="hidden"] {
  display: none !important;
}

.tsim-section h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
  color: var(--tsim-text);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORM GRID (TEST CONFIG)
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-formGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
}

.tsim-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.tsim-field label {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  color: #38bdf8 !important;
  letter-spacing: 0.3px !important;
  margin: 0 0 4px 0 !important;
  text-transform: none !important;
}

.tsim-field input {
  width: 100% !important;
  padding: 10px 14px !important;
  background: #0f172a !important;
  border: 1.5px solid #334155 !important;
  border-radius: 8px !important;
  color: #ffffff !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  outline: none !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.tsim-field input::placeholder {
  color: #94a3b8 !important;
  opacity: 0.8 !important;
}

.tsim-field input:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25) !important;
}

@media (max-width: 980px) {
  .tsim-formGrid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 520px) {
  .tsim-formGrid {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORM FIELDS
   ════════════════════════════════════════════════════════.tsim-drawer {
  position: absolute;
  /* Przykrywamy obszar canvasa – wysokość canvasa to min(70vh, 720px), min 420px */
  top: 0;
  height: min(70vh, 720px);
  min-height: 420px;
  z-index: 50;
  display: flex;
  align-items: center; /* pionowe centrowanie zakładki */
  width: 340px;
  max-width: 85vw;
  /* Klip: poza obszarem canvasa treść jest ukryta – nie wymagamy overflow:hidden bo tab jest zewnętrzy */
  pointer-events: none; /* klikalne tylko elementy wewnętrzne */
}

/* Elementy wewnętrzne klikalne */
.tsim-drawer__tab,
.tsim-drawer__body {
  pointer-events: all;
}

/* ── LEWA SZUFLADA ─────────────────────────────────────────── */
.tsim-drawer--left {
  left: 0;
  flex-direction: row;
  /* Schowana: ciało za lewą krawędzią, widoczna tylko zakładka (44px) */
  transform: translateX(calc(-100% + 44px));
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.tsim-drawer--left.tsim-drawer--open {
  transform: translateX(0);
}

/* ── PRAWA SZUFLADA ────────────────────────────────────────── */
.tsim-drawer--right {
  right: 0;
  flex-direction: row-reverse;
  /* Schowana: ciało za prawą krawędzią, widoczna tylko zakładka (44px) */
  transform: translateX(calc(100% - 44px));
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.tsim-drawer--right.tsim-drawer--open {
  transform: translateX(0);
}

ow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PANEL HEADER (POMIAR)
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tsim-panel-title {
  margin: 0;
  font-size: clamp(15px, 2vw, 18px);
  font-weight: 700;
  color: var(--tsim-text);
  letter-spacing: -0.3px;
}

.tsim-panel-hint {
  font-size: 12px;
  color: var(--tsim-text-muted);
  margin: 0;
  font-weight: 500;
  opacity: 0.8;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MEASURE ROW (POMIAR)
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-measureRow {
  display: flex;
  gap: clamp(6px, 1.5vw, 10px);
  flex-wrap: wrap;
  align-items: stretch;
}

/* Główny wiersz pomiaru: Losuj → Input → Sprawdź */
.tsim-measureRow--main {
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}

.tsim-measureRow .tsim-input,
.tsim-measureRow .tsim-btn-astra,
.tsim-measureRow .tsim-btn {
  font-size: clamp(13px, 2.2vw, 15px);
  height: auto;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tsim-measureRow .tsim-btn-astra {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: clamp(8px, 1.2vw, 12px) clamp(14px, 2vw, 22px);
}

.tsim-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  flex: 1 1 200px;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  padding: 10px 14px;
  font-size: clamp(13px, 2vw, 15px);
}

.tsim-input:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--tsim-accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.2);
}

/* Przycisk Losuj – subtelnie wyróżniony */
.tsim-btn-randomize {
  gap: 6px;
}

/* Przycisk Sprawdź – akcent koloru */
.tsim-btn-check {
  gap: 6px;
}

.tsim-btn-icon {
  font-style: normal;
  line-height: 1;
  pointer-events: none;
}

@media (max-width: 600px) {
  .tsim-measureRow--main {
    flex-wrap: wrap;
  }

  .tsim-measureRow--main .tsim-input--answer {
    order: -1;
    flex: 1 1 100%;
  }

  .tsim-measureRow--main .tsim-btn-randomize,
  .tsim-measureRow--main .tsim-btn-check {
    flex: 1 1 calc(50% - 4px);
  }
}

@media (min-width: 981px) {
  .tsim-measureRow {
    flex-wrap: nowrap;
  }

  .tsim-measureRow--main .tsim-input--answer {
    flex: 1 1 260px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SET VALUE BOX (SEKCJA USTAWIANIA WARTOŚCI)
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-setvalue-box {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--tsim-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  position: relative;
  transition: border-color 0.2s ease;
}

.tsim-setvalue-box:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.tsim-setvalue-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--tsim-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.tsim-setvalue-icon {
  font-size: 14px;
  opacity: 0.7;
}

.tsim-setvalue-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tsim-input--setvalue {
  flex: 1 1 140px;
  max-width: 200px;
  min-height: 38px;
  font-size: 14px;
  padding: 8px 12px;
}

.tsim-btn-setvalue {
  flex: 0 0 auto;
  min-height: 38px !important;
  font-size: 13px !important;
  padding: 8px 16px !important;
  white-space: nowrap;
}

.tsim-setvalue-desc {
  margin: 8px 0 0 0;
  font-size: 11px;
  color: var(--tsim-text-muted);
  line-height: 1.5;
  opacity: 0.75;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDE DRAWERS (SZUFLADY BOCZNE)
   ═══════════════════════════════════════════════════════════════════════════ */

/*
 * Szuflady są absolutnie pozycjonowane względem .tsim-root.
 * Domyślnie schowane – widoczna tylko zakładka (~50px = tab width).
 * Po kliknięciu zakładki: dodawana klasa --open, szuflada wysuwa się.
 */

.tsim-drawer {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: flex;
  align-items: stretch;
  /* Rozmiar szuflady */
  width: 340px;
  max-width: 85vw;
  /* Wysokość dopasowana do zawartości */
  filter: drop-shadow(0 4px 24px rgba(0,0,0,0.55));
}

/* ── LEWA SZUFLADA ─────────────────────────────────────────── */
.tsim-drawer--left {
  left: 0;
  flex-direction: row;
  /* Ukryj ciało poza ekranem – zostaw tylko tab (~44px) */
  transform: translateY(-50%) translateX(calc(-100% + 44px));
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.tsim-drawer--left.tsim-drawer--open {
  transform: translateY(-50%) translateX(0);
}

/* ── PRAWA SZUFLADA ────────────────────────────────────────── */
.tsim-drawer--right {
  right: 0;
  flex-direction: row-reverse;
  transform: translateY(-50%) translateX(calc(100% - 44px));
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.tsim-drawer--right.tsim-drawer--open {
  transform: translateY(-50%) translateX(0);
}

/* ── ZAKŁADKA (TAB) ──────────────────────────────────────────  */
.tsim-drawer__tab {
  /* Pionowy pasek boczny */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 44px;
  min-height: 100px;
  flex-shrink: 0;
  padding: 12px 0;
  cursor: pointer;
  border: none;
  outline: none;
  /* Gradient tła – dziedziczny styl, lekko ciemniejszy niż ciało */
  background: linear-gradient(135deg, rgba(30, 40, 60, 0.96) 0%, rgba(15, 25, 45, 0.98) 100%);
  border-radius: 0;
  color: var(--tsim-text, #f0f0f0);
  transition: background 0.2s ease, width 0.2s ease;
  position: relative;
}

.tsim-drawer--left .tsim-drawer__tab {
  order: 1; /* tab po prawej stronie ciała (dla lewej szuflady – czyli na krawędzi widoczności) */
  border-radius: 0 10px 10px 0;
  border-left: none;
  box-shadow: 3px 0 12px rgba(0,0,0,0.4);
}

.tsim-drawer--right .tsim-drawer__tab {
  order: 1;
  border-radius: 10px 0 0 10px;
  border-right: none;
  box-shadow: -3px 0 12px rgba(0,0,0,0.4);
}

.tsim-drawer__tab:hover {
  background: linear-gradient(135deg, rgba(40, 55, 80, 0.98) 0%, rgba(25, 38, 65, 1) 100%);
  width: 50px;
}

.tsim-drawer__tab:focus-visible {
  outline: 2px solid var(--tsim-accent);
  outline-offset: -2px;
}

/* Strzałka obraca się po otwarciu */
.tsim-drawer__tab-arrow {
  font-size: 14px;
  line-height: 1;
  display: block;
  transition: transform 0.3s ease;
  color: var(--tsim-text-muted, #aaa);
}

.tsim-drawer--left.tsim-drawer--open .tsim-drawer__tab-arrow {
  transform: rotate(180deg);
}

.tsim-drawer--right.tsim-drawer--open .tsim-drawer__tab-arrow {
  transform: rotate(180deg);
}

/* Etykieta pionowa */
.tsim-drawer__tab-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  display: inline-block;
  color: var(--tsim-text-muted, #aaa);
  line-height: 1;
  transition: color 0.2s ease;
}

.tsim-drawer__tab:hover .tsim-drawer__tab-label,
.tsim-drawer--open .tsim-drawer__tab-label {
  color: var(--tsim-text, #f0f0f0);
}

/* ── CIAŁO SZUFLADY ──────────────────────────────────────────  */
.tsim-drawer__body {
  background: linear-gradient(160deg, rgba(22, 32, 52, 0.97) 0%, rgba(12, 20, 38, 0.99) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 18px 16px;
  flex: 1;
  overflow-y: auto;
  max-height: 70vh;
  /* Scrollbar ukryty ale funkcjonalny */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.tsim-drawer--left .tsim-drawer__body {
  order: 0;
  border-radius: 0 0 0 0;
}

.tsim-drawer--right .tsim-drawer__body {
  order: 0;
}

/* Wsparcie dla małych ekranów */
@media (max-width: 480px) {
  .tsim-drawer {
    width: 90vw;
    max-width: 90vw;
  }

  .tsim-drawer--left {
    transform: translateY(-50%) translateX(calc(-100% + 40px));
  }

  .tsim-drawer--left.tsim-drawer--open {
    transform: translateY(-50%) translateX(0);
  }

  .tsim-drawer--right {
    transform: translateY(-50%) translateX(calc(100% - 40px));
  }

  .tsim-drawer--right.tsim-drawer--open {
    transform: translateY(-50%) translateX(0);
  }
}



/* ═══════════════════════════════════════════════════════════════════════════
   MUTED TEXT
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-muted {
  color: var(--tsim-text-muted);
  font-size: 12px;
  display: block;
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HISTORY SECTION
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-history {
  margin-top: 14px;
}

.tsim-tableWrap {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--tsim-border);
  border-radius: 10px;
}

.tsim-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tsim-table th,
.tsim-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--tsim-border);
  color: var(--tsim-text);
}

.tsim-table th {
  position: sticky;
  top: 0;
  background: #2D3748;
  z-index: 1;
  text-align: left;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-modal {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 26, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
  cursor: pointer;
}

.tsim-modal[aria-hidden="false"] {
  display: flex;
}

.tsim-modal__card {
  width: min(560px, 100%);
  max-height: 85%;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--viz-border-radius);
  padding: 32px 36px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  cursor: default;
  color: #fff;
}

.tsim-modal__title {
  font-weight: 700;
  margin-bottom: 8px;
  color: #ffffff;
}

.tsim-modal__body {
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.45;
  white-space: pre-wrap;
}

.tsim-modal__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.tsim-modal__actions button,
.tsim-modal__body button {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: var(--viz-btn-radius, 6px);
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tsim-modal__actions button:hover,
.tsim-modal__body button:hover {
  background: rgba(255, 255, 255, 0.25) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   INSTRUKCJA OBSŁUGI (SZYBKA I PROSTA)
   ═══════════════════════════════════════════════════════════════════════════ */
.tsim-modal__card {
  width: min(580px, 95vw);
  max-height: 85vh;
}

/* ═══════════════════════════════════════════════════════════════════════════
   GATE (CREDITS LOGIN REQUIRED)
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-gate {
  padding: 14px;
  border: 1px solid var(--tsim-border);
  border-radius: var(--viz-border-radius);
  background: var(--tsim-bg);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SLIDER DRAG MODE INDICATOR
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-root[data-slider-mode="true"] .tsim-canvas {
  cursor: ew-resize;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

@media print {

  .tsim-topbar,
  .tsim-canvasWrap,
  .tsim-modal {
    display: none !important;
  }

  .tsim-history {
    page-break-inside: avoid;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOADING OVERLAY
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 21, 35, 0.98);
  z-index: 999999;
  border-radius: 0;
  /* Usunięto zaokrąglenia dla pełnego ekranu */
}

.tsim-loading[data-state="hidden"] {
  display: none;
}

/* Usunięty spinner z Wizualizacje_3D_z_quiz - stawiają na czysty progress bar */

/* MIEJSCE NA REKLAMĘ WZOREM WIZUALIZACJI 3D */
.viz3d-ad-placeholder {
  width: 90%;
  max-width: 1000px;
  height: 60vh;
  min-height: 250px;
  max-height: 500px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 30px rgba(100, 80, 200, 0.3);
  flex-shrink: 0;
  margin-bottom: 25px !important;
  position: relative;
  overflow: hidden;
}

/* Subtelny animowany gradient w tle reklamy dla ciekawszego efektu */
.viz3d-ad-placeholder::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
  animation: ad-pulse 8s infinite alternate ease-in-out;
}

@keyframes ad-pulse {
  0% {
    transform: scale(0.8) translate(0, 0);
  }

  100% {
    transform: scale(1.2) translate(5%, 5%);
  }
}

.viz3d-ad-placeholder__inner {
  text-align: center;
  color: #fff;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 22px;
  line-height: 1.6;
  z-index: 1;
}

.viz3d-ad-placeholder__icon {
  font-size: 64px;
  margin-bottom: 20px;
  display: block;
}

.tsim-loading__bar-wrap {
  width: 55%;
  max-width: 380px;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 24px;
}

.tsim-loading__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--viz-primary, #3b82f6), #ff6b6b);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.tsim-loading__text {
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  letter-spacing: 0.3px;
  font-family: 'Segoe UI', system-ui, sans-serif;
  text-align: center;
}

.tsim-loading__text span:last-child {
  margin-left: 5px;
}

/* Error state */
/* Error state bez spinnera */

.tsim-loading[data-state="error"] .tsim-loading__bar {
  background: #ef4444;
}

.tsim-loading[data-state="error"] .tsim-loading__text {
  color: #fca5a5;
}

/* Disabled buttons */
.tsim-root button:disabled {
  opacity: 0.45;
  filter: grayscale(0.7);
  cursor: not-allowed !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FULLSCREEN MODE
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-root:fullscreen,
.tsim-root:-webkit-full-screen {
  background: #0f1523;
  padding: 0 12px;
  display: flex !important;
  flex-direction: column;
  height: 100vh;
  box-sizing: border-box;
  overflow: hidden;
}

.tsim-root:fullscreen .tsim-fullwidth,
.tsim-root:-webkit-full-screen .tsim-fullwidth {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

/* CanvasWrap zajmuje resztę dostępnej przestrzeni */
.tsim-root:fullscreen .tsim-canvasWrap,
.tsim-root:-webkit-full-screen .tsim-canvasWrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Sam canvas wypełnia CanvasWrap na 100% */
.tsim-root:fullscreen .tsim-canvas,
.tsim-root:-webkit-full-screen .tsim-canvas {
  height: 100%;
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
}

/* Panele dolne na samym dole, bez scrollovwania rosną sobie w górę */
.tsim-root:fullscreen .tsim-under,
.tsim-root:-webkit-full-screen .tsim-under {
  flex: 0 0 auto;
  margin-top: 8px;
  margin-bottom: 8px;
}

/* Ukrywamy historię by nie zabierała miejsca lub włączamy scrollowanie tylko dla sekcji z wynikami */
.tsim-root:fullscreen .tsim-history,
.tsim-root:-webkit-full-screen .tsim-history {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   WATERMARK
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-25deg);
  z-index: 9;
  pointer-events: none;
  font-size: 70px;
  font-weight: 800;
  letter-spacing: 4px;
  color: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  text-transform: uppercase;
  font-family: inherit;
}

@media (max-width: 600px) {
  .tsim-watermark {
    font-size: 40px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TEXT W ROGU (NAZWA ELEMENTU)
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-corner-text {
  position: absolute;
  top: 60px; /* Umieszczony pod czarnym paskiem menu */
  left: 16px; /* W lewym górnym rogu canvas */
  z-index: 15;
  pointer-events: none;
  text-align: left;
}

.tsim-corner-title {
  color: rgba(255, 255, 255, 0.85);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  line-height: 1.3;
}

/* Ukryj napis kiedy widoczny jest ekran startowy (cover) */
.tsim-root:has([data-role="coverOverlay"]:not(.viz3d-overlay--hidden)) .tsim-corner-text {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   QUIZ ABCD PANEL
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-quiz-panel {
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.tsim-quiz-label {
  display: none;
}

.tsim-quiz-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tsim-quiz-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1.5px solid var(--tsim-border);
  border-radius: 8px;
  background: var(--tsim-bg);
  color: var(--tsim-text);
  font-size: 14px;
  min-height: 44px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  position: relative;
  overflow: hidden;
  flex: 1 1 calc(25% - 6px);
  min-width: 100px;
}

.tsim-quiz-btn:hover:not(:disabled) {
  border-color: var(--tsim-accent);
  background: rgba(0, 102, 204, 0.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.2);
}

.tsim-quiz-btn:active:not(:disabled) {
  transform: translateY(0);
}

.tsim-quiz-btn:disabled {
  cursor: default;
  opacity: 0.85;
}

.tsim-quiz-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--tsim-accent);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.tsim-quiz-value {
  font-weight: 500;
}

/* States: correct / incorrect / revealed */
.tsim-quiz-btn[data-state="correct"] {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
  animation: tsim-quiz-pulse-correct 0.4s ease;
}

.tsim-quiz-btn[data-state="correct"] .tsim-quiz-letter {
  background: #22c55e;
}

.tsim-quiz-btn[data-state="incorrect"] {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  animation: tsim-quiz-shake 0.4s ease;
}

.tsim-quiz-btn[data-state="incorrect"] .tsim-quiz-letter {
  background: #ef4444;
}

.tsim-quiz-btn[data-state="dimmed"] {
  opacity: 0.4;
}

@keyframes tsim-quiz-pulse-correct {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes tsim-quiz-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

@media (max-width: 480px) {
  .tsim-quiz-grid {
    grid-template-columns: 1fr;
  }
  .tsim-quiz-btn {
    padding: 10px 14px;
    font-size: 14px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROGRESS BAR (Learning Progress)
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-progress-wrap {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--tsim-bg-dark);
  border: 1px solid var(--tsim-border);
  border-radius: 8px;
}

.tsim-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.tsim-progress-title {
  color: var(--tsim-text);
  font-size: 13px;
  font-weight: 600;
}

.tsim-progress-pct {
  color: var(--tsim-accent);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tsim-progress-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.tsim-progress-fill {
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, #ef4444 0%, #f59e0b 35%, #22c55e 70%, #06b6d4 100%);
  background-size: 300% 100%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.tsim-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.2) 50%, transparent 100%);
  animation: tsim-progress-shimmer 2s infinite;
}

@keyframes tsim-progress-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.tsim-progress-wrap .tsim-muted {
  display: block;
  margin-top: 4px;
  font-size: 11px;
}
/* ═══════════════════════════════════════════════════════════════════════════
   PANEL HEADER (POMIAR)
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tsim-panel-title {
  margin: 0;
  font-size: clamp(15px, 2vw, 18px);
  font-weight: 700;
  color: var(--tsim-text);
  letter-spacing: -0.3px;
}

.tsim-panel-hint {
  font-size: 12px;
  color: var(--tsim-text-muted);
  margin: 0;
  font-weight: 500;
  opacity: 0.8;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDE DRAWERS (SZUFLADY BOCZNE)
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-drawer {
  position: absolute;
  top: 0;
  height: min(70vh, 720px);
  min-height: 420px;
  z-index: 50;
  display: flex;
  align-items: center;
  width: 340px;
  max-width: 85vw;
  pointer-events: none;
}

.tsim-drawer__tab,
.tsim-drawer__body {
  pointer-events: all;
}

/* -- LEWA SZUFLADA */
.tsim-drawer--left {
  left: 0;
  flex-direction: row;
  transform: translateX(calc(-100% + 44px));
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.tsim-drawer--left.tsim-drawer--open {
  transform: translateX(0);
}

/* -- PRAWA SZUFLADA */
.tsim-drawer--right {
  right: 0;
  flex-direction: row-reverse;
  transform: translateX(calc(100% - 44px));
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.tsim-drawer--right.tsim-drawer--open {
  transform: translateX(0);
}

/* -- ZAKLADKA (TAB) */
.tsim-drawer__tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 44px;
  min-height: 100px;
  flex-shrink: 0;
  padding: 12px 0;
  cursor: pointer;
  border: none;
  outline: none;
  background: linear-gradient(135deg, rgba(30,40,60,0.97) 0%, rgba(15,25,45,0.99) 100%);
  color: var(--tsim-text, #f0f0f0);
  transition: background 0.2s ease, width 0.2s ease;
  align-self: center;
}

.tsim-drawer--left .tsim-drawer__tab {
  order: 1;
  border-radius: 0 10px 10px 0;
  box-shadow: 3px 0 12px rgba(0,0,0,0.5);
}

.tsim-drawer--right .tsim-drawer__tab {
  order: 1;
  border-radius: 10px 0 0 10px;
  box-shadow: -3px 0 12px rgba(0,0,0,0.5);
}

.tsim-drawer__tab:hover {
  background: linear-gradient(135deg, rgba(40,55,80,0.99) 0%, rgba(25,38,65,1) 100%);
  width: 50px;
}

.tsim-drawer__tab:focus-visible {
  outline: 2px solid var(--tsim-accent);
  outline-offset: -2px;
}

.tsim-drawer__tab-arrow {
  font-size: 14px;
  line-height: 1;
  display: block;
  transition: transform 0.3s ease;
  color: var(--tsim-text-muted, #aaa);
}

.tsim-drawer--left.tsim-drawer--open .tsim-drawer__tab-arrow {
  transform: rotate(180deg);
}

.tsim-drawer--right.tsim-drawer--open .tsim-drawer__tab-arrow {
  transform: rotate(180deg);
}

.tsim-drawer__tab-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  display: inline-block;
  color: var(--tsim-text-muted, #aaa);
  line-height: 1;
  transition: color 0.2s ease;
}

.tsim-drawer__tab:hover .tsim-drawer__tab-label,
.tsim-drawer--open .tsim-drawer__tab-label {
  color: var(--tsim-text, #f0f0f0);
}

/* -- CIALO SZUFLADY */
.tsim-drawer__body {
  background: linear-gradient(160deg, rgba(22,32,52,0.98) 0%, rgba(12,20,38,0.99) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 18px 16px;
  flex: 1;
  overflow-y: auto;
  max-height: 70vh;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
  align-self: center;
}

.tsim-drawer--left .tsim-drawer__body {
  order: 0;
  border-radius: 12px 0 0 12px;
}

.tsim-drawer--right .tsim-drawer__body {
  order: 0;
  border-radius: 0 12px 12px 0;
}

/* -- SETVALUE BOX (wewnatrz szuflady) */
.tsim-setvalue-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--tsim-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.tsim-setvalue-icon {
  font-size: 14px;
  opacity: 0.7;
}

.tsim-setvalue-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tsim-input--setvalue {
  flex: 1 1 140px;
  max-width: 200px;
  min-height: 38px;
  font-size: 14px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  color: #fff;
}

.tsim-btn-setvalue {
  flex: 0 0 auto;
  min-height: 38px !important;
  font-size: 13px !important;
  padding: 8px 16px !important;
  white-space: nowrap;
}

.tsim-setvalue-desc {
  margin: 8px 0 0 0;
  font-size: 11px;
  color: var(--tsim-text-muted);
  line-height: 1.5;
  opacity: 0.75;
}

/* Mobile */
@media (max-width: 480px) {
  .tsim-drawer {
    width: 90vw;
    max-width: 90vw;
  }

  .tsim-drawer--left {
    transform: translateX(calc(-100% + 40px));
  }

  .tsim-drawer--left.tsim-drawer--open {
    transform: translateX(0);
  }

  .tsim-drawer--right {
    transform: translateX(calc(100% - 40px));
  }

  .tsim-drawer--right.tsim-drawer--open {
    transform: translateX(0);
  }
}

/* Inputy wewnatrz szuflad - widoczne na ciemnym tle */
.tsim-drawer__body .tsim-input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
}

.tsim-drawer__body .tsim-input:focus {
  background: rgba(255, 255, 255, 0.13);
  border-color: var(--tsim-accent, #0066CC);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.22);
}

/* Wiersze przyciskow w szufladzie */
.tsim-drawer__body .tsim-measureRow--main {
  flex-direction: column;
  flex-wrap: wrap;
  gap: 10px;
}

.tsim-drawer__body .tsim-measureRow--main > * {
  width: 100%;
}

.tsim-drawer__body .tsim-input--answer {
  width: 100%;
  flex: unset;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DOLNE PODOKNO Z BOCZNĄ ZAKŁADKĄ (TSIM-BOTTOM-PANEL)
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-bottom-panel-wrap {
  position: relative !important;
  overflow: hidden !important;
  min-height: 170px;
  padding-right: 48px !important; /* miejsce na zakladke po prawej */
}

.tsim-bottom-main-content {
  width: 100%;
}

/* Wysuwany panel "Ustaw zadaną wartość" z prawej strony dolnego podokna */
.tsim-bottom-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: row;
  z-index: 25;
  transform: translateX(calc(100% - 44px));
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.tsim-bottom-drawer.tsim-bottom-drawer--open {
  transform: translateX(0);
}

/* Zakladka tsim-bottom-drawer__tab po lewej stronie drawer contentu */
.tsim-bottom-drawer__tab {
  width: 44px;
  height: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.98) 0%, rgba(15, 23, 42, 1) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-right: none;
  border-radius: 10px 0 0 10px;
  color: var(--tsim-text, #fff);
  cursor: pointer;
  padding: 8px 0;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.4);
  transition: background 0.2s ease, width 0.2s ease;
  flex-shrink: 0;
}

.tsim-bottom-drawer__tab:hover {
  background: linear-gradient(135deg, rgba(47, 63, 86, 1) 0%, rgba(26, 37, 56, 1) 100%);
  width: 48px;
}

.tsim-bottom-drawer__tab-icon {
  font-size: 15px;
  opacity: 0.9;
}

.tsim-bottom-drawer__tab-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  display: inline-block;
  color: var(--tsim-text-muted, #94a3b8);
}

.tsim-bottom-drawer.tsim-bottom-drawer--open .tsim-bottom-drawer__tab-label {
  color: #fff;
}

.tsim-bottom-drawer__tab-arrow {
  font-size: 12px;
  transition: transform 0.3s ease;
  color: var(--tsim-accent, #0066cc);
}

.tsim-bottom-drawer.tsim-bottom-drawer--open .tsim-bottom-drawer__tab-arrow {
  transform: rotate(180deg);
}

/* Zawartosc panelu ustawiania wartosci */
.tsim-bottom-drawer__content {
  background: linear-gradient(160deg, rgba(20, 29, 47, 0.98) 0%, rgba(10, 16, 28, 0.99) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0 10px 10px 0;
  padding: 16px 20px;
  width: 320px;
  max-width: calc(100vw - 80px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow-y: auto;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.6);
}

.tsim-drawer-options-list label {
  transition: color 0.15s ease, background 0.15s ease;
  padding: 4px 6px;
  border-radius: 4px;
  user-select: none;
}
.tsim-drawer-options-list label:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #38bdf8 !important;
}
.tsim-drawer-options-list input[type="checkbox"] {
  accent-color: #0284c7;
}



/* Pola formularza w panelu testowym – identyczny wygląd jak w trybie nauki */
.tsim-testConfig-panel .tsim-field label {
  color: #38bdf8 !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  letter-spacing: 0.3px !important;
  text-shadow: none !important;
}

.tsim-testConfig-panel .tsim-field input[type="text"],
.tsim-testConfig-panel .tsim-field input[type="number"] {
  background: #0f172a !important;
  border: 1.5px solid #334155 !important;
  color: #ffffff !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  padding: 10px 14px !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

.tsim-testConfig-panel .tsim-field input::placeholder {
  color: #94a3b8 !important;
  opacity: 0.8 !important;
  font-weight: 400 !important;
}

.tsim-testConfig-panel .tsim-field input:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25) !important;
}


/* ═══════════════════════════════════════════════════════════════════════════
   TEST CONFIG PANEL STYLING MATCHED TO MEASURE PANEL (NAUKA)
   ═══════════════════════════════════════════════════════════════════════════ */

.tsim-testConfig-panel {
  background: var(--tsim-bg, #1A202C) !important;
  border: 1px solid var(--tsim-border, #2D3748) !important;
  border-radius: var(--viz-border-radius, 12px) !important;
  padding: 18px 20px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25) !important;
  margin-top: 14px !important;
}

.tsim-testConfig-panel .tsim-panel-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 14px;
  margin-bottom: 18px;
  padding-right: 75px !important; /* Bezpieczne odsunięcie od wysuwanego paska/zakładki "Opcje" */
}

.tsim-testConfig-panel .tsim-panel-title {
  margin: 0;
  font-size: clamp(15px, 2vw, 18px);
  font-weight: 700;
  color: var(--tsim-text, #fff);
  line-height: 1.35;
}

.tsim-testConfig-panel .tsim-panel-hint {
  display: block;
  font-size: 13.5px;
  color: var(--tsim-text-muted, #94a3b8);
  margin-top: 8px !important;
  font-weight: 500;
  line-height: 1.5;
  max-width: calc(100% - 20px);
}

.tsim-field--full {
  grid-column: 1 / -1 !important;
}

.tsim-quiz-toggle-box {
  background: rgba(56, 189, 248, 0.08) !important;
  border: 1.5px solid rgba(56, 189, 248, 0.3) !important;
  border-radius: 8px !important;
  padding: 10px 14px !important;
  transition: border-color 0.2s ease, background-color 0.2s ease !important;
}

.tsim-quiz-toggle-box:hover {
  background: rgba(56, 189, 248, 0.14) !important;
  border-color: rgba(56, 189, 248, 0.5) !important;
}

.tsim-quiz-toggle-label {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  color: #38bdf8 !important;
  cursor: pointer !important;
  margin: 0 !important;
  user-select: none !important;
}

.tsim-quiz-checkbox {
  width: 18px !important;
  height: 18px !important;
  accent-color: #38bdf8 !important;
  cursor: pointer !important;
}

.tsim-test-actions-row {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
  padding-top: 14px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.tsim-btn-start-test {
  /* Dopasowanie do motywu Astra (dziedziczenie zmiennych i klas button ast-button) */
  background-color: var(--viz-btn-bg, var(--ast-global-color-0, #0066CC)) !important;
  color: var(--viz-btn-color, #ffffff) !important;
  font-family: var(--viz-btn-font-family, inherit) !important;
  font-size: var(--viz-btn-font-size, 15px) !important;
  font-weight: var(--viz-btn-font-weight, 700) !important;
  padding: var(--viz-btn-padding, 10px 24px) !important;
  border-radius: var(--viz-btn-radius, 8px) !important;
  border: var(--viz-btn-border, 1px solid transparent) !important;
  box-shadow: var(--viz-btn-shadow, 0 4px 12px rgba(0, 102, 204, 0.3)) !important;
  letter-spacing: var(--viz-btn-letter-spacing, normal) !important;
  text-transform: var(--viz-btn-text-transform, none) !important;
  line-height: var(--viz-btn-line-height, 1.4) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}

.tsim-btn-start-test:hover {
  background-color: var(--viz-primary-hover, #004499) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25) !important;
}

.tsim-btn-history-tab,
.tsim-btn-pdf-export,
.tsim-btn-reset-session {
  background: #1e293b !important;
  color: #f8fafc !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  padding: 10px 16px !important;
  border-radius: 8px !important;
  border: 1px solid #334155 !important;
  cursor: pointer !important;
  transition: background-color 0.2s ease !important;
}

.tsim-btn-history-tab:hover,
.tsim-btn-pdf-export:hover,
.tsim-btn-reset-session:hover {
  background: #334155 !important;
  border-color: #38bdf8 !important;
}

.tsim-cost-badge {
  font-size: 13px !important;
  color: #94a3b8 !important;
  background: rgba(255, 255, 255, 0.05) !important;
  padding: 6px 12px !important;
  border-radius: 6px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* ==========================================================================
   TOOLTIPS (DYMKI Z OPISEM FUNKCJI)
   ========================================================================== */
.tsim-custom-tooltip {
  position: absolute;
  z-index: 9999999;
  max-width: 320px;
  min-width: 140px;
  background: rgba(15, 23, 42, 0.96);
  color: #f8fafc;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.16);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px) scale(0.97);
  transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-align: left;
  font-family: inherit;
  word-break: normal;
}

.tsim-custom-tooltip.tsim-tooltip--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.tsim-custom-tooltip::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: rgba(15, 23, 42, 0.96);
  transform: rotate(45deg);
}

.tsim-custom-tooltip.tsim-tooltip--top::after {
  bottom: -4px;
  left: calc(var(--arrow-x, 50%) - 4px);
  border-right: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.tsim-custom-tooltip.tsim-tooltip--bottom::after {
  top: -4px;
  left: calc(var(--arrow-x, 50%) - 4px);
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}



