
  :root{
    --gap: 18px;
    --panel-radius: 12px;
    --shadow: 0 10px 25px rgba(0,0,0,0.15);
  }

  * { box-sizing: border-box; }

  .magazine-page {
    min-height: calc(100vh - 120px);
    background: #f0f0f0;
    padding: clamp(12px, 2vw, 22px);
  }

  /* Desktop/tablet default layout */
  .magazine-layout{
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--gap);
    align-items: start;
  }

  .magazine-list {
    background: #fff;
    border-radius: var(--panel-radius);
    padding: 12px;
    box-shadow: var(--shadow);
    max-height: calc(100vh - 170px);
    overflow: auto;
    position: sticky;
    top: 16px;
  }

  .magazine-list h3 {
    margin: 8px 6px 12px;
    font-size: 1.1rem;
  }

  .magazine-item {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #222;
    margin-bottom: 8px;
    background: #f7f7f7;
    user-select: none;
    word-break: break-word;
  }

  .magazine-item:hover { background: #ececec; }
  .magazine-item.active { background: #dfe7ff; font-weight: 700; }

  .magazine-container {
    width: 100%;
    border: clamp(8px, 1.3vw, 15px) solid #333;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    background: #fff;
    position: relative;

    /* Responsive height that behaves on phones/tablets/laptops */
    height: clamp(420px, 70vh, 720px);
  }

  .magazine-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
  }

  .magazine-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(51, 51, 51, 0.85);
    color: #fff;
    padding: 10px 12px;
    z-index: 2;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap; /* key for small screens */
  }

  .magazine-header span{
    font-size: clamp(1rem, 2vw, 1.2rem);
    font-weight: 700;
  }

  /* From Uiverse.io by Creatlydev (kept, but made responsive-friendly) */
  .button {
    line-height: 1;
    background-color: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding: 0.75em 1em;
    padding-right: 1.25em;
    color: #fff;
    border: 1px solid transparent;
    font-weight: 700;
    border-radius: 2em;
    font-size: 1rem;
    box-shadow: 0 0.7em 1.5em -0.5em hsla(249, 62%, 51%, 0.745);
    transition: transform 0.3s;
    background: linear-gradient(
      90deg,
      rgba(77, 54, 208, 1) 0%,
      rgba(132, 116, 254, 1) 100%
    );
    white-space: nowrap;
  }

  .button:hover { border-color: #f4f5f2; }
  .button:active { transform: scale(0.98); }

  .empty-state {
    padding: 90px 20px 20px;
    text-align: center;
  }

  .hint { opacity: 0.8; }

  /* ====== Responsive breakpoints ====== */

  /* Tablets (narrower) */
  @media (max-width: 900px){
    .magazine-layout{
      grid-template-columns: 240px 1fr;
    }
    .magazine-list{
      max-height: calc(100vh - 190px);
    }
  }

  /* Phones + small tablets: stack vertically */
  @media (max-width: 720px){
    .magazine-layout{
      grid-template-columns: 1fr;
    }

    /* Make list behave like a horizontal scroller instead of a tall sidebar */
    .magazine-list{
      position: static;
      max-height: none;
      overflow: hidden;
      padding-bottom: 10px;
    }

    .magazine-list-items{
      display: flex;
      gap: 10px;
      overflow-x: auto;
      padding: 6px;
      scroll-snap-type: x mandatory;
      -webkit-overflow-scrolling: touch;
    }

    .magazine-item{
      margin-bottom: 0;
      min-width: 220px;
      scroll-snap-align: start;
    }

    .magazine-container{
      height: clamp(420px, 75vh, 720px);
    }
  }

  /* Very small phones */
  @media (max-width: 420px){
    .magazine-item{
      min-width: 180px;
      padding: 10px;
      font-size: 0.95rem;
    }
    .button{
      font-size: 0.95rem;
      padding: 0.7em 0.9em;
    }
  }

