/* tw-stock 專屬樣式；共用元件請在 ../common.css 維護。 */

/* =========================================================
       Theme
    ========================================================== */

body[data-page="tw"] {
  --tw-primary: #0068dd;
  --tw-primary-light: #3c9bfb;
  --tw-primary-soft: #ddf3ff;

  --tw-bg: #edf8ff;
  --tw-bg-light: #f7fcff;

  --tw-card: #ffffff;
  --tw-border: #d9ecf9;

  --tw-title: #163b5c;
  --tw-text: #4f687d;
  --tw-muted: #8195a7;

  --tw-gradient-blue: linear-gradient(90deg, #0068dd 0%, #3c9bfb 100%);
  --tw-hero-gradient: linear-gradient(180deg, #9bdfff 0%, #cdeeff 50%, #edf8ff 100%);
  --tw-card-shadow: 0 8px 24px rgba(49, 126, 183, 0.08);

  background: var(--tw-bg);
  color: var(--tw-title);
}

html,
body {
  width: 100%;
  max-width: 100%;
}

/* =========================================================
       TW Hero
    ========================================================== */

#tw-hero {
  position: relative;
  background:
    radial-gradient(ellipse at 12% 12%, rgba(236, 251, 255, 0.96) 0%, rgba(219, 245, 252, 0.72) 24%, transparent 50%),
    radial-gradient(ellipse at 58% 12%, rgba(90, 196, 243, 0.44) 0%, rgba(119, 208, 248, 0.24) 30%, transparent 58%),
    radial-gradient(ellipse at 88% 16%, rgba(124, 212, 249, 0.3) 0%, transparent 46%),
    radial-gradient(ellipse at 52% 108%, rgba(206, 241, 255, 0.96) 0%, rgba(206, 241, 255, 0.78) 38%, transparent 68%),
    linear-gradient(110deg, #d7f2fa 0%, #c6edf9 18%, #9edcf8 48%, #8fd7f5 66%, #b5e6fa 84%, #cef1ff 100%);
}

.hero-title {
  background: linear-gradient(90deg, #0063d3 0%, #18aeff 58%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

#tw-hero::after {
  content: "";
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  height: 90px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(206, 241, 255, 0) 0%, #cef1ff 100%);
}

#tw-hero > img {
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 76%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 76%, transparent 100%);
}

.hero-title {
  font-family: "Noto Sans TC", sans-serif;
  font-weight: 900;

  background: linear-gradient(90deg, #0063d3 0%, #18aeff 58%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* =========================================================
       Section 01
    ========================================================== */

#tw-intro {
  background: linear-gradient(180deg, #cef1ff 0%, #cef1ff 8%, #d9effc 48%, #f1faff 100%);
}

/* =========================================================
       Section 03
    ========================================================== */

.tw-switch-btn {
  border: 1px solid #d9ecf9;
  background: rgba(255, 255, 255, 0.88);
  color: #333;
  box-shadow: 0 4px 12px rgba(49, 126, 183, 0.05);
  transition:
    background 0.22s ease,
    color 0.22s ease,
    box-shadow 0.22s ease;
}

.tw-switch-btn.is-active {
  border-color: #0068dd;
  background: linear-gradient(180deg, #18afff 0%, #0068dd 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(0, 104, 221, 0.22);
}

.tw-switch-btn,
.mobile-app-main-tab {
  cursor: pointer;
}

.app-mode-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  touch-action: pan-y;
}

.app-mode-scroll::-webkit-scrollbar {
  display: none;
}

.app-slider-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #c8c8c8;
  transition:
    width 0.2s ease,
    background 0.2s ease;
}

.app-slider-dot.is-active {
  width: 18px;
  background: #0077df;
}

.app-slider-nav {
  position: absolute;
  top: 50%;
  z-index: 50;
  display: flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 8px 24px rgba(39, 111, 173, 0.16);
  -webkit-backdrop-filter: blur(12px) saturate(145%);
  backdrop-filter: blur(12px) saturate(145%);
  color: #0068dd;
  opacity: 1;
  transform: translateY(-50%) scale(1);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    background 0.2s ease;
}

.app-slider-nav:active {
  transform: translateY(-50%) scale(0.94);
  background: rgba(255, 255, 255, 0.56);
}

.app-slider-nav[data-direction="prev"] {
  left: calc(50% - 200px);
}

.app-slider-nav[data-direction="next"] {
  right: calc(50% - 200px);
}

.app-slider-nav.is-hidden {
  opacity: 0;
  transform: translateY(-50%) scale(0.82);
  pointer-events: none;
}

.faq-summary::-webkit-details-marker {
  display: none;
}

.faq-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #88939d;
  transform: rotate(180deg);
  transform-origin: center;
  transition: transform 0.18s ease;
  flex: 0 0 auto;
}

details[open] > .faq-summary .faq-chevron {
  transform: rotate(0deg);
}

.fee-highlight {
  background: #fffdf3;
}

/* FAQ 橘框統一由 common.css 管理。 */

/* =========================================================
       Desktop
    ========================================================== */

@media (min-width: 768px) {
  [data-card="app-guide"] .app-guide-desktop {
    width: 100%;
    max-width: 900px;
    margin-inline: auto;
    grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr);
  }
  [data-app-mode-panel][aria-hidden="true"] {
    display: none !important;
  }
}

/* =========================================================
       Mobile
    ========================================================== */

@media (max-width: 767px) {
  [data-card="app-guide"] {
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  [data-mobile-app-guide] {
    width: 100%;
    min-width: 0;
    overflow: visible;
  }

  .mobile-app-main-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    background: transparent;
    border-bottom: 2px solid #e7edf4;
  }

  .mobile-app-main-tab {
    min-width: 0;
    min-height: 52px;
    padding: 10px 4px;
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    background: linear-gradient(180deg, #f8fbff 0%, #eaf0f7 100%);
    color: #929292;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
  }

  .mobile-app-main-tab.is-active {
    position: relative;
    z-index: 1;
    background: #fff;
    color: #0068dd;
  }

  .mobile-app-content {
    position: relative;
    min-height: 0;
    padding: 24px 14px 26px;
    border-radius: 0 0 24px 24px;
    background: #fff;
  }

  [data-mobile-app-panel][hidden] {
    display: none !important;
  }

  .mobile-app-sub-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
  }

  .mobile-app-sub-tab {
    display: inline-flex;
    width: min(42%, 150px);
    min-height: 48px;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
  }

  .mobile-app-video-area {
    display: flex;
    justify-content: center;
  }

  .mobile-app-video-area .app-phone-frame {
    width: min(290px, 78vw);
    margin: 0 auto;
  }

  .mobile-app-video-area video {
    pointer-events: none;
    -webkit-user-drag: none;
    user-select: none;
  }

  .mobile-app-note {
    margin-top: 18px;
    color: #a2a2a2;
    font-size: 13px;
    text-align: center;
  }

  .mobile-app-more {
    display: flex;
    width: fit-content;
    align-items: center;
    gap: 5px;
    margin: 8px auto 0;
    border-bottom: 1px solid #168fea;
    color: #0068dd;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
  }

  .mobile-app-more[hidden] {
    display: none !important;
  }

  .mobile-app-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
  }

  .mobile-app-content .app-slider-nav {
    top: 48%;
  }

  .mobile-app-content .app-slider-nav[data-direction="prev"] {
    left: -20px;
  }

  .mobile-app-content .app-slider-nav[data-direction="next"] {
    right: -20px;
  }
}

.tw-switch-btn[data-ranking-tab] {
  cursor: pointer;
  transition: color 0.18s ease;
}
.tw-switch-btn[data-ranking-tab]:focus-visible {
  outline: 2px solid #0068dd;
  outline-offset: 3px;
}
@media (hover: hover) and (pointer: fine) {
  .tw-switch-btn[data-ranking-tab]:not(.is-active):not([aria-selected="true"]):hover {
    color: #1c95e5;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tw-switch-btn[data-ranking-tab] {
    transition: none;
  }
}

#video-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483647 !important;
  isolation: isolate;
}

#video-modal .video-modal-frame {
  position: relative;
  width: min(390px, calc((74vh * 590) / 1250), calc(100vw - 36px));
  aspect-ratio: 590 / 1225;
  flex: none;
  isolation: isolate;
}

#video-modal .video-modal-frame::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: url("../assets/images/phone-frame.png") center / 100% 100% no-repeat;
  content: "";
  pointer-events: none;
}

#video-modal-player,
#video-modal-cover {
  position: absolute;
  top: 1%;
  left: 2.7%;
  display: block;
  width: 94.6% !important;
  height: 98% !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 12% / 5.7%;
  background: #edf8ff;
  object-fit: contain !important;
  box-shadow: none !important;
}

#video-modal-cover {
  z-index: 1;
  cursor: pointer;
}

#video-modal-cover[hidden] {
  display: none;
}

#video-modal .video-modal-close {
  position: absolute !important;
  top: -60px !important;
  right: 0 !important;
  z-index: 20 !important;
  display: flex !important;
  width: 46px !important;
  height: 46px !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
  cursor: pointer !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#video-modal .video-modal-close span {
  position: absolute !important;
  display: block !important;
  width: 25px !important;
  height: 2px !important;
  border-radius: 999px !important;
  background: #4a4a4a !important;
  pointer-events: none !important;
}

#video-modal .video-modal-close span:first-child {
  transform: rotate(45deg) !important;
}

#video-modal .video-modal-close span:last-child {
  transform: rotate(-45deg) !important;
}

@media (max-width: 767px) {
  #video-modal .video-modal-frame {
    width: min(390px, calc((74dvh * 590) / 1250), calc(100vw - 28px));
  }

  #video-modal .video-modal-close {
    top: -50px !important;
    width: 36px !important;
    height: 36px !important;
  }

  #video-modal .video-modal-close span {
    width: 23px !important;
  }
}

/* 台股 Hero 文字依設計稿，保留原有字級與排列。 */
#tw-hero .hero-title {
  background: linear-gradient(90deg, #0076DF 0%, #18AEFF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 2px 0 rgba(255, 255, 255, .88));
}
#tw-hero .hero-title + p,
#tw-hero p:has(+ .hero-title) {
  color: #123F85;
  text-shadow: 0 2px 0 rgba(255, 255, 255, .55);
}

/* 動畫教學警語：縮小字級，寬螢幕盡量保持單行。 */
p.tw-demo-disclaimer {
  font-size: 12px;
  line-height: 1.5;
}
@media (min-width: 1280px) {
  p.tw-demo-disclaimer {
    white-space: nowrap;
  }
}

/* 零股提醒燈泡對齊第一行文字。 */
.topic-page .topic-note.odd-lot-note {
  align-items: flex-start;
}
.topic-page .topic-note.odd-lot-note > img {
  margin-top: 3px;
  align-self: flex-start;
}
.topic-page .topic-note.odd-lot-note > p {
  margin-block: 0;
  align-self: flex-start;
}

/* 影片與註解一起置中，註解緊接在手機影片下方。 */
#video-modal {
  flex-direction: column;
  gap: 12px;
}
#video-modal p.video-modal-disclaimer {
  position: static;
  flex: none;
  max-width: 100%;
  margin: 0;
  color: #fff;
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
  white-space: normal;
}
/* Q3 單行提示與美股提示列採相同的上下留白及圖示尺寸。 */
.topic-page .topic-note.odd-lot-note {
  padding: 14px 18px;
  gap: 12px;
}
.topic-page .topic-note.odd-lot-note > img {
  width: 26px;
  height: 26px;
}
@media (max-width: 767px) {
  .topic-page .topic-note.odd-lot-note {
    padding: 14px;
    gap: 8px;
  }
}


/* 委託說明避免末行落單字，關鍵詞保持完整。 */
.tw-order-submit-copy{text-wrap:wrap}
.tw-order-submit-copy .tw-order-phrase{display:inline-block;white-space:nowrap;max-width:100%}


/* 下單工具提示框對齊 1080px 主內容寬度，沿用交易提醒配色。 */
.tw-order-tools-note{display:flex;width:100%;max-width:1080px;box-sizing:border-box;gap:12px;padding:18px 22px;border-radius:12px;background:#ddeffc;color:#168fea;font-size:18px;line-height:1.65;margin-bottom:18px}
.tw-order-tools-note>div{min-width:0;flex:1}
.tw-order-tools-note h3{font-size:18px;font-weight:700;color:inherit;margin:0 0 4px}
.tw-order-tools-note p{margin:0;color:inherit}
.tw-order-tools-note .tw-order-tools-icon{width:26px;height:26px;object-fit:contain;flex:none}
@media(max-width:767px){.tw-order-tools-note{padding:14px;gap:8px}}


/* QA 黃色提示與台股其他交易提醒採相同尺寸，只保留不同底色。 */
.topic-page .topic-note.tw-qa-note{width:100%;max-width:100%;box-sizing:border-box;border-radius:10px;padding:18px 22px;gap:12px;align-items:flex-start}
.topic-page .topic-note.tw-qa-note>img{width:26px;height:26px;flex:0 0 26px;margin-top:3px;align-self:flex-start}
.topic-page .topic-note.tw-qa-note>p{margin:0;min-width:0;font-size:18px;line-height:1.65}
@media(max-width:767px){.topic-page .topic-note.tw-qa-note{padding:16px 18px}}
