/* マチアプのミカタ チャットウィジェット（ミカタくんQ&A）
   完全静的・クライアントサイド。第1層=静的Q&A、第2層=チャットAPI（Worker）
   配色はサイト共通のコーラル（#d94f70）×ネイビー（#1d2d50）。 */
.mk-chat-fab,
.mk-chat-panel,
.mk-chat-panel * {
  box-sizing: border-box;
}
.mk-chat-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9998;
  width: 64px;
  height: 64px;
  padding: 0;
  border-radius: 50%;
  border: 3px solid #d94f70;
  background: #1d2d50;
  box-shadow: 0 6px 20px rgba(29, 45, 80, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.mk-chat-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(29, 45, 80, 0.4);
}
.mk-chat-fab img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: #1d2d50;
  pointer-events: none;
}
.mk-chat-fab-badge {
  position: absolute;
  top: -8px;
  left: -14px;
  background: #ffd166;
  color: #1d2d50;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 8px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(29, 45, 80, 0.25);
  pointer-events: none;
  white-space: nowrap;
}
.mk-chat-panel {
  position: fixed;
  right: 16px;
  bottom: 96px;
  z-index: 9999;
  width: min(380px, calc(100vw - 24px));
  height: min(580px, calc(100dvh - 120px));
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(29, 45, 80, 0.35);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  color: #2f3a4a;
}
.mk-chat-panel.mk-open {
  display: flex;
}
.mk-chat-header {
  background: #1d2d50;
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.mk-chat-header img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #1d2d50;
  border: 2px solid #d94f70;
}
.mk-chat-header-text {
  flex: 1 1 auto;
  min-width: 0;
}
.mk-chat-header-title {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.3;
}
.mk-chat-header-sub {
  font-size: 11px;
  opacity: 0.85;
  line-height: 1.3;
}
.mk-chat-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.mk-chat-close:hover {
  background: rgba(255, 255, 255, 0.28);
}
.mk-chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 12px;
  background: #fdf3f5;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mk-chat-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.mk-chat-row.mk-user {
  justify-content: flex-end;
}
.mk-chat-avatar {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: #1d2d50;
  border: 1.5px solid #d94f70;
  margin-top: 2px;
}
.mk-chat-bubble {
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.mk-chat-row.mk-bot .mk-chat-bubble {
  background: #fff;
  border: 1px solid #f0d9de;
  border-top-left-radius: 4px;
}
.mk-chat-row.mk-user .mk-chat-bubble {
  background: #d94f70;
  color: #fff;
  border-top-right-radius: 4px;
}
.mk-chat-source {
  margin-top: 8px;
  font-size: 11px;
  color: #5b6a7d;
  border-top: 1px dashed #f0d9de;
  padding-top: 6px;
  white-space: normal;
}
.mk-chat-links {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mk-chat-link-btn {
  display: inline-block;
  background: #1d2d50;
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 999px;
  line-height: 1.3;
}
.mk-chat-link-btn:hover {
  background: #d94f70;
}
.mk-chat-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 2px;
}
.mk-chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d94f70;
  opacity: 0.35;
  animation: mk-typing 1.1s infinite;
}
.mk-chat-typing span:nth-child(2) {
  animation-delay: 0.18s;
}
.mk-chat-typing span:nth-child(3) {
  animation-delay: 0.36s;
}
@keyframes mk-typing {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
.mk-chat-chips {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px 4px;
  background: #fff;
}
.mk-chat-chip {
  border: 1.5px solid #d94f70;
  background: #fff;
  color: #b83a5a;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.3;
}
.mk-chat-chip:hover {
  background: #fdf0f3;
}
.mk-chat-form {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  background: #fff;
  border-top: 1px solid #f3e3e7;
}
.mk-chat-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1.5px solid #e3ccd2;
  border-radius: 999px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  color: #2f3a4a;
  outline: none;
}
.mk-chat-input:focus {
  border-color: #d94f70;
}
.mk-chat-send {
  flex: 0 0 auto;
  border: none;
  border-radius: 999px;
  background: #d94f70;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  padding: 10px 18px;
  cursor: pointer;
}
.mk-chat-send:hover {
  background: #b83a5a;
}
.mk-chat-send:disabled {
  background: #e79db1;
  cursor: default;
}
@media (max-width: 480px) {
  .mk-chat-fab {
    right: 14px;
    bottom: 14px;
    width: 58px;
    height: 58px;
  }
  .mk-chat-fab img {
    width: 47px;
    height: 47px;
  }
  .mk-chat-panel {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 82px;
    height: min(560px, calc(100dvh - 100px));
  }
}
