/* Additions for the app. The site's own design is in styles.min.css, unchanged. */
body { padding-bottom: env(safe-area-inset-bottom); }
.header { padding-top: calc(5px + env(safe-area-inset-top)); }
html.has-js .gotop { bottom: calc(84px + var(--install-bar-height, 0px)); }
.app-message { padding: 24px 12px; font-size: 1.13rem; }
.app-message a { color: var(--main-color); }
main:empty { min-height: 100vh; }

.chat-open {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom) + var(--install-bar-height, 0px)); z-index: 900;
  min-width: 56px; height: 56px; padding: 0 18px; border: 2px solid #fff; border-radius: 28px;
  background: var(--main-color); color: #fff; font-size: 1.13rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.chat-open[hidden] { display: none; }
html.chat-is-open { overflow: hidden; }

.chat-panel {
  position: fixed; inset: 0; z-index: 1100; display: flex; flex-direction: column;
  height: 100dvh; background: #fff; color: var(--dark-color);
}
.chat-panel[hidden] { display: none; }
.chat-head {
  display: flex; align-items: center; justify-content: space-between; flex: none;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: var(--main-color); color: #fff; font-size: 1.25rem;
}
.chat-close { width: 44px; height: 44px; border: 0; background: transparent; color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; background: #f4f1f6; overscroll-behavior: contain; }
.chat-msg { max-width: 92%; margin-bottom: 10px; padding: 8px 12px; border-radius: 10px; font-size: 1.06rem; line-height: 1.35; overflow-wrap: anywhere; }
.chat-msg p { margin: 0 0 6px; }
.chat-msg p:last-child { margin-bottom: 0; }
.chat-user { margin-left: auto; width: fit-content; background: var(--main-color); color: #fff; }
.chat-bot { background: #fff; border: 1px solid #ddd; }
.chat-note { color: #555; font-size: .94rem; }

.chat-result { display: flex; gap: 10px; margin: 8px 0; padding: 8px; border: 1px solid var(--main-color); border-radius: 8px; color: var(--dark-color); text-decoration: none; }
.chat-result img { flex: none; align-self: flex-start; width: 84px; height: 70px; border-radius: 4px; object-fit: cover; }
.chat-result-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: .97rem; }
.chat-result-body strong { color: var(--main-color); font-size: 1.06rem; }
.chat-result-body small { color: #555; font-size: .87rem; }

.chat-chips { display: flex; flex: none; gap: 8px; overflow-x: auto; padding: 8px 12px 0; }
.chat-chips:empty { display: none; }
.chat-chips button { flex: none; min-height: 36px; padding: 4px 12px; border: 1px solid var(--main-color); border-radius: 18px; background: #fff; color: var(--main-color); font-size: .97rem; cursor: pointer; }

.chat-form { display: flex; flex: none; gap: 8px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
.chat-form input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid #999; border-radius: 6px; font-size: 16px; }
.chat-form input:focus-visible { outline: 2px solid var(--main-color); outline-offset: 1px; }
.chat-form button { flex: none; height: 44px; padding: 0 14px; border: 0; border-radius: 6px; background: var(--main-color); color: #fff; font-size: 1rem; cursor: pointer; }

.install-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 950; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--dark-transparent); font-size: 1rem;
}
.install-bar span { flex: 1 1 100%; }
.install-bar button { min-height: 36px; padding: 3px 10px; border: 1px solid var(--main-color); border-radius: 5px; background: #fff; color: var(--main-color); cursor: pointer; }

@media (min-width: 576px) {
  .chat-panel { inset: auto 20px 20px auto; width: 400px; height: min(640px, calc(100dvh - 40px)); border-radius: 12px; overflow: hidden; box-shadow: 0 6px 24px rgba(0, 0, 0, .35); }
  html.chat-is-open { overflow: auto; }
}
