/* Pennington on TBASE: floating button and chat panel (contract part C, Jake 2026-10-23).
   Scoped pw- classes so no TBASE page style is touched. */
.pw-root { position: relative; z-index: 1100; }

.pw-float {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 1100;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 3px solid #d9a63c;
  background: #2b4e74;
  padding: 0;
  overflow: visible;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(26, 51, 73, 0.45), 0 2px 8px rgba(26, 51, 73, 0.35);
}

/* A fixed bottom bar (the discover pages) is never covered. */
body.pw-has-bottom-bar .pw-float { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

.pw-float-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
  pointer-events: none;
}

.pw-float:focus-visible { outline: 3px solid #d9a63c; outline-offset: 3px; }

.pw-float-tip {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  background: #fff6e0;
  color: #1a3349;
  border: 2px solid #d9a63c;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  padding: 6px 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-in-out;
}

.pw-float:hover .pw-float-tip,
.pw-float:focus-visible .pw-float-tip { opacity: 1; }

.pw-panel {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 24px));
  height: min(600px, calc(100vh - 24px));
  background: #fffdf6;
  border: 3px solid #d9a63c;
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  font-family: Poppins, Arial, sans-serif;
  color: #1f2d3d;
}

.pw-panel[hidden] { display: none; }

.pw-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #2b4e74;
  color: #fff;
}

.pw-head h2 {
  flex: 1;
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
}

.pw-close {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  padding: 2px 8px 6px;
  cursor: pointer;
}

.pw-close:hover,
.pw-close:focus-visible { background: rgba(255, 255, 255, 0.16); outline: 2px solid #d9a63c; }

.pw-row {
  margin: 0;
  padding: 6px 14px 0;
  border: 0;
  background: #fffdf6;
  flex-shrink: 0;
}

.pw-row legend {
  float: left;
  padding: 0;
  margin: 3px 8px 2px 0;
  font-size: 12px;
  font-weight: 800;
  color: #2b4e74;
}

.pw-row::after { content: ""; display: block; clear: both; }

.pw-chips { display: flex; flex-wrap: wrap; gap: 4px; }

.pw-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 2px solid #c9d4e2;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #2b4e74;
  cursor: pointer;
  background: #fff;
  min-height: 34px;
}

.pw-chip:has(input:checked) { border-color: #2b4e74; background: #eef3f8; }
.pw-chip input:focus-visible { outline: 3px solid #d9a63c; outline-offset: 2px; }

.pw-lang { border-bottom: 1px solid #e6dcc4; padding-bottom: 6px; margin-bottom: 4px; }

.pw-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
}

.pw-log p {
  margin: 0;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 14.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.pw-pencil { background: #eef3f8; align-self: flex-start; max-width: 92%; }
.pw-me { background: #2b4e74; color: #fff; align-self: flex-end; max-width: 88%; }
.pw-hint { background: #fbf3df; color: #3b3323; }
.pw-notice { margin: 0; padding: 6px 14px; font-size: 12.5px; color: #8a2f2f; background: #fff1f1; }
.pw-busy { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 14px; background: #fff1f1; }
.pw-busy .pw-notice { padding: 0; background: none; }

.pw-retry {
  border: 2px solid #d9a63c;
  border-radius: 999px;
  background: #fbf3df;
  color: #3b3323;
  font-size: 12.5px;
  font-weight: 700;
  padding: 5px 11px;
  cursor: pointer;
}

.pw-retry:focus-visible { outline: 3px solid #2b4e74; outline-offset: 2px; }

.pw-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px 6px;
  border-top: 1px solid #e6dcc4;
  background: #fffdf6;
}

.pw-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.pw-input {
  grid-column: 1 / 2;
  resize: none;
  border: 2px solid #c9d4e2;
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  font-size: 14.5px;
  color: #1f2d3d;
  background: #fff;
}

.pw-input:focus-visible { outline: 3px solid #d9a63c; outline-offset: 1px; border-color: #2b4e74; }

.pw-send {
  grid-column: 2 / 3;
  align-self: stretch;
  border: 0;
  border-radius: 10px;
  background: #2b4e74;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  padding: 0 16px;
  cursor: pointer;
}

.pw-send:disabled { opacity: 0.55; cursor: default; }
.pw-send:focus-visible { outline: 3px solid #d9a63c; outline-offset: 2px; }

.pw-note {
  margin: 0;
  padding: 4px 14px 0;
  font-size: 12px;
  line-height: 1.4;
  color: #5b6b7d;
  background: #fffdf6;
}

.pw-foot { margin: 0; padding: 4px 14px 10px; font-size: 13px; background: #fffdf6; }
.pw-foot a { color: #2b4e74; font-weight: 700; }

@media (max-width: 640px) {
  .pw-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 86vh;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
  }
  .pw-float { width: 84px; height: 84px; }
  .pw-float-tip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pw-float-tip { transition: none; }
}
