/* ===== Hamburger menu (top-right) ===== */

/* Hamburger position is controlled by common.css via #ui-hamburger.
   So here we only define stacking/structure, not top/right. */
#mode-menu-container {
  position: relative;
  z-index: 1;
}


#hamburger-btn {
  font-size: 1.6rem;
  background: #ffffffdd;
  border: 1px solid #aaa;
  border-radius: 8px;
  padding: 6px 10px;
}

#mode-menu {
  position: absolute;
  top: 100%;
  right: 0;
  display: none;

  margin-top: 8px;
  background: #ffffffdd;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 6px 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

#mode-menu button {
  display: block;
  width: 100%;
  margin: 4px 0;
  padding: 6px 10px;
  font-size: 1rem;
  border-radius: 6px;
}

#mode-menu button.active {
  background: #0275d8;
  color: #fff;
}

/* ===== ruby ===== */
ruby rt { font-size: 0.6em; color: #555; }

/* ---------------------------------------
   PRINT/PDF: hide UI, show inline figures
--------------------------------------- */
@media print {
  /* 画面用UIは印刷しない */
  #ui-topbar,
  #ui-controls,
  #ui-downloads,
  #mode-menu,
  #hamburger-btn,
  .controls,
  .top-controls,
  nav,
  header {
    display: none !important;
  }

  /* pdf=1 のときは画像figureを必ず印刷に乗せる */
  body.pdf-mode figure.pdf-inline-figure,
  body.pdf-mode figure.pdf-inline-figure img,
  body.pdf-mode figure.pdf-inline-figure figcaption {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  /* 念のためサイズ制限（縦横比維持） */
  body.pdf-mode figure.pdf-inline-figure img {
    max-width: 100% !important;
    height: auto !important;
    max-height: 25vh !important;
    object-fit: contain !important;
  }

  /* 空行を減らす（任意） */
  body.pdf-mode p:empty {
    display: none !important;
  }
}


/* ============================
   Popup Dictionary (HYQ)
   ============================ */

#zw-popup {
  position: fixed;
  z-index: 9999;
  max-width: min(520px, calc(100vw - 24px));
  background: rgba(20, 20, 22, 0.96);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
  font-size: 15px;
  line-height: 1.35;
  display: none;
}

#zw-popup.zw-show { display: block; }

#zw-popup .zw-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 6px;
}

#zw-popup .zw-hz {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

#zw-popup .zw-hz .zw-trad {
  opacity: 0.75;
  font-weight: 600;
  margin-left: 8px;
}

#zw-popup .zw-pron {
  font-size: 14px;
  opacity: 0.95;
  white-space: nowrap;
}

#zw-popup .zw-mean {
  font-size: 14px;
  opacity: 0.95;
}

.zw-pron-both {
  line-height: 1.35;
}

#zw-popup .zw-pron {
  line-height: 1.45;
  letter-spacing: 0.02em;
}

#zw-popup .zw-debug-pattern {
  margin-top: 0.35em;
  font-size: 0.78em;
  opacity: 0.82;
}

#zw-popup .zw-debug-rule {
  font-size: 0.72em;
  opacity: 0.62;
}

#zw-popup .zw-pron .zw-tone-1,
#zw-popup .zw-pron .zw-tone-2,
#zw-popup .zw-pron .zw-tone-3,
#zw-popup .zw-pron .zw-tone-4,
#zw-popup .zw-pron .zw-tone-5 {
  display: inline-block;
  margin-right: 0.18em;
}

/* tone coloring (pinyin like: ni3 hao3) */
.zw-tone-1 { color: #ff6666; }
.zw-tone-2 { color: #66dd66; }
.zw-tone-3 { color: #66aaff; }
.zw-tone-4 { color: #cc88ff; }
.zw-tone-5 { color: #dddddd; }

/* highlight when cycling */
.zw-focus {
  outline: 2px solid rgba(255, 208, 0, 0.8);
  border-radius: 4px;
}

/* small button style if we inject control */
#btn-zw-next {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.25);
  color: inherit;
  cursor: pointer;
}

#btn-zw-next:active { transform: translateY(1px); }

