/* GM_GUPPY_LAYOUT_V002
 * Top-level Guppy shell. The outer app never scrolls.
 * Functional modules remain under /translation and mount into #gmGuppySurface.
 */
html,body{width:100%;height:100%;margin:0;overflow:hidden!important;overscroll-behavior:none;background:#090a0c}
body{min-height:0!important}
#gmGuppyApp.gmGuppyApp{height:100vh!important;height:100dvh!important;min-height:0!important;max-height:100dvh!important;display:flex!important;flex-direction:column!important;overflow:hidden!important;background:#090a0c}
#gmGuppyApp>.utility{position:relative!important;top:auto!important;flex:0 0 auto!important;z-index:80;background:#111216}
#gmGuppyApp>.services{position:relative!important;top:auto!important;flex:0 0 auto!important;z-index:79;background:#090a0c}
#gmGuppySurface.gmGuppyContent{display:block!important;position:relative!important;flex:1 1 auto!important;min-width:0!important;min-height:0!important;height:auto!important;width:100%!important;overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;background:#090a0c}
#gmGuppySurface.gmGuppyContent:empty{display:block!important}
#gmGuppySurface>.recent{min-height:0;margin:0}
body.gm-shell-friends #gmDirectSurface,body.gm-shell-video #gmDirectSurface,body.gm-shell-settings #gmDirectSurface,body.gm-shell-group #gmDirectSurface,body.gm-shell-gpay #gmDirectSurface,body.gm-shell-room-open #gmDirectSurface{display:none!important}
#gmGuppyBannerSlot.gmGuppyBannerSlot{position:relative;flex:0 0 auto;width:100%;min-height:0;overflow:hidden;background:#090a0c;z-index:85}
#gmGuppyBannerSlot.gmGuppyBannerSlot[hidden]{display:none!important}
#gmGuppyLoginGate.gmGuppyLoginGate{position:fixed;inset:0;z-index:2147483500;background:#090a0c;overflow:hidden;display:flex;align-items:center;justify-content:center;padding:24px;box-sizing:border-box}
#gmGuppyLoginGate.gmGuppyLoginGate[hidden]{display:none!important}
.gmGuppyLoginCard{width:min(100%,420px);max-height:100%;overflow-y:auto;overscroll-behavior:contain}
.gmGuppyLoginLogo{display:block;width:112px;max-width:40vw;height:auto;margin:0 auto 28px}
#gmGuppyAdLayer.gmGuppyAdLayer{position:fixed;inset:0;z-index:2147483600;background:#000;overflow:hidden}
#gmGuppyAdLayer.gmGuppyAdLayer[hidden]{display:none!important}
#gmGuppyAdPageMount,#gmGuppyAdVideoMount{position:absolute;inset:0;overflow:auto;overscroll-behavior:contain;background:#000}
#gmGuppyAdPageMount[hidden],#gmGuppyAdVideoMount[hidden]{display:none!important}
/* Existing child surfaces become content-owned rather than viewport-owned. */
#gmGuppySurface #gmFriendMask,#gmGuppySurface #gmVideoTranslationPanel,#gmGuppySurface #gmSettingsHost{position:static!important;inset:auto!important;z-index:auto!important;width:100%!important;min-height:0!important}
#gmGuppySurface #gmRealtimeConversation{position:relative!important;inset:auto!important;z-index:auto!important;width:100%!important;height:100%!important;min-height:0!important}
body.gm-guppy-ad-open #gmGuppyApp{pointer-events:none}
/* GM_GUPPY_LAYOUT_V015_GROUP_ROOM_LAYOUT
 * Layout-only rule set.
 * Do not change feature lifecycle or messaging.
 * MEETING_ROOT owns the tree; GROUP_ROOM owns the realtime room surface.
 */
#gmGuppyApp[data-gm-surface="MEETING"][data-gm-subview="MEETING_ROOT"] #gmTreeMeetingHost{
  display:block!important;
  width:100%!important;
  min-height:0!important;
}
#gmGuppyApp[data-gm-surface="MEETING"][data-gm-subview="MEETING_ROOT"] #gmRealtimeConversation{
  display:none!important;
}

#gmGuppyApp[data-gm-surface="MEETING"][data-gm-subview="GROUP_ROOM"] #gmTreeMeetingHost{
  display:none!important;
}
#gmGuppyApp[data-gm-surface="MEETING"][data-gm-subview="GROUP_ROOM"] #gmGuppySurface{
  display:flex!important;
  flex-direction:column!important;
  min-height:0!important;
  overflow:hidden!important;
}
#gmGuppyApp[data-gm-surface="MEETING"][data-gm-subview="GROUP_ROOM"] #gmRealtimeConversation{
  display:block!important;
  position:relative!important;
  inset:auto!important;
  flex:1 1 auto!important;
  width:100%!important;
  height:100%!important;
  min-height:0!important;
  overflow:hidden!important;
  margin:0!important;
}
#gmGuppyApp[data-gm-surface="MEETING"][data-gm-subview="GROUP_ROOM"] #gmRealtimeConversation .gmRtCard{
  height:100%!important;
  min-height:0!important;
}
#gmGuppyApp[data-gm-surface="MEETING"][data-gm-subview="GROUP_ROOM"] #gmRealtimeConversation .gmRtHistory{
  min-height:0!important;
  flex:1 1 auto!important;
}

/* When the room closes, the MEETING tree returns as the only inner surface.
 * This is CSS state switching only; no DOM recreation and no host repair.
 */
#gmGuppyApp[data-gm-surface="MEETING"][data-gm-subview="ROOT"] #gmRealtimeConversation{
  display:none!important;
}

/* GM_LAYOUT_V001 - Guppy header settings to the right of search */
#gmGuppyApp>.utility #friendSearchBtn{right:54px!important}
#gmGuppyApp>.utility #gmHeaderSettingsBtn{position:absolute;right:8px;top:50%;transform:translateY(-50%);display:flex;align-items:center;justify-content:center;border:0;background:transparent;color:#fff;width:42px;height:42px;z-index:6}
#gmGuppyApp>.utility #groupAddBtn{right:100px!important}
#gmGuppyApp>.services{display:flex!important;padding:1px 8px 1px!important}
#gmGuppyApp>.services>button{min-width:0;flex:1 1 0}
#gmRecordMount{display:none;padding:18px 16px;color:#f3f4f6;min-height:140px}
#gmGuppyApp[data-gm-surface="RECORD"] #gmRecordMount{display:block}
#gmGuppyApp[data-gm-surface="RECORD"] #gmDirectSurface,#gmGuppyApp[data-gm-surface="RECORD"] #gmSettingsHost{display:none!important}

/* GM_RECORD_TREE_V002: isolate RECORD surface from DIRECT and MEETING. */
#gmGuppyApp[data-gm-surface="RECORD"] #gmDirectSurface{display:none!important}
#gmGuppyApp[data-gm-surface="RECORD"][data-gm-subview="DIRECT_ROOM"] #gmRecordMount{display:none!important}
#gmGuppyApp[data-gm-surface="MESSAGE"] .gmFaceTopRoom{display:none!important}
#gmRecordMount{box-sizing:border-box;width:100%;padding:12px 15px 30px}
.gmRecordTreeHeader{display:flex;align-items:center;gap:10px;justify-content:space-between;margin:2px 0 14px;color:#f4f4f4}
.gmRecordTreeHeader strong{font-size:20px}
.gmRecordTreeTools{display:flex;gap:9px}
.gmRecordTreeTools button,.gmRecordTreeLine button{border:0;color:inherit;background:transparent;cursor:pointer;font:inherit}
.gmRecordTreeTools button{background:#24262d;border:1px solid #40434c;border-radius:10px;min-width:40px;min-height:40px;font-size:23px}
.gmRecordTreeLine{display:flex;align-items:center;gap:9px;min-height:45px;border-bottom:1px solid #30323b;color:#eceef1}
.gmRecordTreeLine .gmRecordTreeToggle{width:34px;min-height:42px;flex:none;font-size:22px}
.gmRecordTreeLine .gmRecordTreeTitle{flex:1;text-align:left;min-height:42px}
.gmRecordTreeFolder{background:#22262e;border-radius:8px;margin:6px 0}
.gmRecordTreeChild{padding-left:15px}
.gmRecordTreeRoom{padding-left:20px;color:#fff;background:#181b22;border-radius:8px}

/* GM_RECORD_TREE_V004 folder-scoped plus/management and year/month/day */
#gmRecordMount .gmRecordTreeLine .gmRecordMini{display:inline-flex;align-items:center;justify-content:center;flex:0 0 39px;width:39px;height:39px;margin-right:3px;border-radius:50%;background:#2c3038;border:1px solid #414650;font-size:22px}
#gmRecordMount .gmRecordTreeTitle{min-width:0;white-space:normal}
#gmRecordMount .gmRecordDateRow{min-height:45px;box-sizing:border-box;padding:9px 9px 9px 52px;background:#1b1e25;border-bottom:1px solid #333741;cursor:pointer;color:#f4f4f4;font-size:17px}
#gmRecordMount .gmRecordDateMonth{padding-left:74px}
#gmRecordMount .gmRecordDateDay{padding-left:96px}
#gmRecordMount .gmRecordDateRow small{float:right;color:#aeb4bc}
#gmRecordMount .gmRecordArrow{display:inline-block;min-width:22px;font-size:22px}
#gmRecordMount .gmRecordTreeRoom{padding-left:110px;min-height:48px}
#gmRecordMount [data-r-query]{width:100%;padding:12px;background:#20232b;color:white;border:1px solid #454953;border-radius:9px;box-sizing:border-box;margin-bottom:8px}

/* GM_RECORD_VIEW_V007: Only RECORD root owns its list. Leave video/group content mounted, not displayed. */
#gmGuppyApp[data-gm-surface="RECORD"][data-gm-subview="ROOT"] #gmVideoTranslationPanel,
#gmGuppyApp[data-gm-surface="RECORD"][data-gm-subview="ROOT"] #gmTreeMeetingHost,
#gmGuppyApp[data-gm-surface="RECORD"][data-gm-subview="ROOT"] #gmRealtimeConversation,
#gmGuppyApp[data-gm-surface="RECORD"][data-gm-subview="ROOT"] #gmFriendMask,
#gmGuppyApp[data-gm-surface="RECORD"][data-gm-subview="ROOT"] #gmSettingsHost{display:none!important}
/* Render date text via CSS-generated content to prevent UI auto-translation rewriting digits. */
#gmRecordMount .gmRecordYearValue::before{content:attr(data-gm-date-value) "년"}
#gmRecordMount .gmRecordMonthValue::before{content:attr(data-gm-date-value) "월"}
#gmRecordMount .gmRecordDayValue::before{content:attr(data-gm-date-value) "일"}

/* GM_RECORD_VIEW_V008: compact record tree only; do not change video or global header. */
#gmRecordMount .gmRecordTreeLine{gap:3px;min-height:42px}
#gmRecordMount .gmRecordTreeLine .gmRecordTreeToggle{width:29px;min-height:40px;padding:0;flex:0 0 29px}
#gmRecordMount .gmRecordTreeLine .gmRecordTreeTitle{min-width:0;min-height:40px;padding:0 3px;text-align:left;overflow-wrap:anywhere}
#gmRecordMount .gmRecordTreeChild{padding-left:12px}
#gmRecordMount .gmRecordTreeRoom{padding-left:40px;min-height:42px}
#gmRecordMount .gmRecordDateRow,
#gmRecordMount .gmRecordDateMonth,
#gmRecordMount .gmRecordDateDay{min-height:42px;padding:8px 10px 8px 39px;line-height:26px;font-size:17px}
#gmRecordMount .gmRecordDateMonth{padding-left:51px}
#gmRecordMount .gmRecordDateDay{padding-left:63px}
#gmRecordMount .gmRecordArrow{min-width:21px;font-size:21px;vertical-align:baseline}
#gmRecordMount .gmRecordTreeLine .gmRecordMini{flex:0 0 36px;width:36px;height:36px;font-size:21px;margin-right:2px}
#gmRecordMount .gmRecordChoiceBackdrop{position:fixed;inset:0;z-index:2147483000;background:rgba(0,0,0,.7);display:flex;align-items:flex-end;justify-content:center}
#gmRecordMount .gmRecordChoiceSheet{width:100%;max-width:640px;box-sizing:border-box;padding:0 0 max(18px,env(safe-area-inset-bottom));background:transparent;color:#fff}
#gmRecordMount .gmRecordChoiceSheet button{display:block;box-sizing:border-box;width:calc(100% - 24px);min-height:55px;margin:0 12px;text-align:left;padding:12px 22px;font:inherit;font-size:18px;color:#f4f4f4;background:#242830;border:0;border-bottom:1px solid #40454d}
#gmRecordMount .gmRecordChoiceSheet button:first-child{border-radius:12px 12px 0 0}
#gmRecordMount .gmRecordChoiceSheet button:last-child{margin-top:12px;text-align:center;border-radius:3px;border:0}

/* GM_RECORD_VIEW_V010: RECORD date rows only. No navigation/surface visibility changes. */
#gmRecordMount .gmRecordMonthValue::before{content:attr(data-gm-date-value)}
#gmRecordMount .gmRecordDayValue::before{content:attr(data-gm-date-value)}
#gmRecordMount .gmRecordDateRow{display:flex;align-items:center;column-gap:5px;box-sizing:border-box;height:45px;min-height:45px;padding-top:0;padding-bottom:0;line-height:1.25}
#gmRecordMount .gmRecordDateMonth{padding-left:30px}
#gmRecordMount .gmRecordDateDay{padding-left:42px}
#gmRecordMount .gmRecordYearRow{padding-left:30px}
#gmRecordMount .gmRecordDateRow .gmRecordArrow{flex:0 0 19px;min-width:19px;width:19px;font-size:19px;line-height:1}
#gmRecordMount .gmRecordDateRow small{float:none;margin-left:auto;font-size:12px}
#gmRecordMount .gmRecordTreeLine .gmRecordTreeToggle{font-size:19px}
#gmRecordMount .gmRecordTreeRoom{padding-left:54px}

/* GM_RECORD_VIEW_V011: RECORD room alone owns the realtime conversation surface.
 * A previously visited VIDEO/MEETING view must not remain visible below FACE.
 * Scope only RECORD + DIRECT_ROOM; preserve all modules, DOM and lifecycle. */
#gmGuppyApp[data-gm-surface="RECORD"][data-gm-subview="DIRECT_ROOM"] #gmVideoTranslationPanel,
#gmGuppyApp[data-gm-surface="RECORD"][data-gm-subview="DIRECT_ROOM"] #gmTreeMeetingHost,
#gmGuppyApp[data-gm-surface="RECORD"][data-gm-subview="DIRECT_ROOM"] #gmFriendMask,
#gmGuppyApp[data-gm-surface="RECORD"][data-gm-subview="DIRECT_ROOM"] #gmSettingsHost{
  display:none!important;
}

/* GM_RECORD_VIEW_V013: dark RECORD management forms; no global or VIDEO styling. */
#gmRecordMount .gmRecordManageSheet{background:#191c23;border:1px solid #40454d;border-radius:15px 15px 0 0;padding:16px 0 max(18px,env(safe-area-inset-bottom));box-shadow:0 -8px 28px rgba(0,0,0,.4);max-height:85dvh;overflow-y:auto;color:#f3f4f6}
#gmRecordMount .gmRecordManageSheet .gmRecordDialogTitle{font-size:19px;font-weight:700;margin:3px 20px 12px;color:#fff}
#gmRecordMount .gmRecordManageSheet .gmRecordDialogText{white-space:pre-line;color:#e2e5ea;font-size:16px;line-height:1.55;padding:4px 20px 16px}
#gmRecordMount .gmRecordManageSheet .gmRecordDialogHint{font-size:14px;color:#bdc4ce;margin:0 20px 9px}
#gmRecordMount .gmRecordManageSheet .gmRecordDialogInput{display:block;box-sizing:border-box;width:calc(100% - 40px);padding:14px 12px;margin:0 20px 15px;background:#242830;color:#fff;border:1px solid #697383;border-radius:9px;font:inherit;font-size:18px;outline:none}
#gmRecordMount .gmRecordManageSheet .gmRecordDialogInput:focus{border-color:#82aef5}
#gmRecordMount .gmRecordManageSheet .gmRecordDanger{color:#ff9999}
#gmRecordMount .gmRecordManageSheet button:disabled{opacity:.4}
#gmRecordMount .gmRecordManageSheet button[data-action=delete]{color:#ffaaaa}
#gmRecordMount .gmRecordManageSheet button[data-action=cancel]{background:#292e38}

/* GM_SHELL_STATE_FIX_V014: VIDEO remains inside Guppy common shell.
 * Keep header and main navigation visible; no changes to player or fullscreen media controls. */
#gmGuppyApp[data-gm-surface="VIDEO"] > .utility{display:flex!important;visibility:visible!important;opacity:1!important;flex-shrink:0!important;position:relative!important;z-index:80!important}
#gmGuppyApp[data-gm-surface="VIDEO"] > .services{display:flex!important;visibility:visible!important;opacity:1!important;flex-shrink:0!important;position:relative!important;z-index:79!important}
#gmGuppyApp[data-gm-surface="VIDEO"] #gmGuppySurface{flex:1 1 auto!important;min-height:0!important;overflow-y:auto!important}

/* GM_SETTINGS_BACK_V030: retain but hide the existing conversation/tree while main settings is displayed. */
#gmGuppyApp[data-gm-surface="SETTINGS"] #gmRealtimeConversation,
#gmGuppyApp[data-gm-surface="SETTINGS"] #gmTreeMeetingHost{display:none!important}


/* GM_GUPPY_BACK_V003: One visible content owner per Guppy shell surface.
 * The main settings overlay is deliberately NOT a surface: it stays above the
 * preserved owner and must not trigger any room recreation or navigation.
 * Keep the cached/inactive DOM mounted, but never render it in a peer tab. */
#gmGuppyApp:not([data-gm-surface="MEETING"]) #gmTreeMeetingHost,
#gmGuppyApp[data-gm-surface="MEETING"]:not([data-gm-subview="MEETING_ROOT"]) #gmTreeMeetingHost,
#gmGuppyApp:not([data-gm-surface="FRIENDS"]) #gmFriendMask,
#gmGuppyApp:not([data-gm-surface="VIDEO"]) #gmVideoTranslationPanel,
#gmGuppyApp:not([data-gm-surface="MESSAGE"]) #gmDirectSurface,
#gmGuppyApp:not([data-gm-surface="RECORD"]) #gmRecordMount {
  display:none!important;
}
/* A shared realtime room belongs only to an active DIRECT/GROUP/RECORD room.
 * Outside these states, keep the existing room DOM but never show it. */
#gmGuppyApp:not([data-gm-surface="MESSAGE"]):not([data-gm-surface="MEETING"]):not([data-gm-surface="RECORD"]):not([data-gm-surface="CUSTOMER"]) #gmRealtimeConversation,
#gmGuppyApp[data-gm-surface="MESSAGE"]:not([data-gm-subview="DIRECT_ROOM"]):not([data-gm-subview="ROOM"]) #gmRealtimeConversation,
#gmGuppyApp[data-gm-surface="MEETING"]:not([data-gm-subview="GROUP_ROOM"]):not([data-gm-subview="ROOM"]) #gmRealtimeConversation,
#gmGuppyApp[data-gm-surface="RECORD"]:not([data-gm-subview="DIRECT_ROOM"]):not([data-gm-subview="ROOM"]) #gmRealtimeConversation {
  display:none!important;
}
/* On the owner surface, don't allow a stale list to overlap its room. */
#gmGuppyApp[data-gm-surface="MESSAGE"][data-gm-subview="DIRECT_ROOM"] #gmDirectSurface,
#gmGuppyApp[data-gm-surface="MESSAGE"][data-gm-subview="ROOM"] #gmDirectSurface,
#gmGuppyApp[data-gm-surface="MEETING"][data-gm-subview="GROUP_ROOM"] #gmTreeMeetingHost {
  display:none!important;
}

/* GM_GUPPY_BACK_V005: The cached DIRECT list is already rendered but may remain
 * hidden by an earlier gm-shell-room-open/body class after repeated settings
 * and peer-tab transitions. The LAYOUT-owned surface/subview is authoritative.
 * Display the list ONLY in MESSAGE root, without reopening a room, removing
 * cached nodes, or affecting SETTINGS overlay and any other peer surface. */
#gmGuppyApp[data-gm-surface="MESSAGE"][data-gm-subview="ROOT"] #gmDirectSurface.recent {
  display:block!important;
  visibility:visible!important;
}
/* The initial MESSAGE screen can also be in a non-room list subview. */
#gmGuppyApp[data-gm-surface="MESSAGE"]:not([data-gm-subview="DIRECT_ROOM"]):not([data-gm-subview="ROOM"]) #gmDirectSurface.recent {
  display:block!important;
  visibility:visible!important;
}

/* GM_GUPPY_BACK_V007: G-Talk CUSTOMER uses the existing shared DIRECT room.
 * V003's peer-surface isolation hid CUSTOMER's legitimate DIRECT_ROOM.
 * Keep the CUSTOMER list untouched in ROOT, reveal only its active room. */
#gmGuppyApp[data-gm-surface="CUSTOMER"][data-gm-subview="DIRECT_ROOM"] #gmRealtimeConversation,
#gmGuppyApp[data-gm-surface="CUSTOMER"][data-gm-subview="ROOM"] #gmRealtimeConversation {
  display:block!important;
  visibility:visible!important;
}
#gmGuppyApp[data-gm-surface="CUSTOMER"][data-gm-subview="DIRECT_ROOM"] #gmCustomerSurfaceV004,
#gmGuppyApp[data-gm-surface="CUSTOMER"][data-gm-subview="ROOM"] #gmCustomerSurfaceV004 {
  display:none!important;
}

/* GM_GUPPY_BACK_V008: CUSTOMER room is an allowed owner, not a hidden peer.
 * The V003 exclusion above is corrected at source, not overridden by a
 * lower-specificity display rule. Keep the official list hidden in room. */

/* V055: visual ellipsis only; preserve translated full text and existing button hit areas. */
#gmGuppyApp > .services > button { min-width:0; overflow:hidden; }
#gmGuppyApp > .services > button > b {
  display:block; width:100%; min-width:0; max-width:100%;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  overflow-wrap:normal; word-break:normal;
}
#gmRecordMount .gmRecordTreeLine > .gmRecordTreeTitle {
  flex:1 1 0; min-width:0; max-width:100%;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  overflow-wrap:normal; word-break:normal;
}
#gmRecordMount .gmRecordTreeHeader > strong {
  flex:1 1 0; min-width:0; white-space:nowrap;
  overflow:hidden; text-overflow:ellipsis;
}
#gmRecordMount .gmRecordTreeLine > .gmRecordTreeToggle,
#gmRecordMount .gmRecordTreeLine > .gmRecordMini,
#gmRecordMount .gmRecordTreeTools { flex-shrink:0; }
