/* v0.9.3 · Floating chat + bottom dock + side-button ratio pass
   Removes the permanent chat bar, returns the entire viewport to the game,
   anchors the farm deck to the bottom edge, and gives side controls a less
   flattened mobile ratio while staying on the v060 asset line. */
:root{
  --tcq-chat-window:url('./assets/ui/v060/chat_window.png?v=0930');
  --tcq-chat-button:url('./assets/ui/v060/hud_chat.png?v=0930');
}

/* The old full-width chat bar is retired. */
.chat-shell{display:none!important}

/* Floating edge chat button. Uses the original v060 chat HUD art. */
.hud-chat-edge{
  position:absolute;
  left:5px;
  top:73%;
  transform:translateY(-50%);
  z-index:9;
  width:64px;
  height:66px;
  padding:0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  filter:drop-shadow(0 3px 2px rgba(55,28,18,.38));
  overflow:visible;
  cursor:pointer;
}
.hud-chat-edge img{display:block;width:100%;height:100%;object-fit:contain;image-rendering:pixelated}
.hud-chat-edge:active{transform:translateY(calc(-50% + 2px))!important}
.hud-chat-unread{
  position:absolute;right:-2px;top:-2px;min-width:18px;height:18px;padding:0 4px;
  display:grid;place-items:center;border:2px solid #6f2b3e;border-radius:999px;
  background:#ef5d91;color:#fff;font:950 9px/1 system-ui;box-shadow:0 2px 0 #7c3243;
}
.hud-chat-unread[hidden]{display:none!important}
.hud-chat-edge.has-unread{animation:tcqChatPulse 1.1s ease-in-out infinite alternate}
@keyframes tcqChatPulse{from{filter:drop-shadow(0 3px 2px rgba(55,28,18,.38))}to{filter:drop-shadow(0 4px 5px rgba(239,93,145,.65))}}

/* Chat is now an overlay drawer based on the original chat_window asset. */
.chat-sheet{
  place-items:end center!important;
  padding:12px!important;
  background:rgba(45,27,18,.34)!important;
  backdrop-filter:blur(1px)!important;
}
.chat-drawer-panel{
  position:relative;
  width:min(700px,96vw);
  aspect-ratio:700/510;
  max-height:min(64dvh,510px);
  background-image:var(--tcq-chat-window);
  background-size:100% 100%;
  background-repeat:no-repeat;
  image-rendering:pixelated;
  filter:drop-shadow(0 12px 18px rgba(43,22,14,.38));
}
.chat-drawer-head{position:absolute;inset:0;z-index:5;pointer-events:none}
.chat-drawer-head>div{display:none}
.chat-drawer-head .tcq-close{
  pointer-events:auto;position:absolute;right:4.5%;top:7.5%;width:34px!important;height:34px!important;
  border-width:2px!important;border-radius:10px!important;font-size:21px!important;line-height:1!important;
}
.chat-drawer-panel .chat-log{
  position:absolute;z-index:2;left:7.4%;right:10.8%;top:22%;bottom:25.5%;
  max-height:none!important;min-height:0!important;margin:0!important;padding:4px 7px!important;
  overflow:auto!important;background:transparent!important;border-radius:0!important;color:#5a3021!important;
  font-size:12px!important;line-height:1.28!important;scrollbar-width:thin;
}
.chat-drawer-panel .chat-line{padding:4px 6px;margin:2px 0;border-radius:8px;background:rgba(255,248,230,.64)}
.chat-drawer-panel .chat-line.system{background:rgba(244,215,167,.72)}
.chat-drawer-panel .chat-line.system b{color:#9e6028!important}.chat-drawer-panel .chat-line.player b{color:#c63870!important}.chat-drawer-panel .chat-line.online b{color:#3b7a50!important}.chat-drawer-panel .chat-line.online span{color:#573525!important}
.chat-drawer-panel .chat-entry{
  position:absolute;z-index:3;left:7%;right:4.4%;bottom:4.5%;height:15.8%!important;
  display:grid!important;grid-template-columns:13% minmax(0,1fr) 25%!important;gap:2%!important;align-items:center!important;
  padding:0!important;border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important;
}
.chat-drawer-panel .chat-entry button{height:100%!important;border:0!important;background:transparent!important;box-shadow:none!important;padding:0!important}
.chat-drawer-panel #chatEmoji{font-size:0!important;color:transparent!important}
.chat-drawer-panel #chatInput{
  width:100%;height:68%!important;min-width:0;padding:0 8px!important;border:0!important;border-radius:8px!important;
  outline:0!important;background:rgba(255,255,255,.12)!important;color:#4c2a1d!important;font-size:16px!important;box-shadow:none!important;
}
.chat-drawer-panel #chatInput::placeholder{color:#9e8d83!important}
.chat-drawer-panel #chatSend{font-size:0!important;color:transparent!important;border:0!important;background:transparent!important;box-shadow:none!important}

/* Less flattened side rails. Keep both sides aligned row-for-row. */
@media(max-width:760px){
  :root{--tcq-chat-h:0px!important}
  html,body,main,.layout,.gamecol{width:100%!important;height:100dvh!important;min-height:0!important}
  body{padding:0!important;overflow:hidden!important}
  .gamecol{position:relative!important;display:block!important;overflow:hidden!important;background:transparent!important}
  .canvas-wrap{
    position:absolute!important;inset:0!important;width:100vw!important;height:100dvh!important;
    min-height:0!important;max-height:none!important;margin:0!important;aspect-ratio:auto!important;
    border-radius:0!important;box-shadow:none!important;overflow:hidden!important;background:#a7e3f3!important;
  }
  #game{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;object-fit:fill!important}
  .mobile-controls{position:absolute!important;inset:0!important;bottom:0!important}

  .hud-edge-rail{top:43%!important;width:72px!important;gap:5px!important}
  .hud-edge-rail.left{left:0!important}.hud-edge-rail.right{right:0!important}
  .hud-edge-btn,.hud-interact{
    width:72px!important;height:56px!important;min-height:56px!important;padding:5px 5px!important;
    grid-template-columns:24px minmax(0,1fr)!important;gap:3px!important;
    background-size:100% 100%!important;filter:drop-shadow(0 2px 1px rgba(61,31,20,.28))!important;
  }
  .hud-edge-btn>span{width:24px!important;height:26px!important;font-size:18px!important}
  .hud-edge-btn>b{font-size:7px!important;line-height:1.05!important;text-align:left!important}

  .hud-chat-edge{left:4px!important;top:74.5%!important;width:58px!important;height:61px!important}
  .hud-chat-unread{right:-1px;top:-1px;min-width:16px;height:16px;font-size:8px;border-width:1px}

  /* Bottom farm deck is attached to the viewport edge instead of floating in a blue gap. */
  .farm-command-deck{
    left:50%!important;right:auto!important;
    bottom:max(4px,env(safe-area-inset-bottom,0px))!important;
    transform:translateX(-50%)!important;
    width:calc(100% - 12px)!important;max-width:none!important;
    padding:6px 7px!important;gap:4px!important;border-radius:14px 14px 10px 10px!important;
    z-index:8!important;filter:drop-shadow(0 3px 2px rgba(58,29,18,.26));
  }
  .farm-quick-summary{min-height:20px!important;gap:5px!important}
  .farm-summary-main{gap:3px!important;flex-wrap:nowrap!important}
  .farm-ready-pill,.farm-water-pill,.farm-bag-pill{min-height:18px!important;padding:2px 5px!important;font-size:6px!important}
  .farm-target-line>b{font-size:6.5px!important}.farm-target-line>small{font-size:5px!important}
  .farm-action-row{gap:4px!important}
  .farm-action-btn{height:40px!important;grid-template-columns:20px minmax(0,1fr)!important;border-radius:9px!important;padding:3px 4px!important}
  .farm-action-btn>span{font-size:17px!important}.farm-action-btn>b{font-size:6.3px!important}
  .farm-seed-carousel{grid-template-columns:22px minmax(0,1fr) 22px!important;gap:3px!important}
  .farm-seed-stack{grid-auto-columns:88px!important;gap:3px!important}
  .farm-crop-card{height:40px!important;grid-template-columns:27px minmax(0,1fr)!important;padding:3px 4px!important}
  .farm-crop-card>img{width:26px!important;height:26px!important}.farm-crop-card b{font-size:6.3px!important}.farm-crop-card small{font-size:4.8px!important}
  .farm-seed-arrow{width:22px!important;height:32px!important;font-size:17px!important}

  .chat-sheet{padding:5px!important;padding-bottom:max(5px,env(safe-area-inset-bottom,0px))!important}
  .chat-drawer-panel{width:min(96vw,560px)!important;max-height:58dvh!important}
  .chat-drawer-head .tcq-close{right:4%!important;top:6.5%!important;width:29px!important;height:29px!important;font-size:18px!important}
  .chat-drawer-panel .chat-log{font-size:10px!important;padding:2px 4px!important}
  .chat-drawer-panel .chat-line{padding:3px 5px!important;margin:1px 0!important;border-radius:6px!important}
  .chat-drawer-panel #chatInput{font-size:16px!important;padding:0 6px!important}

  .panel{inset:6px!important;width:auto!important;max-height:none!important}
}

@media(max-width:390px){
  .hud-edge-rail{width:68px!important}.hud-edge-btn,.hud-interact{width:68px!important;height:53px!important;min-height:53px!important}
  .hud-edge-btn>b{font-size:6.3px!important}.hud-edge-btn>span{font-size:17px!important}
  .hud-chat-edge{width:54px!important;height:57px!important;top:75%!important}
  .farm-command-deck{width:calc(100% - 8px)!important;padding:5px!important}.farm-summary-main .farm-bag-pill{display:none!important}.farm-target-line>small{display:none!important}.farm-seed-stack{grid-auto-columns:82px!important}
}
