/* Isolated styles for the Tally consultation modal. Scoped under #tally-modal-*
   selectors only — nothing here targets elements outside the modal. */

#tally-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(51, 47, 40, 0.55);
  padding: clamp(16px, 4vw, 40px);
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
}

#tally-modal-overlay.tally-modal-open {
  display: flex;
}

#tally-modal-panel {
  background: #fdfbf6;
  border: 1px solid #ece5d8;
  border-radius: 20px;
  box-shadow: 0 24px 60px -20px rgba(51, 47, 40, 0.45);
  width: min(94vw, 640px);
  max-height: min(88vh, 88dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

#tally-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px clamp(18px, 3vw, 28px);
  border-bottom: 1px solid #ece5d8;
  flex-shrink: 0;
}

#tally-modal-title {
  font-family: 'Zen Old Mincho', 'Noto Serif TC', serif;
  font-weight: 500;
  font-size: 19px;
  color: #332f28;
  margin: 0;
  letter-spacing: 0.02em;
}

#tally-modal-close {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #c7b79c;
  background: none;
  color: #5a5245;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

#tally-modal-close:hover,
#tally-modal-close:focus-visible {
  background: #3a352e;
  color: #faf7f1;
  border-color: #3a352e;
}

#tally-modal-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#tally-modal-iframe {
  width: 100%;
  min-height: 420px;
  border: none;
  display: block;
}

#tally-modal-status {
  padding: clamp(18px, 4vw, 28px);
  font-family: 'Zen Kaku Gothic New', 'Noto Sans TC', sans-serif;
  font-size: 14px;
  color: #6b6355;
  text-align: center;
}

#tally-modal-status[hidden] {
  display: none;
}

#tally-modal-fallback-row {
  flex-shrink: 0;
  padding: 14px clamp(18px, 3vw, 28px);
  border-top: 1px solid #ece5d8;
  text-align: center;
}

#tally-modal-fallback-link {
  font-size: 13px;
  letter-spacing: 0.02em;
}

/* Mobile: use nearly the full screen, avoid cut-off content and keep the
   fallback link reachable regardless of keyboard state. */
@media (max-width: 640px) {
  #tally-modal-overlay {
    padding: 0;
  }

  #tally-modal-panel {
    width: 100%;
    height: 100%;
    max-height: 100dvh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  #tally-modal-iframe {
    min-height: 100%;
  }
}
