.sorteo-container {
    --sorteo-primary: #6366f1;
    --sorteo-secondary: #a855f7;
    --sorteo-accent: #ec4899;
    --sorteo-success: #10b981;
    --sorteo-warning: #fbbf24;
    --sorteo-danger: #ef4444;
    --sorteo-bg: #f8fafc;
    --sorteo-card: #fff;
    --sorteo-border: #e2e8f0;
    --sorteo-text: #1e293b;
    --sorteo-text-muted: #64748b;
    --sorteo-studio-bg: #0f172a;

    width: 100%;
    max-width: 80rem;
    margin: 0 auto;
    padding: 1.5rem;
  }

  .theme-dark .sorteo-container {
    --sorteo-bg: #020617;
    --sorteo-card: #0f172a;
    --sorteo-border: #1e293b;
    --sorteo-text: #f1f5f9;
    --sorteo-text-muted: #94a3b8;
  }

  .sorteo-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  @media (min-width: 1280px) {
    .sorteo-grid {
      grid-template-columns: repeat(12, 1fr);
    }
  }

  .sorteo-sidebar {
    grid-column: span 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 800px;
    transition: all 0.5s ease;
  }

  @media (min-width: 1280px) {
    .sorteo-sidebar {
      grid-column: span 4;
    }
  }

  .sorteo-sidebar.hidden {
    display: none;
  }

  .sorteo-stats-card {
    background: var(--sorteo-card);
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--sorteo-border);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
  }

  .sorteo-stats-icon {
    position: absolute;
    top: 0;
    right: 0;
    padding: 1rem;
    opacity: 0.1;
    transition: opacity 0.3s;
  }

  .sorteo-stats-card:hover .sorteo-stats-icon {
    opacity: 0.2;
  }

  .sorteo-stats-icon [data-icon] {
    width: 6rem;
    height: 6rem;
    color: var(--sorteo-primary);
  }

  .sorteo-stats-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sorteo-text-muted);
    margin: 0;
  }

  .sorteo-stats-value-wrapper {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-top: 0.25rem;
  }

  .sorteo-count {
    font-size: 3rem;
    font-weight: 900;
    color: var(--sorteo-text);
    letter-spacing: -0.05em;
  }

  .sorteo-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sorteo-success);
    background: rgba(16, 185, 129, 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
  }

  .sorteo-panel-tabs {
    flex: 1;
    background: var(--sorteo-card);
    border-radius: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--sorteo-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
  }

  .sorteo-tabs-header {
    display: flex;
    border-bottom: 1px solid var(--sorteo-border);
  }

  .sorteo-tab-btn {
    flex: 1;
    padding: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--sorteo-text-muted);
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
  }

  .sorteo-tab-btn.active {
    border-bottom-color: var(--sorteo-primary);
    color: var(--sorteo-primary);
    background: rgba(99, 102, 241, 0.05);
  }

  .sorteo-tab-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .sorteo-tab-view.hidden {
    display: none;
  }

  .sorteo-view-actions {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--sorteo-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
  }

  .sorteo-upload-label {
    cursor: pointer;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(99, 102, 241, 0.05);
    color: var(--sorteo-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
  }

  .sorteo-upload-label:hover {
    background: rgba(99, 102, 241, 0.1);
  }

  .sorteo-icon-btn {
    color: var(--sorteo-text-muted);
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
  }

  .sorteo-icon-btn:hover {
    color: var(--sorteo-danger);
    background: rgba(239, 68, 68, 0.05);
  }

  .sorteo-textarea-wrapper {
    flex: 1;
    position: relative;
    min-height: 0;
  }

  .sorteo-textarea {
    width: 100%;
    height: 100%;
    padding: 1rem;
    border: none;
    background: transparent;
    resize: none;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--sorteo-text);
    outline: none;
  }

  .sorteo-textarea-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2rem;
    background: linear-gradient(to top, var(--sorteo-card), transparent);
    pointer-events: none;
  }

  .sorteo-view-footer {
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--sorteo-border);
    font-size: 0.625rem;
    color: var(--sorteo-text-muted);
    display: flex;
    justify-content: space-between;
  }

  .sorteo-settings-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
  }

  .sorteo-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--sorteo-text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .sorteo-options-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .sorteo-option-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: rgba(0,0,0,0.02);
    border: 1px solid var(--sorteo-border);
    border-radius: 0.75rem;
    cursor: pointer;
  }

  .theme-dark .sorteo-option-item {
      background: rgba(255,255,255,0.02);
  }

  .sorteo-option-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sorteo-text);
  }

  .sorteo-switch {
    position: relative;
    width: 2.25rem;
    height: 1.25rem;
  }

  .sorteo-switch-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 9999px;
    transition: all 0.3s;
  }

  .theme-dark .sorteo-switch-slider {
      background: #334155;
  }

  .sorteo-switch-slider::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1rem;
    height: 1rem;
    background: white;
    border-radius: 50%;
    transition: all 0.3s;
  }

  .sorteo-switch input:checked + .sorteo-switch-slider {
    background: var(--sorteo-primary);
  }

  .sorteo-switch input:checked + .sorteo-switch-slider.success {
      background: var(--sorteo-success);
  }

  .sorteo-switch input:checked + .sorteo-switch-slider.primary {
      background: var(--sorteo-secondary);
  }

  .sorteo-switch input:checked + .sorteo-switch-slider::after {
    transform: translateX(1rem);
  }

  .sorteo-number-input {
    width: 4rem;
    text-align: center;
    background: var(--sorteo-card);
    border: 1px solid var(--sorteo-border);
    border-radius: 0.5rem;
    padding: 0.25rem;
    font-weight: 700;
    color: var(--sorteo-text);
    outline: none;
  }

  .sorteo-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .sorteo-field-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sorteo-text);
  }

  .sorteo-textarea-small {
    width: 100%;
    height: 8rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: rgba(0,0,0,0.02);
    border: 1px solid var(--sorteo-border);
    color: var(--sorteo-text);
    font-size: 0.75rem;
    outline: none;
    resize: none;
  }

  .sorteo-field-info {
    font-size: 0.625rem;
    color: var(--sorteo-text-muted);
    margin: 0;
  }

  .sorteo-stage {
    grid-column: span 1;
    height: 800px;
    position: relative;
    transition: all 0.5s ease-in-out;
  }

  @media (min-width: 1280px) {
    .sorteo-stage {
      grid-column: span 8;
    }
  }

  .sorteo-stage.zen-active {
    grid-column: span 12;
  }

  .sorteo-zen-btn {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 50;
    padding: 0.5rem;
    border-radius: 9999px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    backdrop-filter: blur(8px);
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s;
  }

  .sorteo-stage:hover .sorteo-zen-btn {
    opacity: 1;
  }

  .sorteo-zen-btn:hover {
    background: white;
    color: var(--sorteo-primary);
  }

  .theme-dark .sorteo-zen-btn:hover {
      background: black;
  }

  .sorteo-studio {
    height: 100%;
    background: var(--sorteo-studio-bg);
    border-radius: 2rem;
    border: 4px solid #1e293b;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
  }

  .sorteo-studio-header {
    height: 3rem;
    background: #020617;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 0.5rem;
  }

  .sorteo-dots {
    display: flex;
    gap: 0.375rem;
  }

  .dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
  }

  .dot.red {
    background: #ef4444;
    opacity: 0.5;
  }
  .dot.yellow {
    background: #f59e0b;
    opacity: 0.5;
  }
  .dot.green {
    background: #10b981;
    opacity: 0.5;
  }

  .sorteo-version {
    margin-left: auto;
    font-size: 0.75rem;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.2em;
  }

  .sorteo-arena {
    flex: 1;
    position: relative;
    background: radial-gradient(circle at center, #1e1b4b, #020617);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  .sorteo-grid-bg {
    position: absolute;
    inset: 0;
    background-image: 
      linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 4rem 4rem;
    mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
  }

  .sorteo-glow {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 500px;
    background: rgba(99, 102, 241, 0.15);
    filter: blur(120px);
    border-radius: 50%;
    pointer-events: none;
  }

  .sorteo-content {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 56rem;
    text-align: center;
    padding: 1rem;
  }

  .sorteo-state-empty {
    transition: all 0.5s ease;
  }

  .sorteo-state-empty.hidden-anim {
    opacity: 0;
    transform: translateY(1rem);
    pointer-events: none;
  }

  .sorteo-empty-icon {
    width: 6rem;
    height: 6rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    animation: pulse 2s infinite;
  }

  .sorteo-empty-icon [data-icon] {
    width: 2.5rem;
    height: 2.5rem;
    color: #64748b;
  }

  .sorteo-empty-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #475569;
    margin: 0;
  }

  .sorteo-state-countdown {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    pointer-events: none;
  }

  .sorteo-countdown-text {
    font-size: 15rem;
    font-weight: 900;
    color: rgba(255,255,255,0.1);
    transform: scale(1.5);
    filter: blur(2px);
  }

  .sorteo-state-active {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
  }

  .sorteo-active-label {
    color: #818cf8;
    font-size: 0.875rem;
    letter-spacing: 0.5em;
    text-transform: uppercase;
    opacity: 0.7;
  }

  .sorteo-winner-display {
    padding: 3rem 0;
  }

  .sorteo-winner-name {
    font-size: clamp(3rem, 15vw, 8rem);
    font-weight: 900;
    color: white;
    letter-spacing: -0.02em;
    margin: 0;
    text-shadow: 0 0 50px rgba(99, 102, 241, 0.5);
    word-break: break-all;
    line-height: 1.1;
  }

  .sorteo-winner-name.winner-success {
      color: #34d399;
      text-shadow: 0 0 40px rgba(52, 211, 153, 0.8), 0 0 80px rgba(52, 211, 153, 0.4);
  }

  .sorteo-winner-name.scale-up {
      transform: scale(1.1);
      transition: transform 0.5s;
  }

  .sorteo-multi-results {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    width: 100%;
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
  }

  @media (min-width: 768px) {
    .sorteo-multi-results { grid-template-columns: repeat(2, 1fr); }
  }

  @media (min-width: 1024px) {
    .sorteo-multi-results { grid-template-columns: repeat(3, 1fr); }
  }

  .sorteo-result-card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(51, 65, 85, 0.5);
    padding: 1rem;
    border-radius: 0.75rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
  }

  .sorteo-result-card:hover {
      background: rgba(16, 185, 129, 0.1);
      border-color: rgba(16, 185, 129, 0.3);
  }

  .sorteo-result-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    word-break: break-all;
  }

  .sorteo-result-idx {
    position: absolute;
    top: 0.375rem;
    left: 0.375rem;
    font-size: 0.625rem;
    color: #64748b;
  }

  .sorteo-winner-actions {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
  }

  .sorteo-reroll-btn {
    background: #1e293b;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.875rem;
    border: 1px solid #334155;
    cursor: pointer;
    transition: background 0.2s;
  }

  .sorteo-reroll-btn:hover {
    background: #334155;
  }

  .sorteo-studio-footer {
    height: 6rem;
    background: #0f172a;
    border-top: 1px solid #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2rem;
  }

  .sorteo-main-btn {
    width: 100%;
    max-width: 28rem;
    position: relative;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    outline: none;
  }

  .sorteo-btn-glow {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
    border-radius: 0.75rem;
    filter: blur(8px);
    opacity: 0.25;
    transition: opacity 0.5s;
  }

  .sorteo-main-btn:hover:not(:disabled) .sorteo-btn-glow {
    opacity: 0.75;
  }

  .sorteo-main-btn:disabled .sorteo-btn-glow {
    display: none;
  }

  .sorteo-btn-content {
    position: relative;
    height: 3.5rem;
    background: white;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: transform 0.1s;
  }

  .theme-dark .sorteo-btn-content {
      background: #020617;
      border-color: #1e293b;
  }

  .sorteo-main-btn:active:not(:disabled) .sorteo-btn-content {
    transform: scale(0.98);
  }

  .sorteo-btn-content span {
    font-size: 1.25rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: linear-gradient(90deg, #4f46e5, #9333ea);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .theme-dark .sorteo-btn-content span {
      background: linear-gradient(90deg, #818cf8, #c084fc);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
  }

  .sorteo-main-btn:disabled .sorteo-btn-content span {
      background: none;
      -webkit-text-fill-color: #475569;
      color: #475569;
  }

  .sorteo-btn-content [data-icon] {
    width: 1.5rem;
    height: 1.5rem;
    color: #a855f7;
  }

  .sorteo-main-btn:disabled .sorteo-btn-content [data-icon] {
      color: #475569;
  }

  .sorteo-history {
    margin-top: 3rem;
  }

  .sorteo-history-container {
    border-top: 1px solid var(--sorteo-border);
    padding-top: 2rem;
  }

  .sorteo-history-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--sorteo-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
  }

  .sorteo-history-title [data-icon] {
    width: 1.25rem;
    height: 1.25rem;
    opacity: 0.5;
  }

  .sorteo-history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .sorteo-no-winners {
    font-size: 0.875rem;
    font-style: italic;
    color: var(--sorteo-text-muted);
  }

  .sorteo-history-item {
    background: var(--sorteo-card);
    border: 1px solid var(--sorteo-border);
    border-radius: 9999px;
    padding: 0.375rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sorteo-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    animation: zoom-in 0.3s ease-out;
  }

  .sorteo-history-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--sorteo-success);
  }

  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border-width: 0;
  }

  .hidden { display: none; }

  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
  }

  @keyframes ping-slow {
    0% {
      transform: scale(1);
      opacity: 0.5;
    }
    100% {
      transform: scale(1.5);
      opacity: 0;
    }
  }

  .animate-ping-slow {
    animation: ping-slow 1s cubic-bezier(0, 0, 0.2, 1) infinite;
  }

  @keyframes zoom-in {
    0% {
      opacity: 0;
      transform: scale(0.95);
    }
    100% {
      opacity: 1;
      transform: scale(1);
    }
  }

  .animate-zoom-in {
      animation: zoom-in 0.5s ease-out both;
  }

  .sorteo-confetti-particle {
      position: absolute;
      width: 8px;
      height: 8px;
      border-radius: 50%;
      z-index: 50;
      left: 50%;
      top: 50%;
      opacity: 1;
      transform: translate(0, 0) rotate(0deg) scale(0.5);
      animation: confetti-fly 1.5s cubic-bezier(0.1, 1, 0.2, 1) forwards;
  }

  @keyframes confetti-fly {
      to {
          transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(1);
          opacity: 0;
      }
  }

  .custom-scrollbar::-webkit-scrollbar {
    width: 4px;
  }
  .custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
  }
  .custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--sorteo-border);
    border-radius: 10px;
  }