* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: #0d0d0d;
  background-image: radial-gradient(#1a1a1a 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'Rubik', Arial, Helvetica, sans-serif;
  overflow: hidden;
}

/* Global utility class for toggling interface elements */
.hidden {
  display: none !important;
}

.scale-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.artboard {
  width: 800px;
  height: 800px;
  position: relative;
  overflow: hidden;
  background-color: #007334;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  border: 6px solid #2a0067;
  border-radius: 8px;
  flex: 0 0 800px;
  user-select: none;
  transition: border-color 0.15s ease;
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.7);
}

.artboard.connected {
  border-color: #58ef79;
}

.view-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 648px;
}

/* --- Redesigned Pairing Onboarding Interface --- */
.onboarding-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 744px; /* Perfectly extends above the base footer */
  background: rgba(13, 13, 13, 0.85); /* Smooth background blur overlay */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
  color: #23405f;
  text-align: center;
}

.onboard-card {
  width: 100%;
  max-width: 580px;
  background: #ebe8c8;
  border: 5px solid #23405f;
  border-radius: 16px;
  padding: 32px 24px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.onboard-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 24px;
}

.onboard-logo {
  width: 72px;
  height: 72px;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.15));
  animation: logo-bounce 2s infinite ease-in-out;
  display: block;
}

@keyframes logo-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.onboarding-screen h2 {
  font-size: 28px;
  font-weight: 900;
  margin: 0 0 10px 0;
  color: #23405f;
  text-transform: uppercase;
  letter-spacing: -0.5px;
}

.onboarding-screen p {
  font-size: 15px;
  line-height: 1.5;
  font-weight: 700;
  margin: 0;
  color: #4a5c6e;
  max-width: 480px;
}

.onboarding-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.pairing-method {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.method-hint {
  font-size: 11px;
  font-weight: 700;
  color: #5d758f;
  text-align: center;
}

/* Primary Automator Pairing Button */
.onboarding-btn.primary-pulse {
  background: #39a150;
  color: white;
  border: 4px solid #23405f;
  border-radius: 12px;
  padding: 14px 28px;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px 0 #1b5327;
  transition: all 0.1s ease;
  width: 100%;
  max-width: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.onboarding-btn.primary-pulse:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #1b5327;
  background: #41b85c;
}

.onboarding-btn.primary-pulse:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #1b5327;
}

/* Dynamic Separator styling */
.method-divider {
  width: 100%;
  max-width: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 4px 0;
}

.divider-line {
  flex: 1;
  height: 3px;
  background: #23405f;
  opacity: 0.25;
}

.divider-text {
  font-size: 11px;
  font-weight: 900;
  color: #23405f;
  letter-spacing: 1px;
  opacity: 0.6;
}

/* Horizontal alignment setup for manual details */
.manual-input-group {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 400px;
}

.manual-input-group .token-input {
  flex: 1;
  height: 50px;
  border: 4px solid #23405f;
  border-radius: 12px;
  font-size: 15px;
  font-family: monospace;
  text-align: left;
  padding: 0 16px;
  font-weight: 900;
  background: white;
  color: #23405f;
  outline: none;
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.05);
}

.manual-input-group .token-input::placeholder {
  color: #8b9eb3;
}

.manual-input-group .onboarding-btn.secondary {
  background: #f3ef00;
  color: #23405f;
  border: 4px solid #23405f;
  border-radius: 12px;
  padding: 0 20px;
  font-size: 15px;
  font-weight: 900;
  height: 50px;
  cursor: pointer;
  box-shadow: 0 5px 0 #23405f;
  transition: all 0.1s;
  white-space: nowrap;
}

.manual-input-group .onboarding-btn.secondary:hover {
  background: #ffff33;
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #23405f;
}

.manual-input-group .onboarding-btn.secondary:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #23405f;
}

/* Connection Active Loader States */
.onboard-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 16px 0;
  width: 100%;
}

.spinner-container {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spice-spinner {
  width: 60px;
  height: 60px;
  border: 6px solid rgba(57, 161, 80, 0.2);
  border-top: 6px solid #39a150;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.pulse-ring {
  position: absolute;
  width: 76px;
  height: 76px;
  border: 3px solid #39a150;
  border-radius: 50%;
  animation: pulse-ring-anim 1.5s cubic-bezier(0.215, 0.610, 0.355, 1) infinite;
  opacity: 0;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse-ring-anim {
  0% {
    transform: scale(0.6);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

.onboarding-btn.cancel-btn {
  background: #cc2244;
  color: white;
  border: 4px solid #23405f;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #7e1224;
  transition: all 0.1s;
}

.onboarding-btn.cancel-btn:hover {
  background: #e62e50;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #7e1224;
}

.onboarding-btn.cancel-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #7e1224;
}

/* --- Tactile Toast Interface Adjustment --- */
.toast-indicator {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  background: #ffef00;
  color: #2a0067;
  border: 4px solid #2a0067;
  border-radius: 12px;
  padding: 14px 28px;
  font-size: 18px;
  font-weight: 900;
  z-index: 100;
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.35), opacity 0.3s;
  pointer-events: none;
  
  /* Flexbox positioning with strict wrapping rules */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: nowrap;
  
  /* Comic Book Accent Shadows */
  box-shadow: 0 8px 0 #2a0067;
}

.toast-indicator.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.hero {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 456px;
  background: url("https://i.ibb.co/RkGxK7Qp/full-resolution-pixelated.png") center center / cover no-repeat;
  border-bottom: 4px solid #23405f;
}

/* Position placement of Rocker Switch in Chassis */
.switch-positioner {
  position: absolute;
  right: 92px;
  top: 130px;
  z-index: 10;
}

/* --- INTEGRATED 3D ROCKER SWITCH (Uiverse.io by ali-hv) --- */
.switch {
  display: block;
  background-color: black;
  width: 150px;
  height: 195px;
  box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.2), 0 0 1px 2px black,
    inset 0 2px 2px -2px white, inset 0 0 2px 15px #47434c,
    inset 0 0 2px 22px black;
  border-radius: 5px;
  padding: 20px;
  perspective: 700px;
}

.switch input {
  display: none;
}

.switch input:checked + .button {
  transform: translateZ(20px) rotateX(25deg);
  box-shadow: 0 -10px 20px #1cff42;
}

.switch input:checked + .button .light {
  animation: flicker 0.2s infinite 0.3s;
}

.switch input:checked + .button .shine {
  opacity: 1;
}

.switch input:checked + .button .shadow {
  opacity: 0;
}

.switch .button {
  display: block;
  transition: all 0.3s cubic-bezier(1, 0, 1, 1);
  transform-origin: center center -20px;
  transform: translateZ(20px) rotateX(-25deg);
  transform-style: preserve-3d;
  background-color: #03a614;
  height: 100%;
  position: relative;
  cursor: pointer;
  background: linear-gradient(
    #02961d 0%,
    #005e02 30%,
    #006300 70%,
    #009100 100%
  );
  background-repeat: no-repeat;
}

.switch .button::before {
  content: "";
  background: linear-gradient(
        rgba(255, 255, 255, 0.8) 10%,
        rgba(255, 255, 255, 0.3) 30%,
        #055c00 75%,
        #022e00
      )
      50% 50%/97% 97%,
    #00b00f;
  background-repeat: no-repeat;
  width: 100%;
  height: 50px;
  transform-origin: top;
  transform: rotateX(-90deg);
  position: absolute;
  top: 0;
}

.switch .button::after {
  content: "";
  background-image: linear-gradient(#006600, #003008);
  width: 100%;
  height: 50px;
  transform-origin: top;
  transform: translateY(50px) rotateX(-90deg);
  position: absolute;
  bottom: 0;
  box-shadow: 0 50px 8px 0px black, 0 80px 20px 0px rgba(0, 0, 0, 0.5);
}

.switch .light {
  opacity: 0;
  animation: light-off 1s;
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(#7dff83, #1bff17 40%, transparent 70%);
}

.switch .dots {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(transparent 30%, rgba(6, 97, 0, 0.7) 70%);
  background-size: 10px 10px;
}

/* --- TACTILE ROCKER SWITCH PERSPECTIVE & PHYSICAL MOTIONS --- */

.switch .button {
  display: block;
  transition: all 0.3s cubic-bezier(1, 0, 1, 1);
  transform-origin: center center -20px;
  /* OFF State: Top (Zero) is pressed inward, Bottom (One) pops outward */
  transform: translateZ(20px) rotateX(25deg); 
  transform-style: preserve-3d;
  background-color: #03a614;
  height: 100%;
  position: relative;
  cursor: pointer;
  background: linear-gradient(
    #02961d 0%,
    #005e02 30%,
    #006300 70%,
    #009100 100%
  );
  background-repeat: no-repeat;
}

.switch input:checked + .button {
  /* ON State: Bottom (One) is pressed inward, Top (Zero) pops outward */
  transform: translateZ(20px) rotateX(-25deg);
  /* Green active glow shifts to the bottom terminal */
  box-shadow: 0 10px 20px #1cff42;
}

.switch .characters {
  position: absolute;
  width: 100%;
  height: 100%;
  /* 0 (Zero / OFF) is anchored at the top (20% vertical) */
  /* 1 (One / ON) is anchored at the bottom (80% vertical) */
  background: radial-gradient(
        circle,
        transparent 50%,
        white 52%,
        white 70%,
        transparent 72%
      )
      50% 20%/33% 25%,
    linear-gradient(white, white) 
      50% 80%/5% 20%;
  background-repeat: no-repeat;
}

.switch .shine {
  transition: all 0.3s cubic-bezier(1, 0, 1, 1);
  opacity: 0.3;
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(white, transparent 3%) 50% 50%/97% 97%,
    linear-gradient(
        rgba(255, 255, 255, 0.5),
        transparent 50%,
        transparent 80%,
        rgba(255, 255, 255, 0.5)
      )
      50% 50%/97% 97%;
  background-repeat: no-repeat;
}

.switch .shadow {
  transition: all 0.3s cubic-bezier(1, 0, 1, 1);
  opacity: 1;
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(transparent 70%, rgba(0, 0, 0, 0.8));
  background-repeat: no-repeat;
}

@keyframes flicker {
  0% { opacity: 1; }
  80% { opacity: 0.8; }
  100% { opacity: 1; }
}

@keyframes light-off {
  0% { opacity: 1; }
  80% { opacity: 0; }
}

/* Control Layout Styling */
.controls {
  position: absolute;
  left: 0;
  top: 456px;
  width: 100%;
  height: 288px;
  background: transparent;
}

.button-row {
  position: absolute;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 58px;
}

.btn-wrapper {
  position: relative;
  width: 278px;
  height: 105px;
}

.big-btn {
  width: 100%;
  height: 100%;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 900;
  letter-spacing: -1px;
  cursor: pointer;
  border: 4px solid #23405f;
  outline: none;
  transition: transform 0.15s ease, background-color 0.15s;
}

.big-btn:hover {
  transform: translateY(-2px);
}

.big-btn:active {
  transform: translateY(1px);
}

.opera {
  background: #39a150;
  color: rgba(0, 0, 0, 0.45);
}

.opera.active {
  background: #58ef79;
  color: #000000;
}

.warp {
  background: #9d9900;
  color: rgba(27, 15, 127, 0.45);
}

.warp.active {
  background: #f4ef00;
  color: #1b0f7f;
}

.badge-recommended {
  position: absolute;
  top: -16px;
  right: -10px;
  background: #ff3366;
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 8px;
  border: 3px solid #2a0067;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 10;
  pointer-events: none;
}

.settings-top-bar {
  width: 736px;
  margin: 28px auto 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-back-btn {
  background: #ebe8c8;
  border: 3px solid #23405f;
  color: #23405f;
  font-size: 16px;
  font-weight: 900;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
  transition: background-color 0.1s;
}

.settings-back-btn:hover {
  background: #dfdac0;
}

.settings-title {
  color: #ffef00;
  font-family: "Courier New", monospace;
  font-size: 22px;
  font-weight: 900;
  text-align: right;
  flex-grow: 1;
}

.panels {
  position: absolute;
  top: 90px;
  left: 32px;
  width: 736px;
  height: 514px;
  display: grid;
  grid-template-columns: 1fr 198px;
  gap: 16px;
  justify-items: stretch;
  transition: grid-template-columns 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.panel {
  background: #ebe8c8;
  border: 3px solid #23405f;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel .head {
  height: 52px;
  background: #7db08d;
  color: #143c2c;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  font-family: "Courier New", monospace;
  font-size: 28px;
  font-weight: 900;
  border-bottom: 3px solid #23405f;
}

.panel.right .head {
  font-size: 29px;
  text-transform: lowercase;
  justify-content: center;
}

.notepad-area {
  width: 100%;
  height: 100%;
  min-height: 250px;
  flex: 1;
  background: #fdf6e2;
  border: 3px solid #23405f;
  border-radius: 6px;
  font-family: "Courier New", monospace;
  font-weight: 900;
  font-size: 16px;
  line-height: 24px;
  color: #143c2c;
  padding: 8px 15px;
  resize: none;
  outline: none;
  background-image: linear-gradient(rgba(35, 64, 95, 0.12) 1px, transparent 1px);
  background-size: 100% 24px;
}

.notepad-hint {
  font-family: "Courier New", monospace;
  font-size: 13px;
  font-weight: 900;
  color: #143c2c;
  text-align: center;
  margin-top: 4px;
}

.toggle-editor-btn {
  background: #ebe8c8;
  border: 2px solid #23405f;
  border-radius: 6px;
  color: #23405f;
  font-family: "Courier New", monospace;
  font-size: 14px;
  font-weight: 900;
  padding: 4px 10px;
  cursor: pointer;
  outline: none;
  transition: background-color 0.1s;
}

.toggle-editor-btn:hover {
  background: #dfdac0;
}

.panel-inner {
  flex: 1;
  padding: 18px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.panel-inner::-webkit-scrollbar {
  width: 10px;
}
.panel-inner::-webkit-scrollbar-track {
  background: #dfdac0;
  border-left: 2px solid #23405f;
}
.panel-inner::-webkit-scrollbar-thumb {
  background: #7db08d;
  border: 2px solid #23405f;
  border-radius: 4px;
}

.rule-list {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
}

.rule-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 2px dotted rgba(35, 64, 95, 0.3);
  font-family: "Courier New", monospace;
  font-weight: 900;
  font-size: 18px;
  color: #143c2c;
}

.btn-delete-rule {
  background: none;
  border: none;
  color: #cc2244;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  padding: 0 4px;
}

.btn-delete-rule:hover {
  color: #ff0000;
}

.add-rule-form {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.add-rule-form input {
  flex: 1;
  height: 42px;
  padding: 0 12px;
  border: 3px solid #23405f;
  border-radius: 6px;
  background: #ffffff;
  font-family: "Courier New", monospace;
  font-weight: 900;
  font-size: 16px;
  color: #143c2c;
  outline: none;
}

.add-rule-form button {
  width: 46px;
  height: 42px;
  background: #7db08d;
  border: 3px solid #23405f;
  border-radius: 6px;
  color: #143c2c;
  font-size: 24px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-rule-form button:hover {
  background: #5e9570;
}

.location-option {
  font-family: "Courier New", monospace;
  font-weight: 900;
  font-size: 16px;
  color: #143c2c;
  padding: 10px;
  border-bottom: 2px dotted rgba(35, 64, 95, 0.3);
  cursor: pointer;
}

.location-option:hover {
  background: rgba(125, 176, 141, 0.2);
}

.location-option.selected {
  background: #7db08d;
  color: #ffffff;
  border-radius: 4px;
}

.panels.warp-active {
  grid-template-columns: 1fr;
  justify-items: center;
}

.panels.warp-active .panel.left {
  width: 530px; 
  height: 100%;
}

.panels.warp-active .panel.right {
  display: none !important;
}

.spice-line {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 92px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ffef00;
  font-size: 37px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
  padding: 5px 15px;
  border-radius: 8px;
  transition: transform 0.15s ease;
}

.spice-line:hover {
  transform: translateX(-50%) scale(1.02);
}

.spice-line:hover .spice-star-svg {
  transform: rotate(90deg);
}

.footer {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 56px;
  background: #2a0067;
  color: #ffef00;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2px;
  border-top: 3px solid rgba(0, 0, 0, 0.15);
}

.footer a {
  color: #ffef00;
  text-decoration: underline;
  margin: 0 4px;
}

.footer a:hover {
  color: #ffffff;
}