@media only screen and (max-width: 640px) {
  body {
    overflow-x: hidden;
  }

  .header {
    height: 104px;
    background-size: cover;
  }

  .header-inner {
    width: calc(100% - 18px);
  }

  .site-brand .logo_border {
    display: block;
    width: 48px;
    height: 48px;
    min-width: 48px;
  }

  .site-title {
    font-size: 19px;
    line-height: 1.05;
  }

  .site-menu-toggle {
    display: block;
  }

  .site-nav {
    display: none;
  }

  .header.menu-open .site-nav {
    display: flex;
  }

  div.main {
    top: 104px;
  }

  #emlekhely_editor {
    top: 104px;
    max-width: 100vw;
  }

  #emlekhely_editor .temeto-hatter {
    width: 100vw;
    height: min(800px, calc(100vw * 1.3333));
    min-height: 640px;
    overflow: hidden;
  }

  #emlekhely_editor .sirkov-container {
    transform-origin: top center;
    top: 116px;
  }

  #emlekhely_editor .sirkovek,
  #emlekhely_editor .kiegeszitok {
    top: auto;
    bottom: 12px;
    width: calc(50vw - 18px);
    max-height: 132px;
    display: none;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding: 6px;
  }

  #emlekhely_editor .temeto-hatter.edit .sirkovek,
  #emlekhely_editor .temeto-hatter.edit .kiegeszitok:not(.hide) {
    display: block;
  }

  #emlekhely_editor .sirkovek { left: 6px; }
  #emlekhely_editor .kiegeszitok { right: 6px; left: auto; }

  .sirkovek .sirk,
  #kellekek .item-template {
    display: inline-block;
    width: 68px;
    height: 96px !important;
    margin: 0 4px;
    vertical-align: top;
  }

  #kellekek .item-template img {
    max-width: 60px;
    max-height: 90px;
  }

  .candle-list-panel {
    margin: 0 8px 88px;
  }

  .candle-list {
    grid-template-columns: 1fr;
  }

  .app-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .app-modal {
    width: 100%;
    max-height: 88vh;
    border-radius: 16px 16px 0 0;
  }

  .candle-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .candle-category-header {
    gap: 4px;
  }

  .candle-category-tab {
    padding: 5px 8px;
    font-size: 12px;
  }

  footer .gombok {
    bottom: 54px;
    left: 50%;
    width: calc(100vw - 10px);
  }

  footer .gombok button {
    padding: 8px 10px;
    font-size: 13px;
  }
}

/* Mobil fejléc coin javítás - a style_640.css később töltődik be, ezért itt is rögzítjük. */
@media only screen and (max-width: 640px) {
  .header-inner {
    justify-content: flex-start;
    gap: 8px;
    overflow: visible;
  }

  .site-brand {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 154px);
  }

  .site-brand .header-h1,
  .site-brand .header-h1 h1 {
    min-width: 0;
  }

  .site-brand .header-h1 h1 {
    margin: 0;
    font-size: clamp(17px, 4.2vw, 24px);
    line-height: .96;
  }

  .coin-box {
    order: 2;
    flex: 0 0 auto;
    margin-left: auto;
    max-width: 98px;
    padding: 6px 9px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .site-menu-toggle {
    order: 3;
    flex: 0 0 42px;
    width: 42px;
    height: 38px;
    margin-left: auto;
  }

  .site-nav {
    order: 4;
  }
}

@media only screen and (max-width: 380px) {
  .site-brand {
    max-width: calc(100% - 136px);
    gap: 7px;
  }

  .site-brand .logo_border {
    width: 42px;
    height: 42px;
    min-width: 42px;
  }

  .site-brand .header-h1 h1 {
    font-size: 16px;
  }

  .coin-box {
    max-width: 82px;
    padding: 5px 7px;
    font-size: 12px;
  }

  .coin-icon {
    font-size: 14px;
  }

  .site-menu-toggle {
    flex-basis: 38px;
    width: 38px;
    height: 36px;
    margin-left: auto;
  }
}

@media only screen and (max-width: 330px) {
  .coin-box {
    max-width: 72px;
  }

  .coin-box .coin-icon {
    display: none;
  }
}


/* Mobil szerkesztő füles panel végleges felülírás
   Csak telefonos nézetben aktív; a tablet/desktop alapstílusokat nem érinti. */
@media only screen and (max-width: 640px) {
  #emlekhely_editor .temeto-hatter.edit .mobile-editor-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 50%;
    width: 34px;
    min-height: 132px;
    height: auto;
    padding: 10px 4px;
    border: 0;
    border-radius: 0 14px 14px 0;
    background: var(--linkek);
    color: var(--vilagos);
    box-shadow: 0 4px 18px rgba(0,0,0,.25);
    z-index: 130;
    cursor: pointer;
    writing-mode: horizontal-tb;
    text-orientation: initial;
    letter-spacing: 0;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    transform: translateY(-50%);
    -webkit-tap-highlight-color: transparent;
  }

  #emlekhely_editor .temeto-hatter.edit .mobile-editor-tab-char {
    display: block;
    line-height: 1.05;
  }

  #emlekhely_editor .temeto-hatter.edit .mobile-editor-tab-sirkovek {
    left: 0;
    right: auto;
    border-radius: 0 14px 14px 0;
  }

  #emlekhely_editor .temeto-hatter.edit .mobile-editor-tab-kiegeszitok {
    right: 0;
    left: auto;
    border-radius: 14px 0 0 14px;
  }

  #emlekhely_editor.mobile-panel-sirkovek .temeto-hatter.edit .mobile-editor-tab-sirkovek,
  #emlekhely_editor.mobile-panel-kiegeszitok .temeto-hatter.edit .mobile-editor-tab-kiegeszitok {
    display: none !important;
  }

  #emlekhely_editor .temeto-hatter.edit .mobile-editor-shade {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.28);
    z-index: 118;
  }

  #emlekhely_editor.mobile-panel-sirkovek .mobile-editor-shade,
  #emlekhely_editor.mobile-panel-kiegeszitok .mobile-editor-shade {
    display: block;
  }

  #emlekhely_editor .temeto-hatter.edit .sirkovek,
  #emlekhely_editor .temeto-hatter.edit .kiegeszitok {
    display: block;
    position: fixed;
    top: 0;
    bottom: 0;
    width: min(82vw, 320px);
    height: auto;
    max-height: none;
    padding: 18px 12px 22px;
    overflow-x: hidden;
    overflow-y: auto;
    white-space: normal;
    border-radius: 0;
    opacity: .97;
    background: var(--linkek);
    box-shadow: 0 0 26px rgba(0,0,0,.32);
    z-index: 125;
    box-sizing: border-box;
    transition: transform .22s ease;
    -webkit-overflow-scrolling: touch;
  }

  #emlekhely_editor .temeto-hatter.edit .sirkovek {
    left: 0;
    right: auto;
    transform: translateX(-105%);
  }

  #emlekhely_editor .temeto-hatter.edit .kiegeszitok {
    right: 0;
    left: auto;
    transform: translateX(105%);
  }

  #emlekhely_editor.mobile-panel-sirkovek .temeto-hatter.edit .sirkovek,
  #emlekhely_editor.mobile-panel-kiegeszitok .temeto-hatter.edit .kiegeszitok {
    transform: translateX(0);
  }

  #emlekhely_editor .temeto-hatter.edit .kiegeszitok.hide {
    display: block !important;
    transform: translateX(105%);
  }

  #emlekhely_editor.mobile-panel-kiegeszitok .temeto-hatter.edit .kiegeszitok.hide {
    transform: translateX(0);
  }

  #emlekhely_editor .sirkovek .sirk,
  #emlekhely_editor .kiegeszitok .kiegs {
    display: block;
    width: 100%;
    height: 86px !important;
    margin: 0 0 12px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 14px;
    background-color: rgba(255,255,255,.12);
  }

  #emlekhely_editor .kiegeszitok .item-template,
  #emlekhely_editor .kiegeszitok .kiegs .item-template {
    margin-left: auto;
    margin-right: auto;
  }
}

@media only screen and (max-width: 380px) {
  #emlekhely_editor .temeto-hatter.edit .sirkovek,
  #emlekhely_editor .temeto-hatter.edit .kiegeszitok {
    width: min(86vw, 300px);
    padding: 16px 10px 20px;
  }

  #emlekhely_editor .temeto-hatter.edit .mobile-editor-tab {
    width: 30px;
    min-height: 118px;
    font-size: 12px;
    padding: 9px 3px;
  }

  #emlekhely_editor .sirkovek .sirk,
  #emlekhely_editor .kiegeszitok .kiegs {
    height: 78px !important;
  }
}

/* Mobil görgetés javítás nézet módban
   A style_640.css később töltődik be, ezért itt is rögzítjük. */
@media only screen and (max-width: 640px) {
  #emlekhely_editor .temeto-hatter:not(.edit) .sirkov-container,
  #emlekhely_editor .temeto-hatter:not(.edit) #dropzoneWrap,
  #emlekhely_editor .temeto-hatter:not(.edit) #dropzoneID,
  #emlekhely_editor .temeto-hatter:not(.edit) #dropzoneID [data-fname],
  #emlekhely_editor .temeto-hatter:not(.edit) #graveCandles,
  #emlekhely_editor .temeto-hatter:not(.edit) #graveCandles .grave-item,
  #emlekhely_editor .temeto-hatter:not(.edit) #dropzoneID > .grave-positioned[data-ehk-id] {
    touch-action: pan-y;
  }
}
