/*
  OGAPLE Sogong Playground – unified responsive shell (v5)
  Presentation only. Existing account, PASS/KMC, partner, support, community,
  Kakao, CMS, ad, slideshow and video handlers remain unchanged.
*/
@media (max-width: 1100px) {
  html, body { max-width: 100%; }
  #home .ogaple-ad-center-wrap { max-width: 100%; min-width: 0; }
  .detail-shell,.community-v314,.funding-screen,.og-v3033-grid { min-width: 0; }
}

/* Mobile navigation works independently of existing data-page/mega click logic. */
.og-mobile-menu-toggle { display: none; }
@media (max-width: 980px) {
  :root { --og-mob-pad: 16px; }
  html { scroll-padding-top: 112px; }
  html, body { min-width: 0; width: 100%; overflow-x: clip !important; }
  *, *::before, *::after { box-sizing: border-box; }
  img, picture, video, svg, canvas { max-width: 100%; }
  .container, .og-detail .container, .og-v3033-support-page .container {
    width: calc(100% - 32px) !important; max-width: 100% !important;
    padding: 16px 0 24px !important; margin-inline: auto !important;
  }
  .top-notice { height: auto !important; }
  .top-notice .top-inner {
    width: 100%; min-width: 0; padding: 8px var(--og-mob-pad) !important;
    display: flex !important; flex-direction: column !important; align-items: stretch !important;
    gap: 7px !important;
  }
  .top-notice .notice-left { display: grid !important; grid-template-columns: auto minmax(0,1fr) auto;
    align-items: start !important; gap: 7px !important; font-size: 11px !important; line-height: 1.48 !important;
    min-width: 0; }
  .top-notice .notice-left strong { white-space: nowrap; font-size: 11px !important; }
  .top-notice .notice-left span { min-width: 0; word-break: keep-all; overflow-wrap: anywhere; }
  .top-notice .notice-left a { white-space: nowrap; font-size: 11px; align-self: center; }
  .top-notice .top-links { display: flex !important; gap: 12px !important; flex-wrap: nowrap !important;
    align-items: center !important; font-size: 11px !important; padding-bottom: 2px; overflow-x: auto !important;
    scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
  .top-notice .top-links>* { white-space: nowrap; flex-shrink: 0; }
  .header { top: 0; z-index: 150 !important; }
  .header .head-inner {
    display: grid !important; grid-template-columns: minmax(0,1fr) 44px !important;
    align-items: center !important; gap: 8px !important;
    padding: 10px var(--og-mob-pad) !important; min-height: 66px !important;
    height: auto !important; max-width: 100% !important;
  }
  .header .brand { grid-column: 1 !important; grid-row: 1 !important; min-width: 0 !important;
    justify-self: start !important; align-items: baseline !important; gap: 5px !important; white-space: nowrap; }
  .header .brand .logo { font-size: 27px !important; }
  .header .brand .sub { font-size: 13px !important; }
  .og-mobile-menu-toggle { display: inline-flex !important; grid-column: 2; grid-row: 1;
    width: 44px; height: 44px; justify-content: center; align-items: center;
    border: 1px solid #d9e5fa; background: #f8fbff; border-radius: 13px;
    color: #174fc8; font-size: 22px; font-weight: 900; padding: 0; cursor: pointer; }
  .og-mobile-menu-toggle:focus-visible { outline: 3px solid #2766e4; outline-offset: 2px; }
  .header .nav { grid-column: 1/-1; grid-row: 2; display: none !important;
    height: auto !important; margin: 0 !important; padding: 9px 0 3px !important;
    width: 100% !important; overflow: visible !important; justify-content: stretch !important;
    grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px !important;
    border-top: 1px solid #e8eef9; }
  .header.og-mobile-nav-open .nav { display: grid !important; }
  .header .nav .nav-btn, .header .nav button.nav-btn {
    display: block !important; min-width: 0; width: 100%; padding: 12px 8px !important;
    min-height: 44px !important; white-space: normal; text-align: center;
    font-size: 13px !important; line-height: 1.45; border: 1px solid #e1eafa !important;
    border-radius: 11px !important; background: #f8fbff !important;
    color: #243a62 !important;
  }
  .header .nav .nav-btn.active { border-color: #bed3ff !important; color: #1554d7 !important;
    background: #edf3ff !important; }
  .header .nav .nav-btn:after { display: none !important; }
  .header .head-actions { grid-column: 1/-1 !important; grid-row: 3;
    justify-self: stretch !important; width: 100%; gap: 8px; flex-wrap: wrap; }
  .header .head-actions:empty { display: none !important; }
  .header .head-actions>a,.header .head-actions>button:not([style*="display:none"]) {
    flex: 1 1 auto; font-size: 12px; min-height: 40px; }
  .search-line { display: flex !important; width: 100%; max-width: 100%;
    min-height: 0 !important; padding: 0 var(--og-mob-pad) 10px !important; }
  .search-line .search { width: 100%; min-height: 42px; }
  .header .mega-wrap { position: absolute !important; top: 100% !important; left: 0 !important;
    right: 0 !important; width: 100% !important; max-width: 100% !important;
    max-height: min(62vh,480px); overflow-y: auto; padding: 0 12px 12px; }
  .header .mega { width: 100% !important; max-width: 100% !important; grid-template-columns: 1fr !important;
    gap: 0 !important; }
  .header .mega-col { border-radius: 0 0 16px 16px; padding: 14px 18px; }
  .header .mega-link { min-height: 44px; align-items: center; }
  .header .mega-side { width: 100%; }

  #home { padding-top: 4px !important; }
  #home>.container { width: calc(100% - 32px) !important; padding: 12px 0 28px !important; }
  #home .home-grid { display: flex !important; flex-direction: column !important;
    gap: 14px !important; grid-template-columns: none !important; grid-template-rows: none !important;
    min-width: 0; }
  #home .home-grid>.hero-slider, #home .home-grid>.weather-card,
  #home .home-grid>.hero-fill, #home .home-grid>.side-stack,
  #home .home-grid>.ogaple-ad-center-wrap { flex: none !important;
    width: 100% !important; max-width: 100% !important; min-width: 0 !important;
    grid-column: auto !important; grid-row: auto !important; }
  #home .hero-slider { height: 390px !important; min-height: 390px !important; border-radius: 20px !important; }
  #home .og-ref-hero-copy { left: 0; width: 100% !important; max-width: none !important;
    padding: 30px 22px 60px !important; align-items: flex-start; justify-content: center; }
  #home .og-ref-eyebrow { font-size: 11px !important; margin-bottom: 15px !important;
    line-height: 1.45; word-break: keep-all; }
  #home .og-ref-hero-copy h1 { font-size: clamp(29px,8vw,40px) !important;
    letter-spacing: -1.6px !important; line-height: 1.22 !important; }
  #home .og-ref-hero-lead { margin: 14px 0 21px !important; font-size: 13px !important;
    line-height: 1.5; max-width: 250px; }
  #home .og-ref-hero-visual { inset: 0 0 0 21% !important; opacity: .28 !important;
    background-position: 48% 50% !important; }
  #home .og-ref-hero-actions { display: flex !important; max-width: 100%; flex-wrap: wrap !important; gap: 8px !important; }
  #home .og-ref-hero-actions a { min-height: 43px; font-size: 12px !important;
    padding: 10px 13px !important; gap: 6px !important; border-radius: 10px; }
  #home .hero-slider-controls { bottom: 12px !important; }
  #home .hero-dots { bottom: 18px !important; }
  #home .weather-card { display: block !important; height: auto !important; min-height: 0 !important;
    border-radius: 20px !important; }
  #home .og-ref-partner { padding: 22px 20px !important; min-height: 0 !important; gap: 14px; }
  #home .og-ref-partner-top h2 { font-size: 23px !important; }
  #home .og-ref-partner-items { display: grid !important; grid-template-columns: 1fr !important; gap: 8px !important; }
  #home .og-ref-partner-items>div { min-width: 0; min-height: 60px !important; padding: 11px !important; }
  #home .og-ref-partner-items p { min-width: 0; }
  #home .og-ref-partner-items small { font-size: 11px !important; line-height: 1.45 !important; }
  #home .hero-fill.og-home-reference-lower { display: flex !important; flex-direction: column !important;
    gap: 14px !important; height: auto !important; min-height: 0 !important;
    overflow: visible !important; padding: 0 !important; }
  #home .hero-fill.og-home-reference-lower > div { width: 100% !important; min-width: 0 !important;
    flex: none !important; height: auto !important; }
  #home .og-home-link-row { display: grid !important; grid-template-columns: 1fr !important; gap: 10px !important; }
  #home .og-home-link-card { min-height: 94px !important; padding: 14px !important;
    grid-template-columns: 50px minmax(0,1fr) 14px !important; gap: 12px !important; }
  #home .og-home-link-icon { width: 50px !important; height: 50px !important; }
  #home .og-home-link-text b { font-size: 16px !important; }
  #home .og-home-link-text span { font-size: 12px !important; }
  #home .og-home-news-row, #home .og-home-bottom-row { display: grid !important;
    grid-template-columns: 1fr !important; gap: 12px !important; }
  #home .og-home-news-panel { min-height: 0 !important; padding: 17px 16px !important; }
  #home .og-home-panel-head h3 { font-size: 18px !important; }
  #home .og-home-news-tabs { gap: 14px !important; overflow-x: auto !important; }
  #home .og-home-news-item { grid-template-columns: auto minmax(0,1fr) !important;
    gap: 8px !important; padding: 10px 0 !important; }
  #home .og-home-news-item p { font-size: 12px !important; word-break: keep-all; }
  #home .og-home-news-item time { grid-column: 2 !important; font-size: 11px !important; }
  #home .og-home-support-panel { min-height: 225px !important; padding: 22px !important; }
  #home .og-home-soft-card { min-height: 100px !important; padding: 15px !important;
    grid-template-columns: 46px minmax(0,1fr) 26px !important; gap: 11px !important; }
  #home .og-home-soft-icon { width: 46px; height: 46px; font-size: 23px; }
  #home .og-home-soft-card h3 { font-size: 16px; }
  #home .og-home-soft-card p { font-size: 11px; }
  #home .side-stack { width: 100%; display: grid !important; gap: 12px !important; }
  #home .side-stack>.login-side, #home .side-stack>.card, #home .side-stack>.community-highlight {
    min-width: 0; padding: 16px !important; }
  #home .home-login-row { grid-template-columns: 1fr !important; }
  #home .home-login-row input { width: 100% !important; min-width: 0 !important; min-height: 44px; }
  #home .home-login-buttons { grid-template-columns: 1fr 1fr !important; }
  #home .home-login-buttons>* { min-width: 0; min-height: 44px; }
  #home .quick-icons { grid-template-columns: repeat(4,minmax(0,1fr)) !important; gap: 7px !important; }
  #home .quick-icon { min-width: 0; padding: 11px 4px !important; font-size: 11px !important;
    line-height: 1.45 !important; word-break: keep-all; }
  #home .notice-line { white-space: normal !important; overflow: visible !important; line-height: 1.55; }
  #home .marketing-box { min-width: 0; }
  #home .community-highlight { grid-template-columns: minmax(0,1fr) 72px !important; }
  #home .community-highlight .mascot { font-size: 44px; min-height: 80px; }
  #home .og-v3-video-feature { display: grid !important; grid-template-columns: 1fr !important;
    min-height: 0 !important; padding: 17px !important; gap: 14px !important; }
  #home .og-v3-video-feature video { display: block; width: 100% !important;
    height: auto !important; max-height: none !important; aspect-ratio: 16 / 9;
    object-fit: contain; background: #0b1425; }
  #home .ogaple-ad-center-wrap { grid-row: auto !important; width: 100% !important; margin: 2px 0 24px !important;
    min-width: 0 !important; padding: 14px !important; }
  #home .ogaple-ad-slider,#home .ogaple-ad-track,#home .ogaple-ad-slide { min-width: 0 !important; max-width: 100% !important; }
  #home .ogaple-ad-slide { grid-template-columns: 1fr !important; align-content: center !important;
    gap: 13px !important; padding: 14px !important; min-height: 340px !important; }
  #home .ogaple-ad-copy { min-width: 0 !important; }
  #home .ogaple-ad-copy h3 { font-size: clamp(20px,6vw,27px) !important; }
  #home .ogaple-ad-image-slot { min-width: 0 !important; max-width: 100% !important; min-height: 138px !important; }
  #home .ogaple-ad-arrow { width: 40px !important; height: 40px !important; }
  #home .ogaple-ad-prev { left: 7px !important; }
  #home .ogaple-ad-next { right: 7px !important; }

  /* Detail pages: support, guide, funding, benefits, news, community, settlement. */
  .og-detail,.og-v3033-support-page { min-height: 0 !important; padding: 12px 0 28px !important; }
  .detail-shell,.community-v314,.funding-screen,.og-v3033-grid,
  .latest-layout,.support-grid,.benefit-grid,.marketing-cards,.mock-cards,.info-grid,
  .og-info-grid,.onboarding-detail-grid,.onboarding-mini-flow,.partner-grid,
  .fund-support-row,.fund-list,.quick-contact-grid,.calendar-grid,.fee-calc {
    grid-template-columns: 1fr !important; min-width: 0 !important; }
  .detail-main,.detail-side,.comm-main,.fund-main,.screen-card,.fund-rail,
  .screen-pad,.comm-table,.comm-box,.side-panel,.marketing-hero,.news-card { min-width: 0 !important; }
  .detail-side { display: grid !important; grid-template-columns: 1fr !important; }
  .screen-pad,.og-v3033-card { padding: 17px !important; }
  .screen-title,.rail-title,.og-v3033-title { font-size: clamp(25px,7vw,34px) !important;
    letter-spacing: -1px !important; overflow-wrap: anywhere; }
  .screen-desc,.og-v3033-desc { font-size: 13px !important; line-height: 1.65 !important; }
  .detail-img-preview img { display: block; width: 100% !important; height: auto !important; }
  .fund-filter { grid-template-columns: 1fr !important; padding: 13px !important; }
  .fund-filter select,.fund-filter input,.fund-filter button { min-width: 0; width: 100%; min-height: 44px; }
  .mock-steps, .support-action-grid,.support-form-grid,.support-check-list,
  .og-v3033-form,.faq-grid,.support-grid,.stat-grid { grid-template-columns: 1fr !important; }
  .mock-step { grid-template-columns: 35px minmax(0,1fr) !important; gap: 10px !important; }
  .detail-btn,.og-v3033-btn,.support-tile { min-height: 44px; }
  .comm-table,.post-row,.community-board-head { min-width: 0 !important; }
  .comm-main.comm-mode-neighborhood #chatPanel { padding: 14px !important; min-height: 430px !important; }
  .neighborhood-chat-box { min-height: 300px !important; max-height: 55vh !important; }
  .region-dropdown.open { grid-template-columns: 1fr 1fr !important; }
  .region-dropdown { max-height: 45vh !important; }
  .region-search-box { grid-template-columns: 1fr !important; }
  .chat-send-row { grid-template-columns: minmax(0,1fr) 66px !important; }
  .comm-input,.comm-textarea,.chat-send-row input,.chat-send-row button,
  .support-form input,.support-form select,.support-form textarea { min-width: 0; max-width: 100% !important; }
  .ogaple-business-footer { width: 100%; padding: 16px !important; line-height: 1.7 !important;
    font-size: 11px !important; }
  .ogaple-business-footer .footer-inner { max-width: 100% !important; }
  .policy-modal,.partner-modal,.account-recovery-modal { padding: 14px !important; }
  .policy-box,.account-recovery-box { max-width: calc(100vw - 28px) !important;
    max-height: 85dvh !important; overflow-y: auto !important; padding: 18px !important; }
}

@media (max-width: 420px) {
  :root { --og-mob-pad: 12px; }
  .container,.og-detail .container,.og-v3033-support-page .container,
  #home>.container { width: calc(100% - 24px) !important; }
  .header .brand .logo { font-size: 25px !important; }
  .header .brand .sub { font-size: 12px !important; }
  #home .hero-slider { min-height: 370px !important; height: 370px !important; }
  #home .og-ref-hero-copy { padding: 22px 16px 55px !important; }
  #home .og-ref-hero-copy h1 { font-size: clamp(27px,7.8vw,32px) !important; }
  #home .og-ref-hero-actions a { padding: 10px 11px !important; }
  #home .quick-icons { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
  #home .og-home-soft-card { grid-template-columns: 40px minmax(0,1fr) 24px !important; padding: 12px !important; }
  #home .og-home-soft-icon { width: 40px; height: 40px; }
  #home .home-login-buttons { grid-template-columns: 1fr 1fr !important; }
  .region-dropdown.open { grid-template-columns: 1fr !important; }
}

/* Signup, live-chat, library, and standalone talkroom: retain existing handlers. */
@media (max-width: 760px) {
  body.og-v5-signup .wrap,body.og-v5-talkroom .wrap,body.og-v5-chat .wrap,
  body.og-v5-library .wrap { max-width: 100% !important; width: calc(100% - 28px) !important; margin-inline: auto !important; }
  body.og-v5-signup .topbar .wrap,body.og-v5-talkroom .topbar .wrap { display: flex !important;
    flex-wrap: wrap !important; gap: 9px !important; padding-block: 9px !important; }
  body.og-v5-signup .header .wrap,body.og-v5-talkroom .main-header .wrap { display: flex !important;
    flex-direction: column !important; align-items: flex-start !important; gap: 10px !important; }
  body.og-v5-signup .nav,body.og-v5-talkroom .nav { width: 100% !important; max-width: 100%;
    display: flex !important; flex-wrap: nowrap !important; overflow-x: auto !important;
    gap: 14px !important; padding-bottom: 8px !important; -webkit-overflow-scrolling: touch; }
  body.og-v5-signup .nav a,body.og-v5-talkroom .nav a { white-space: nowrap !important; flex-shrink: 0; }
  body.og-v5-signup .signup-shell { display: grid !important; grid-template-columns: 1fr !important; gap: 16px !important; }
  body.og-v5-signup .terms-card,body.og-v5-signup .signup-steps,
  body.og-v5-signup .card { max-width: 100% !important; min-width: 0 !important; }
  body.og-v5-signup .terms-box { max-width: 100% !important; overflow-y: auto; }
  body.og-v5-signup input,body.og-v5-signup select,body.og-v5-signup textarea,
  body.og-v5-chat input,body.og-v5-chat select,body.og-v5-chat textarea,
  body.og-v5-talkroom input,body.og-v5-talkroom select,body.og-v5-talkroom textarea {
    max-width: 100% !important; min-width: 0 !important; }
  body.og-v5-chat .card, body.og-v5-library .card,
  body.og-v5-talkroom .card { max-width: 100% !important; min-width: 0 !important; }
  body.og-v5-chat .statusline,body.og-v5-chat .send,
  body.og-v5-library .top { display: flex !important; flex-wrap: wrap !important; gap: 8px; }
  body.og-v5-chat .msgs { max-height: 52dvh !important; min-height: 250px; }
  body.og-v5-library .file { display: flex !important; flex-wrap: wrap !important; gap: 10px; }
  body.og-v5-talkroom .hero-grid,body.og-v5-talkroom .talk-layout {
    display: grid !important; grid-template-columns: 1fr !important; min-width: 0 !important; }
  body.og-v5-talkroom .main-header .search { width: 100% !important; }
  body.og-v5-talkroom .talk-tabs { min-width: 0 !important; overflow-x: auto; }
}

/* v5 final QA fixes: show existing mega menu and prioritize mobile sign-in. */
@media (max-width: 980px) {
  .header .mega-wrap { display: block !important; }
  #home .home-grid>.hero-slider { order: 1; }
  #home .home-grid>.weather-card { order: 2; }
  #home .home-grid>.side-stack { display: contents !important; }
  #home .home-grid>.side-stack>.login-side { order: 3; width: 100% !important; }
  #home .home-grid>.hero-fill { order: 4; }
  #home .home-grid>.side-stack>.card,
  #home .home-grid>.side-stack>.notice-line,
  #home .home-grid>.side-stack>.community-highlight { order: 5; width: 100% !important; }
  #home .home-grid>.ogaple-ad-center-wrap { order: 6; }
}
@media (max-width: 760px) {
  body.og-v5-talkroom { max-width: 100% !important; }
  body.og-v5-talkroom .main-header, body.og-v5-talkroom .hero,
  body.og-v5-talkroom .talk-layout,body.og-v5-talkroom .card,
  body.og-v5-talkroom .composer { max-width: 100% !important; min-width: 0 !important; }
  body.og-v5-talkroom .talk-layout>* { min-width: 0 !important; }
}
