:root{
  --brand: #0B7A3E;
  --brand2: #12A150;
  --accent: #A7F3D0;

  --text: #0B1220;
  --muted: rgba(11,18,32,.62);

  --stroke: rgba(20,30,50,.12);

  --shadow1: 0 18px 55px rgba(0,0,0,.22);
  --shadow2: 0 10px 30px rgba(0,0,0,.16);
  --shadow3: 0 2px 8px rgba(0,0,0,.10);

  --r-lg: 14px;
  --r-md: 12px;
}

*{ box-sizing: border-box; }

body{
  margin:0;
  padding:0;
  /* background:none;
  overflow-x:hidden; */
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  color: var(--text);
}

.chat-bubble-container{
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1000;
  cursor: pointer;
  user-select: none;
}

.chat-bubble{
  background: linear-gradient(180deg, rgba(11,122,62,.92), rgba(18,161,80,.82));
  color: white;
  padding: 10px 16px;
  border-radius: 14px;
  position: relative;
  font-size: 14px;
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: var(--shadow3);
  backdrop-filter: blur(10px);
}

.chat-bubble::after{
  content:"";
  position:absolute;
  right:-14px;
  top:50%;
  transform: translateY(-50%);
  border: 8px solid transparent;
  border-left-color: rgba(18,161,80,.88);
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.12));
}

.chat-icon{
  width: 65px;
  height: 65px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-2px);
  transition: transform .2s ease, box-shadow .2s ease;
  border: 1px solid rgba(255,255,255,.55);
  box-shadow: var(--shadow2);
  background: rgba(255,255,255,.65);
  backdrop-filter: blur(10px);
}

.chat-icon:hover{
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(0,0,0,.20);
}

.chat-icon-inner{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(11,122,62,.14), rgba(18,161,80,.10));
  border: 1px solid rgba(11,122,62,.22);
  position: relative;
  box-shadow: 0 10px 18px rgba(11,122,62,.12);
}

.chat-icon-inner::before{
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  width: 22px;
  height: 18px;
  transform: translate(-50%,-56%);
  border-radius: 10px;
  border: 2px solid rgba(11,122,62,.72);
}

.chat-icon-inner::after{
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%,-5%) rotate(45deg);
  background: linear-gradient(rgba(11,122,62,.72), rgba(11,122,62,.72)) center/2px 100% no-repeat,
              linear-gradient(rgba(11,122,62,.72), rgba(11,122,62,.72)) center/100% 2px no-repeat;
  border-radius: 2px;
  opacity: 0;
}

.chat-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.18);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  z-index: 999;
}

.chat-overlay.is-open{
  opacity: 1;
  pointer-events: auto;
}

#cw-chat-window{
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 520px;
  height: 600px;
  min-width: 250px;
  min-height: 200px;
  background: rgba(255,255,255,.62);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: var(--r-lg);
  resize: none;
  overflow: clip;
  box-shadow: var(--shadow1);
  backdrop-filter: blur(22px) saturate(140%);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(14px) scale(.98);
  pointer-events: none;
  visibility: hidden;
  transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
  z-index: 1000;
}

#cw-chat-window.is-open{
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

#cw-chat-header{
  background: linear-gradient(90deg, var(--brand), var(--brand2));
  color: white;
  font-weight: 900;
  font-size: 16px;
  padding: 10px 12px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-top-left-radius: var(--r-lg);
  border-top-right-radius: var(--r-lg);
  letter-spacing: .2px;
}

#cw-window-controls{
  display:flex;
  align-items:center;
  gap: 6px;
}

#cw-window-controls button{
  background: rgba(255,255,255,.14);
  color: white;
  border: 1px solid rgba(255,255,255,.25);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 10px;
  line-height: 1;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}

#cw-window-controls button:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.20);
  border-color: rgba(255,255,255,.35);
}

.resize-handle.top,
.resize-handle.left,
.resize-handle.topleft{
  position:absolute;
  background: transparent;
}

.resize-handle.top{
  top: 0;
  left: 14px;
  width: calc(100% - 14px);
  height: 5px;
  cursor: ns-resize;
  z-index: 5;
}

.resize-handle.left{
  top: 14px;
  left: 0;
  height: calc(100% - 14px);
  width: 5px;
  cursor: ew-resize;
  z-index: 5;
}

.resize-handle.topleft{
  top: 0;
  left: 0;
  width: 15px;
  height: 15px;
  cursor: nwse-resize;
  z-index: 10;
}

#cw-chat-log{
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background:
    radial-gradient(1200px 600px at 10% 0%, rgba(11,122,62,.14), transparent 60%),
    radial-gradient(1000px 700px at 100% 0%, rgba(167,243,208,.24), transparent 55%),
    rgba(255,255,255,.10);
  border-top: 1px solid rgba(255,255,255,.28);
  border-bottom: 1px solid rgba(20,30,50,.08);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-overflow-scrolling: touch;
}

#cw-chat-log::-webkit-scrollbar{ width: 10px; }
#cw-chat-log::-webkit-scrollbar-track{ background: rgba(0,0,0,.05); }
#cw-chat-log::-webkit-scrollbar-thumb{
  background: rgba(11,122,62,.22);
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.35);
}

.message{
  display:flex;
  align-items:flex-start;
  margin-bottom: 6px;
}

.message-body{
  display:flex;
  flex-direction: column;
  align-items:flex-start;
}

.message.bot{
  flex-direction: row;
  justify-content: flex-start;
}

.message.user{
  flex-direction: row-reverse;
  justify-content: flex-end;
  align-self: flex-end;
}

.avatar{
  width: 36px;
  height: 36px;
  border-radius: 999px;
  margin: 0 6px;
  flex-shrink: 0;
  position: relative;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(11,122,62,.18);
  box-shadow: 0 2px 10px rgba(0,0,0,.10);
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.avatar::before{
  content:"";
  position:absolute;
  left:50%;
  top: 11px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  transform: translateX(-50%);
  background: rgba(11,18,32,.62);
  opacity: .85;
}

.avatar::after{
  content:"";
  position:absolute;
  left:50%;
  top: 20px;
  width: 22px;
  height: 14px;
  border-radius: 999px 999px 10px 10px;
  transform: translateX(-50%);
  background: rgba(11,18,32,.55);
  opacity: .85;
}

.avatar.bot{
  border-color: rgba(11,122,62,.22);
  box-shadow: 0 6px 16px rgba(11,122,62,.14);
}

.avatar.user{
  border-color: rgba(18,161,80,.22);
  box-shadow: 0 6px 16px rgba(18,161,80,.14);
}

.bubble{
  background: rgba(255,255,255,.58);
  padding: 10px 12px;
  border-radius: 14px;
  box-sizing: border-box;
  max-width: 90%;
  font-size: 16px;
  line-height: 1.6;
  white-space: normal;
  word-wrap: break-word;
  display: inline-block;
  border: 1px solid rgba(255,255,255,.34);
  box-shadow: 0 12px 26px rgba(0,0,0,.12);
  backdrop-filter: blur(16px) saturate(140%);
  transform-origin: 50% 100%;
}

.message.user .bubble{
  background: rgba(217,255,234,.52);
  border: 1px solid rgba(11,122,62,.22);
  box-shadow: 0 14px 28px rgba(11,122,62,.16);
  max-width: 100%;
  backdrop-filter: blur(16px) saturate(140%);
}

.bubble-pop{
  animation: bubblePop .24s ease both;
}

@keyframes bubblePop{
  0%{ transform: scale(.985); }
  60%{ transform: scale(1.012); }
  100%{ transform: scale(1); }
}

.bubble.typing{
  background: rgba(255,255,255,.55);
  border-style: dashed;
  color: rgba(11,18,32,.55);
  min-width: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.typing-dots{
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.typing-dots i{
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(11,122,62,.78);
  transform: translateY(0);
  animation: dotBounce 1.0s infinite ease-in-out;
}

.typing-dots i:nth-child(2){ animation-delay: .12s; opacity: .9; }
.typing-dots i:nth-child(3){ animation-delay: .24s; opacity: .8; }

@keyframes dotBounce{
  0%{ transform: translateY(0); opacity: .45; }
  40%{ transform: translateY(-5px); opacity: 1; }
  80%{ transform: translateY(0); opacity: .55; }
  100%{ transform: translateY(0); opacity: .45; }
}

@keyframes popInRight{
  0%{ opacity: 0; transform: translateX(10px) translateY(6px) scale(.98); }
  100%{ opacity: 1; transform: translateX(0) translateY(0) scale(1); }
}

@keyframes popInLeft{
  0%{ opacity: 0; transform: translateX(-10px) translateY(6px) scale(.98); }
  100%{ opacity: 1; transform: translateX(0) translateY(0) scale(1); }
}

.msg-enter{
  opacity: 0;
}

.msg-enter.is-in{
  opacity: 1;
}

.message.user.msg-enter.is-in{
  animation: popInRight .22s ease both;
}

.message.bot.msg-enter.is-in{
  animation: popInLeft .22s ease both;
}

.message-actions{
  display:flex;
  gap: 8px;
  margin-top: 8px;
  padding-right: 40px;
  align-items:center;
}

.message-actions .action-btn{
  position: relative;
  appearance: none;
  border: 1px solid rgba(20,30,50,.18);
  background: rgba(255,255,255,.55);
  backdrop-filter: blur(12px);
  color: rgba(11,18,32,.88);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .2px;
  padding: 7px 12px 7px 34px;
  border-radius: 999px;
  cursor:pointer;
  transition: transform .12s ease, background-color .12s ease, border-color .12s ease, box-shadow .12s ease, opacity .12s ease;
  box-shadow: 0 6px 14px rgba(0,0,0,.10);
  outline:none;
}

.message-actions .action-btn:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.72);
  border-color: rgba(20,30,50,.24);
  box-shadow: 0 12px 24px rgba(0,0,0,.14);
}

.message-actions .action-btn:active{
  transform: translateY(0px);
  box-shadow: 0 6px 14px rgba(0,0,0,.10);
}

.message-actions .action-btn:disabled{
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 6px 14px rgba(0,0,0,.08);
}

.message-actions .action-btn::before{
  content:"";
  position:absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 6px;
  border: 1px solid rgba(20,30,50,.18);
  background: rgba(255,255,255,.55);
}

.message-actions .action-good{
  border-color: rgba(11,122,62,.24);
}

.message-actions .action-good::before{
  border-color: rgba(11,122,62,.28);
  background: rgba(11,122,62,.08);
}

.message-actions .action-good::after{
  content:"";
  position:absolute;
  left: 14px;
  top: 50%;
  width: 9px;
  height: 5px;
  border-left: 2px solid rgba(11,122,62,.95);
  border-bottom: 2px solid rgba(11,122,62,.95);
  transform: translateY(-50%) rotate(-45deg);
}

.message-actions .action-bad{
  border-color: rgba(230,60,60,.25);
}

.message-actions .action-bad::before{
  border-color: rgba(230,60,60,.28);
  background: rgba(230,60,60,.08);
}

.message-actions .action-bad::after{
  content:"";
  position:absolute;
  left: 15px;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translateY(-50%) rotate(45deg);
  background:
    linear-gradient(rgba(230,60,60,.95), rgba(230,60,60,.95)) center/2px 100% no-repeat,
    linear-gradient(rgba(230,60,60,.95), rgba(230,60,60,.95)) center/100% 2px no-repeat;
  border-radius: 2px;
}

#cw-chat-input{
  display:flex;
  gap: 8px;
  flex-shrink:0;
  padding: 10px;
  width: 100%;
  background: linear-gradient(90deg, rgba(11,122,62,.92), rgba(18,161,80,.92));
  box-sizing: border-box;
  border-top: 1px solid rgba(255,255,255,.20);
}

#cw-chat-input textarea{
  flex: 1;
  padding: 10px 10px;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.92);
  color: rgba(11,18,32,.92);
  outline:none;
  resize:none;
  line-height: 1.4;
}

#cw-chat-input textarea::placeholder{
  color: rgba(11,18,32,.55);
}

#cw-chat-input textarea:focus{
  border-color: rgba(255,255,255,.55);
  box-shadow: 0 0 0 4px rgba(255,255,255,.18);
}

#cw-send-btn{
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  white-space: nowrap;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.18);
  color: white;
  font-weight: 900;
  letter-spacing: .2px;
  cursor:pointer;
  transition: transform .12s ease, background-color .12s ease, border-color .12s ease, box-shadow .12s ease, opacity .12s ease;
}

#cw-send-btn:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.26);
  border-color: rgba(255,255,255,.45);
  box-shadow: 0 12px 22px rgba(0,0,0,.16);
}

#cw-send-btn:active{
  transform: translateY(0px);
  box-shadow: none;
}

#cw-send-btn:disabled{
  cursor: not-allowed;
  opacity: .85;
  transform: none;
  box-shadow: none;
}

.btn-spinner{
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.55);
  border-top-color: rgba(255,255,255,1);
  display: none;
  animation: spin 1.0s linear infinite;
}

#cw-send-btn.is-loading .btn-spinner{
  display: inline-block;
}

#cw-send-btn.is-loading .btn-label{
  opacity: .95;
}

@keyframes spin{
  from{ transform: rotate(0deg); }
  to{ transform: rotate(360deg); }
}

@media (max-width: 600px){
  .chat-bubble-container{
    bottom: 10px;
    right: 10px;
    gap: 6px;
    flex-direction: row;
    align-items: center;
  }

  .chat-bubble{
    font-size: 14px;
    padding: 8px 12px;
    max-width: 155px;
  }

  .chat-bubble::after{
    right: -10px;
    border-width: 6px;
  }

  .chat-icon{
    width: 50px;
    height: 50px;
  }

  .chat-icon-inner{
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  #cw-chat-window{
    position: fixed;
    top: 60px;
    left: 2px;
    right: 2px;
    bottom: 0;
    width: auto;
    height: auto;
    max-height: none;
    max-width: none;
    border-radius: 0;
    z-index: 1000;
    resize: none;
    box-shadow: none;
    background: rgba(255,255,255,.58);
    border: 1px solid rgba(255,255,255,.28);
    backdrop-filter: none !important;
  }

  #cw-chat-log{
    margin-bottom: 0;
    padding: 10px;
    backdrop-filter: none !important;
  }

  #cw-chat-input{
    margin-top: 0;
    padding: 10px;
  }

  .resize-handle{
    display:none;
  }

  #cw-chat-header{
    height: 46px;
    font-size: 1rem;
    padding: 10px 12px;
  }

  .bubble{
    font-size: 1rem;
  }

  #cw-chat-input textarea,
  #cw-send-btn{
    font-size: 16px;
  }

  .message-actions{
    padding-right: 0;
  }

  .chat-icon,
  .chat-bubble{
    backdrop-filter: none !important;
  }
}

#cw-suggestions{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0 48px;
  padding: 10px 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.22);
  border: 1px solid rgba(255,255,255,.28);
  backdrop-filter: blur(12px) saturate(130%);
  box-shadow: 0 10px 22px rgba(0,0,0,.10);
}

#cw-suggestions button{
  appearance: none;
  border: 1px solid rgba(11,122,62,.22);
  background: rgba(255,255,255,.62);
  color: rgba(11,18,32,.92);
  padding: 7px 10px;
  font-size: 14px;
  font-weight: 800;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .12s ease, background-color .12s ease, border-color .12s ease, box-shadow .12s ease, opacity .12s ease;
  box-shadow: 0 8px 16px rgba(0,0,0,.10);
  backdrop-filter: blur(10px) saturate(140%);
}

#cw-suggestions button:hover{
  transform: translateY(-1px);
  background: rgba(217,255,234,.70);
  border-color: rgba(11,122,62,.30);
  box-shadow: 0 14px 26px rgba(11,122,62,.14);
}

#cw-suggestions button:active{
  transform: translateY(0);
  box-shadow: 0 8px 16px rgba(0,0,0,.10);
}

#cw-suggestions button:focus{
  outline: none;
  box-shadow: 0 0 0 4px rgba(167,243,208,.55), 0 10px 22px rgba(0,0,0,.12);
}

#cw-suggestions button:disabled{
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 8px 16px rgba(0,0,0,.08);
}

@media (max-width: 600px){
  #cw-suggestions{
    margin: 10px 0 0 0;
    padding: 10px;
  }

  #cw-suggestions button{
    font-size: 14px;
    padding: 8px 10px;
    border-radius: 12px;
    backdrop-filter: none !important;
  }
}