html,
body,
.container-main {
  margin: 0;
}

body {
  background: #fff;
  direction: rtl;
}

.container-main {
  max-width: 970px;
  margin: 0 auto;
  padding: 0 8px 10px;
}

#myCanvas {
  background-color: #5bc0de;
  display: block;
  width: 600px;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  touch-action: none;
  position: relative;
  z-index: 2;
}

.the-canvas {
  position: relative;
  z-index: 1;
}

.the-controls,
.the-canvas,
.todo {
  padding: 0;
}

.todo {
  width: 620px;
  margin-right: auto;
  margin-left: auto;
}

.btn {
  cursor: pointer;
}

.badge {
  background-color: #5bc0de;
}

.ui-slider-handle {
  background-color: #f0ad4e !important;
}

#demo-warning.glyphicon {
  color: #f0ad4e;
  font-size: 1.5em;
  float: left;
}

.list-group-item input {
  float: left;
  margin-right: 5px;
}

.blink {
  animation: blinker 1s linear infinite;
}

@keyframes blinker {
  50% {
    opacity: 0;
  }
}

.hidden {
  display: none !important;
}

.maze-main-title {
  text-align: center;
  font-size: 32px;
 margin: 0 0 4px;
  line-height: 1.2;
}

.maze-top-text {
  text-align: center;
  margin: 6px auto 12px;
  font-size: 14px;
  line-height: 1.7;
  color: #333;
  width: 95%;
}

.maze-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  direction: ltr;
}

.the-controls,
.the-canvas {
  float: none !important;
}

.the-controls {
  width: 310px;
  flex: 0 0 310px;
}

.the-canvas {
  width: 620px;
  flex: 0 0 620px;
}

.top-panel,
.instructions-panel {
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: none;
}

.top-panel-body,
.controls-buttons-body,
.instructions-box,
.maze-seo,
.maze-faq,
.maze-win,
.maze-win-box {
  direction: rtl;
}

.top-panel-body {
  padding-top: 14px;
  padding-bottom: 8px;
}

.controls-buttons-body {
  padding-top: 6px !important;
  text-align: center;
}

.instructions-box {
  line-height: 1.8;
  text-align: center;
}

.top-panel-title {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.2;
  text-align: center;
}

.difficulty-line {
  margin: 0 0 12px;
  font-size: 22px;
}

.difficulty-line-small {
  margin: 0 0 8px;
  font-size: 12px;
  text-align: center;
  color: #555;
}

.difficulty-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.difficulty-btn {
  appearance: none;
  border: 1px solid #6ea3eb;
  background: #cfe3ff;
  color: #000;
  border-radius: 18px;
  padding: 10px 16px;
  font-size: 15px;
  line-height: 1.2;
  min-width: 72px;
  transition: all 0.18s ease;
  box-shadow:
    0 3px 8px rgba(0,0,0,0.12),
    inset 0 1px 0 rgba(255,255,255,0.95);
  outline: none;
}

.difficulty-btn:hover {
  background: #bdd8ff;
  border-color: #4f86db;
  color: #000;
  transform: translateY(-1px);
  box-shadow:
    0 5px 12px rgba(0,0,0,0.16),
    inset 0 1px 0 rgba(255,255,255,0.95);
}

.difficulty-btn.active {
  border-color: #4f86db;
  background: #fff;
  color: #000;
  box-shadow:
    0 4px 10px rgba(79,134,219,0.18),
    0 0 0 3px rgba(79,134,219,0.14);
}

/* עטיפות הכפתורים */
.controls-buttons-body .btn-group,
.controls-buttons-body .print-wrap,
.controls-buttons-body .btn-group.btn-group-justified,
.controls-buttons-body .btn-group.btn-group-justified > .btn-group {
  display: block !important;
  width: 100% !important;
  margin: 0 0 12px 0 !important;
  text-align: center;
}

.controls-buttons-body .btn-group:last-child,
.controls-buttons-body .print-wrap:last-child,
.controls-buttons-body .btn-group.btn-group-justified:last-child {
  margin-bottom: 0 !important;
}

/* הכפתורים עצמם */
.action-btn,
#create-instant,
#print-maze,
#solve-animate,
#toggle-character-picker {
  display: block !important;
  width: 200px !important;
  max-width: 100%;
  margin: 0 auto !important;
  float: none !important;
  border-radius: 8px;
  font-size: 15px;
}

#toggle-character-picker {
  background: #337ab7 !important;
  border-color: #2e6da4 !important;
  color: #fff !important;
}

.maze-stage {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.play-hint {
  text-align: center;
  font-size: 13px;
  color: #555;
  margin: 10px 0 8px;
}

.maze-controls-pad {
  width: 210px;
  margin: 0 auto;
  text-align: center;
}

.move-middle {
  display: flex;
  flex-direction: row;
  direction: ltr;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.move-btn {
  width: 62px;
  height: 50px;
  border: 1px solid #cfd8e3;
  background: #f8fafc;
  border-radius: 12px;
  font-size: 22px;
  font-weight: bold;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.move-btn:hover {
  background: #eef4ff;
}

.move-up {
  display: block;
  margin: 0 auto;
}

.maze-win {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  z-index: 5;
  padding: 14px;
  text-align: center;
}

.maze-win.hidden {
  display: none !important;
}

.maze-win-box {
  width: min(92%, 340px);
  background: #fff;
  border: 2px solid #dbeafe;
  border-radius: 18px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.16);
  padding: 20px 16px;
  text-align: center;
  unicode-bidi: plaintext;
}

.maze-win-icon {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 8px;
}

.maze-win-title {
  font-size: 28px;
  font-weight: bold;
  color: #2563eb;
  margin-bottom: 6px;
}

.maze-win-text {
  font-size: 16px;
  color: #333;
  margin-bottom: 14px;
}

.win-btn {
  width: 190px;
  max-width: 100%;
  margin: 6px auto 0;
  display: block;
  border-radius: 10px;
}

.character-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 9999;
  padding: 24px 10px;
}

.character-picker-overlay.hidden {
  display: none !important;
}

.character-picker-modal {
  width: min(760px, 96vw);
  max-height: 82vh;
  overflow: auto;
  background: #fff;
  border: 1px solid #d7dfec;
  border-radius: 18px;
  padding: 16px 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}

.character-picker-title,
.character-picker-subtitle {
  text-align: center;
}

.character-picker-title {
  font-size: 18px;
  font-weight: bold;
  color: #222;
  margin-bottom: 6px;
}

.character-picker-subtitle {
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
}

.character-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(44px, 44px));
  justify-content: center;
  gap: 8px;
}

.character-option {
  width: 44px;
  height: 44px;
  border: 1px solid #cfd8e3;
  background: #fff;
  border-radius: 12px;
  font-size: 26px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.character-option.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.poop-option {
  grid-row: 2;
}

.maze-seo {
  max-width: 920px;
  margin: 28px auto 10px;
  padding: 0 10px;
  line-height: 1.9;
  color: #222;
  text-align: center;
}

.maze-seo h2 {
  font-size: 26px;
  margin: 0 0 10px;
}

.maze-seo h3 {
  font-size: 20px;
  margin: 0 0 6px;
}

.maze-seo p {
  margin: 0 0 16px;
  font-size: 18px;
}

.maze-faq {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 8px auto 20px;
}

.faq-item {
  border: 1px solid #e3e7ef;
  border-radius: 12px;
  padding: 14px 12px;
  background: #fff;
}

.maze-big-links {
  text-align: center;
  margin: 18px auto;
}

.maze-big-btn {
  display: inline-block;
  margin: 6px 8px;
  padding: 12px 22px;
  background: #1a5b94;
  color: #fff !important;
  text-decoration: none;
  border-radius: 10px;
  font-size: 18px;
  line-height: 1.4;
  transition: background 0.2s ease;
}

.maze-big-btn:hover {
  background: #134872;
  color: #fff !important;
  text-decoration: none;
}

@media (max-width: 767px) {
  body {
    overflow-x: hidden;
  }

  .container.container-main {
    width: 100%;
    max-width: 100%;
    padding-left: 8px;
    padding-right: 8px;
  }

  .maze-main-title {
    font-size: 20px;
    margin: 8px 0 6px;
    line-height: 1.25;
  }

  .maze-top-text {
    font-size: 13px;
    line-height: 1.8;
    width: 96%;
  }

  .maze-layout {
    display: flex;
    flex-direction: column;
    direction: rtl;
    gap: 0;
  }

  .the-controls,
  .the-canvas,
  .todo,
  #cell-info,
  .col-xs-4,
  .col-xs-8 {
    width: 100% !important;
    flex: none;
    float: none !important;
    padding: 6px;
  }

  .the-canvas {
    order: 1;
  }

  .the-controls {
    order: 2;
  }

  .todo {
    order: 4;
    width: 100%;
  }

  #cell-info {
    order: 3;
  }

  .panel {
    margin-bottom: 12px;
  }

  .top-panel-title {
    font-size: 20px;
  }

  .difficulty-line {
    font-size: 18px;
    text-align: center;
  }

  .difficulty-buttons {
    gap: 6px;
  }

  .difficulty-btn {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    padding: 11px 10px;
    font-size: 15px;
  }

  .difficulty-btn:last-child:nth-child(odd) {
    flex-basis: 100%;
  }

  #myCanvas {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
  }

  .action-btn,
  #create-instant,
  #print-maze,
  #solve-animate,
  #toggle-character-picker {
    width: 165px !important;
  }

  .play-hint {
    font-size: 12px;
    margin: 8px 0 7px;
  }

  .maze-controls-pad {
    width: 190px;
  }

  .move-btn {
    width: 56px;
    height: 46px;
    font-size: 20px;
  }

  .maze-win-box {
    width: min(94%, 310px);
    padding: 16px 12px;
  }

  .maze-win-title {
    font-size: 24px;
  }

  .win-btn {
    width: 170px;
  }

  .character-picker-overlay {
    padding-top: 16px;
  }

  .character-picker-modal {
    width: min(96vw, 640px);
    max-height: 84vh;
    padding: 14px 10px;
  }

  .character-options {
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
  }

  .character-option {
    width: 100%;
    height: 44px;
    font-size: 25px;
  }

  .maze-seo {
    margin-top: 22px;
    padding: 0 8px;
  }

  .maze-seo h2 {
    font-size: 22px;
  }

  .maze-seo h3 {
    font-size: 18px;
  }

  .maze-seo p {
    font-size: 16px;
  }

  .maze-faq {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .maze-big-btn {
    display: block;
    width: 90%;
    max-width: 320px;
    margin: 8px auto;
    font-size: 16px;
    padding: 11px 16px;
  }
}

  .desktop, .mobile {
            display: none;
        }

        @media only screen and (max-width: 768px) {
            .mobile {
                display: block;
            }
        }

        @media only screen and (min-width: 769px) {
            .desktop {
                display: block;
            }
        }
        .responsive-div {
            width: 100%;
        }

        @media only screen and (max-width: 768px) {
            .responsive-div {
                width: 100%; 
            }
        }

        @media only screen and (min-width: 769px) {
            .responsive-div {
                width: 800px; 
                margin: 0 auto; 
            }
        }
		
		.desktop > iframe {
  display: block;
  margin: 0 auto;
}

.ad-loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(6, 40, 61, 0.96);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.ad-loading-overlay.show {
  display: flex;
}

.ad-loading-text {
  color: #fff;
  font-size: 24px;
  font-weight: bold;
  text-align: center;
}

.ad-ring {
  width: 54px;
  height: 54px;
  border: 5px solid rgba(14, 165, 233, 0.3);
  border-top-color: #0ea5e9;
  border-radius: 50%;
  animation: adSpin 0.8s linear infinite;
}

@keyframes adSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 767px) {
  .ad-loading-text {
    font-size: 20px;
  }
}
