*{box-sizing:border-box}
:root{font-family:Arial,Helvetica,sans-serif;color:#fff;background:#000}
html,body{width:600px;height:600px;margin:0;overflow:hidden;background:#000}
body{position:relative}
#app{width:600px;height:600px;background:#000;overflow:hidden}

/* HEADER */
#topBar{
  height:42px;
  padding:5px 7px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  background:#000;
}
.brand{display:flex;align-items:center;gap:8px;font-size:21px;font-weight:900}
.mark{
  width:29px;height:29px;border-radius:7px;background:#9146ff;
  display:grid;place-items:center;font-weight:900
}
#status{font-size:11px;color:#ddd;max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* COMMON */
.screen{display:none;width:600px;height:558px;overflow:hidden}
.screen.active{display:block}
button,input{
  min-height:38px;border-radius:8px;border:2px solid #3a3a40;
  background:#18181b;color:#fff;padding:7px 9px;font-size:12px;font-weight:800;outline:none
}
.purple{background:#9146ff;border-color:#9146ff}
.danger{background:#8f1d1d!important;border-color:#c43b3b!important}
.focusable:focus{border-color:#fff;box-shadow:0 0 0 3px #9146ff}

/* HOME / FAVORITES */
#homeScreen,#favoritesScreen{padding:5px 7px 6px}
.homeHeader{height:42px;display:flex;align-items:center;justify-content:space-between}
.homeHeader h1{font-size:25px;margin:0}
.homeHeader span{font-size:11px;color:#bbb}
.searchRow{display:grid;grid-template-columns:1fr 105px;gap:7px;margin-bottom:8px}
#homeSearchInput{width:100%;font-weight:700}
.channelGrid{
  display:grid;grid-template-columns:1fr 1fr;gap:7px;
  height:401px;align-content:start;overflow:hidden
}
.favoritesGrid{height:446px}
.channelButton{height:59px;text-align:left;display:flex;align-items:center;gap:8px}
.avatar{
  width:34px;height:34px;flex:0 0 34px;border-radius:50%;
  background:#9146ff;display:grid;place-items:center
}
.channelText{min-width:0}
.channelText strong{display:block;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.channelText small{display:block;font-size:9px;color:#aaa;margin-top:2px}
.favoriteStar{margin-left:auto;color:#ffd54a}
.emptyList{grid-column:1/-1;text-align:center;color:#aaa;padding:55px 0}
.menuRow{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin-top:7px}

/* WATCH: USE EVERY PIXEL, NO DEAD GAP */
.watchScrollable{
  height:558px!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  scroll-behavior:smooth;
  scroll-snap-type:y mandatory;
  scrollbar-width:none;
}
.watchScrollable::-webkit-scrollbar{display:none}
.watchPage{
  width:600px;
  height:558px;
  min-height:558px;
  scroll-snap-align:start;
  overflow:hidden;
}

/* True 16:9 edge-to-edge player */
#playerWrap{
  width:600px;
  height:338px;
  position:relative;
  overflow:hidden;
  background:#000;
  border:0;
  border-radius:0;
}
#player,#player iframe{
  width:600px!important;
  height:338px!important;
  border:0!important;
  display:block;
}
#emptyState{
  position:absolute;inset:0;background:#050505;
  display:flex;align-items:center;justify-content:center;flex-direction:column
}
#emptyState.hidden{display:none}
.playIcon{
  width:62px;height:62px;border-radius:50%;background:#9146ff;
  display:grid;place-items:center;font-size:28px;margin-bottom:10px
}

#channelBar{
  height:44px;
  padding:4px 7px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.channelMeta{min-width:0}
#channelName{
  font-size:17px;font-weight:900;max-width:465px;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis
}
#channelState{font-size:10px;color:#bbb;margin-top:1px}
#livePill{
  padding:4px 7px;border-radius:5px;background:#333;color:#bbb;
  font-size:10px;font-weight:900
}
#livePill.live{background:#e91916;color:#fff}

.controlGrid{
  padding:0 6px;
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:5px;
}
.controlGrid button{min-height:37px;padding:5px;font-size:11px}
.chatJump{
  width:588px;
  margin:5px 6px 0;
  min-height:31px;
  height:31px;
  padding:3px;
  background:#261638;
  border-color:#5d2d87;
}

/* CHAT PAGE */
.chatPage{padding:5px 6px 6px}
.chatHeader{
  height:42px;
  display:grid;
  grid-template-columns:90px 1fr 80px;
  gap:6px;
  align-items:center
}
.chatHeader>div{text-align:center}
.chatHeader strong{display:block;font-size:17px}
.chatHeader span{display:block;font-size:10px;color:#bbb}
.backVideo,.closeSmall{min-height:33px;height:33px;padding:4px}
#chatWrap{
  width:588px;
  height:458px;
  border:2px solid #333;
  border-radius:9px;
  overflow:hidden;
  background:#050505
}
#chatFrame{width:100%;height:100%;border:0}
#chatEmpty{
  width:100%;height:100%;display:flex;
  align-items:center;justify-content:center;color:#aaa
}
#chatEmpty.hidden{display:none}
.chatBottom{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:6px;
  margin-top:6px
}
.chatBottom button{min-height:38px}

/* FULLSCREEN - SAME PLAYER, FILL THE 600x600 SQUARE.
   Player iframe becomes a 16:9 1067x600 viewport and is center-cropped. */
#fullControls{display:none}
body.fullMode #topBar{display:none!important}
body.fullMode #app{width:600px;height:600px;overflow:hidden}
body.fullMode #watchScreen{
  display:block!important;
  position:fixed!important;
  inset:0!important;
  width:600px!important;
  height:600px!important;
  overflow:hidden!important;
  z-index:20
}
body.fullMode #watchTop{
  position:fixed!important;
  inset:0!important;
  width:600px!important;
  height:600px!important;
  overflow:hidden!important
}
body.fullMode #channelBar,
body.fullMode #normalControls,
body.fullMode .chatJump{display:none!important}
body.fullMode #playerWrap{
  position:fixed!important;
  inset:0!important;
  width:600px!important;
  height:600px!important;
  overflow:hidden!important;
  background:#000!important;
  z-index:21
}
body.fullMode #player{
  position:absolute!important;
  left:50%!important;
  top:0!important;
  width:1067px!important;
  height:600px!important;
  transform:translateX(-50%)!important
}
body.fullMode #player iframe{
  width:1067px!important;
  height:600px!important;
  max-width:none!important
}
body.fullMode #fullControls{
  display:grid!important;
  grid-template-columns:repeat(4,1fr);
  gap:6px;
  position:fixed;
  left:7px;right:7px;bottom:7px;
  z-index:30
}
body.fullMode #fullControls button{
  min-height:38px;
  background:rgba(12,8,18,.88)
}
body.fullMode #fullControls .returnPlayer{
  grid-column:1/-1;
  min-height:44px;
  background:#9146ff
}
body.fullMode #fullControls .danger{grid-column:1/-1}

/* v2.9: clean viewer, only HOME / MUTE / PLAY */
#watchTop{
  height:558px!important;
  min-height:558px!important;
}

/* Larger viewer: 600x420 display window.
   The Twitch 16:9 iframe is 747x420 and center-cropped by ~73px each side. */
#playerWrap{
  width:600px!important;
  height:420px!important;
  overflow:hidden!important;
}
#player{
  position:absolute!important;
  left:50%!important;
  top:0!important;
  width:747px!important;
  height:420px!important;
  transform:translateX(-50%)!important;
}
#player iframe{
  width:747px!important;
  height:420px!important;
  max-width:none!important;
}

/* Compact channel information */
#channelBar{
  height:45px!important;
  padding:4px 8px!important;
}
#channelName{
  font-size:16px!important;
}
#channelState{
  font-size:9px!important;
}

/* Only three small controls */
.viewerControls{
  width:588px;
  margin:5px 6px 0;
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:6px;
}
.viewerControls button{
  height:34px!important;
  min-height:34px!important;
  padding:3px 6px!important;
  font-size:11px!important;
}

/* Chat occupies almost all of the second 600px page */
.chatPage{
  height:558px!important;
  min-height:558px!important;
  padding:4px 6px 5px!important;
}
.simpleChatHeader{
  height:32px!important;
  display:flex!important;
  justify-content:center!important;
  align-items:center!important;
  text-align:center!important;
}
.simpleChatHeader strong{
  font-size:15px!important;
}
.simpleChatHeader span{
  font-size:9px!important;
}
#chatWrap{
  width:588px!important;
  height:516px!important;
}

/* Fullscreen overlay only has HOME / MUTE / PLAY */
body.fullMode #fullControls{
  grid-template-columns:repeat(3,1fr)!important;
  left:8px!important;
  right:8px!important;
  bottom:8px!important;
}
body.fullMode #fullControls button{
  min-height:34px!important;
  height:34px!important;
  padding:3px 6px!important;
  font-size:11px!important;
}

/* v3.0 clean 600x600 viewer */
#watchTop{
  height:558px!important;
  min-height:558px!important;
}

/* 600x470 viewport, 16:9 source center-cropped */
#playerWrap{
  width:600px!important;
  height:470px!important;
  overflow:hidden!important;
  position:relative!important;
}
#player{
  position:absolute!important;
  left:50%!important;
  top:0!important;
  width:836px!important;
  height:470px!important;
  transform:translateX(-50%)!important;
}
#player iframe{
  width:836px!important;
  height:470px!important;
  max-width:none!important;
}

#channelBar{
  height:43px!important;
  padding:3px 8px!important;
}
#channelName{font-size:15px!important}
#channelState{font-size:9px!important}

.viewerControls{
  width:588px!important;
  margin:4px 6px 0!important;
  display:grid!important;
  grid-template-columns:repeat(3,1fr)!important;
  gap:5px!important;
}
.viewerControls button{
  height:35px!important;
  min-height:35px!important;
  padding:3px 5px!important;
  font-size:11px!important;
}

/* Chat is still the second scroll page, but there is no Chat button. */
.chatPage{
  height:558px!important;
  min-height:558px!important;
}
#chatWrap{
  height:516px!important;
}

/* Remove any old fullscreen UI/style effects. */
#fullControls{display:none!important}
body.fullMode #fullControls{display:none!important}

/* v3.1: Favorite button restored */
.viewerControls{
  grid-template-columns:repeat(4,1fr)!important;
}
.viewerControls button{
  font-size:10px!important;
  padding:3px 4px!important;
}

/* v3.2 TG logo */
.brandLogo{
  width:38px;
  height:28px;
  object-fit:contain;
  display:block;
  flex:0 0 auto;
}
