.sgpt-webapp,
.sgpt-webapp * {
  box-sizing: border-box;
}

html.skolegpt-wp-fullscreen-root,
body.skolegpt-wp-fullscreen-page {
  width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  margin: 0 !important;
  overflow: hidden !important;
}

body.skolegpt-wp-fullscreen-page > :not(#skolegpt-wp-app):not(#wpadminbar):not(script):not(style):not(link) {
  display: none !important;
}

.sgpt-webapp {
  --sgpt-wp-admin-offset: 0px;
  --sgpt-bg: #f9f9f9;
  --sgpt-surface: #ffffff;
  --sgpt-header: #edf4e5;
  --sgpt-header-text: #24301f;
  --sgpt-border: #d8e8d0;
  --sgpt-border-strong: #b8d0ad;
  --sgpt-text: #24301f;
  --sgpt-muted: #66725f;
  --sgpt-user: #e3effd;
  --sgpt-green: #5e834b;
  --sgpt-green-dark: #2f6d46;
  --sgpt-danger: #d93025;
  --sgpt-shadow: 0 10px 24px rgba(36, 48, 31, 0.10);
  position: fixed !important;
  inset: var(--sgpt-wp-admin-offset) 0 0 0 !important;
  z-index: 2147483000 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  min-height: 0;
  height: calc(100vh - var(--sgpt-wp-admin-offset)) !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  color: var(--sgpt-text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color-scheme: light;
  background: var(--sgpt-bg);
  overflow: hidden !important;
  isolation: isolate;
  transform: none !important;
  contain: layout style paint;
}

@supports (height: 100dvh) {
  .sgpt-webapp {
    height: calc(100dvh - var(--sgpt-wp-admin-offset)) !important;
  }
}

body.admin-bar .sgpt-webapp {
  --sgpt-wp-admin-offset: 32px;
}

@media (max-width: 782px) {
  body.admin-bar .sgpt-webapp {
    --sgpt-wp-admin-offset: 46px;
  }
}

body.skolegpt-wp-fullscreen-page {
  overflow: hidden;
}

body.skolegpt-wp-fullscreen-page .sgpt-webapp {
  background: var(--sgpt-bg);
}

.sgpt-webapp button,
.sgpt-webapp input,
.sgpt-webapp textarea,
.sgpt-webapp select {
  font: inherit;
}

.sgpt-webapp input:not([type="file"]):not([type="hidden"]),
.sgpt-webapp textarea,
.sgpt-webapp select {
  appearance: none;
  background-color: #ffffff !important;
  background-image: none !important;
  color: #263422 !important;
  -webkit-text-fill-color: #263422;
  caret-color: #263422;
  color-scheme: light;
}

.sgpt-webapp input::placeholder,
.sgpt-webapp textarea::placeholder {
  color: #8a8f86 !important;
  -webkit-text-fill-color: #8a8f86;
  opacity: 1;
}

.sgpt-shell {
  display: grid;
  grid-template-columns: clamp(260px, 22vw, 340px) minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--sgpt-bg);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.sgpt-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #f4f8ef;
  border-right: 1px solid var(--sgpt-border);
  overflow: hidden;
}

.sgpt-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px 16px 12px;
  background: #f4f8ef;
  border-bottom: 0;
}

.sgpt-brand {
  appearance: none !important;
  -webkit-appearance: none !important;
  border: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  line-height: 0;
  min-height: 0;
  min-width: 0;
  width: 100%;
  color: var(--sgpt-header-text);
  cursor: pointer;
  user-select: none;
}

.sgpt-brand img {
  width: min(168px, 100%);
  max-height: 64px;
  height: auto;
  object-fit: contain;
  object-position: center;
  display: block;
  background: transparent !important;
}

.sgpt-history {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.sgpt-history-title {
  color: #7a856f;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin: 6px 4px 10px;
  text-transform: uppercase;
}

.sgpt-history-item {
  position: relative;
  width: 100%;
  display: block;
  border: 1px solid #edf1e7;
  background: #ffffff;
  border-radius: 8px;
  color: var(--sgpt-text);
  padding: 10px 42px 10px 8px;
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, opacity 0.16s ease;
}

.sgpt-history-item:hover,
.sgpt-history-item:focus,
.sgpt-history-item:focus-within,
.sgpt-history-item:active {
  background: #ffffff !important;
  border-color: #edf1e7;
}

.sgpt-history-item.active {
  background: #ffffff;
  border-color: var(--sgpt-border-strong);
  box-shadow: 0 2px 8px rgba(36, 48, 31, 0.08);
}

.sgpt-history-item.dragging {
  opacity: 0.55;
  transform: scale(0.99);
}

.sgpt-history-item.drag-over,
.sgpt-history-folder-head.drag-over {
  border-color: var(--sgpt-green);
  background: #eef7ea;
}

.sgpt-history-open {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 6px;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.sgpt-history-open:hover,
.sgpt-history-open:focus,
.sgpt-history-open:active {
  background: transparent !important;
  box-shadow: none !important;
  outline: none;
}

.sgpt-history-emoji {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #edf4e5;
}

.sgpt-history-main {
  min-width: 0;
}

.sgpt-history-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 800;
}

.sgpt-history-date {
  color: var(--sgpt-muted);
  font-size: 12px;
  margin-top: 2px;
}

.sgpt-history-delete {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 28px !important;
  min-width: 28px !important;
  max-width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent !important;
  box-shadow: none !important;
  color: #77826d;
  cursor: pointer;
  display: grid;
  place-items: center;
  line-height: 0;
}

.sgpt-history-delete:hover {
  background: rgba(217, 48, 37, 0.08) !important;
  color: var(--sgpt-danger);
}

.sgpt-history-delete svg,
.sgpt-assistant-delete svg {
  width: 15px;
  height: 15px;
  display: block;
  stroke: currentColor;
}

.sgpt-history-folder {
  margin-top: 10px;
}

.sgpt-history-folder-head {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 18px auto;
  align-items: center;
  gap: 8px;
  border: 1px solid #dbe8d2;
  background: #eef7ea;
  color: #2f3f2b;
  border-radius: 8px;
  padding: 9px 10px;
  text-align: left;
  font-weight: 850;
  cursor: pointer;
  box-shadow: none;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.sgpt-history-folder-head:hover {
  border-color: var(--sgpt-border-strong);
  background: #e7f2df;
}

.sgpt-history-folder-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sgpt-history-folder-count {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #ffffff;
  color: #5e834b;
  font-size: 12px;
}

.sgpt-history-folder-caret {
  display: grid;
  place-items: center;
  color: #607058;
  font-size: 14px;
  transform-origin: center;
  transition: transform 0.16s ease;
}

.sgpt-history-folder.collapsed .sgpt-history-folder-caret {
  transform: rotate(-90deg);
}

.sgpt-history-folder-items {
  display: grid;
  gap: 8px;
  padding: 8px 0 0 12px;
  border-left: 2px solid #dbe8d2;
  margin-left: 13px;
}

.sgpt-history-folder.collapsed .sgpt-history-folder-items {
  display: none;
}

.sgpt-assistant-panel,
.sgpt-guide-panel {
  position: fixed;
  inset: var(--sgpt-wp-admin-offset) 0 0 0;
  z-index: 10020;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  box-sizing: border-box;
  padding: clamp(8px, 1.8vw, 18px);
  background: rgba(20, 28, 18, 0.28);
  overflow: hidden;
  color-scheme: light;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0s linear 0.22s;
}

.sgpt-assistant-panel.active,
.sgpt-guide-panel.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transition-delay: 0s;
}

.sgpt-assistant-panel-inner,
.sgpt-guide-panel-inner {
  width: min(760px, 100%);
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--sgpt-border);
  border-radius: 12px;
  box-shadow: -12px 0 34px rgba(36, 48, 31, 0.18);
  overflow: hidden;
  transform: translateX(36px);
  transition: transform 0.24s ease;
}

.sgpt-assistant-panel.active .sgpt-assistant-panel-inner,
.sgpt-guide-panel.active .sgpt-guide-panel-inner {
  transform: translateX(0);
}

.sgpt-assistant-panel-header,
.sgpt-guide-panel-header {
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid #edf1e7;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdf9 100%);
}

.sgpt-assistant-panel-header h3,
.sgpt-guide-panel-header h3 {
  margin: 0;
  color: #24301f;
  font-size: 22px;
}

.sgpt-assistant-panel-header p,
.sgpt-guide-panel-header p {
  margin: 5px 0 0;
  color: #697463;
  font-size: 14px;
  line-height: 1.35;
}

.sgpt-assistant-panel-body,
.sgpt-guide-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 18px 18px;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.sgpt-assistant-panel-body > *,
.sgpt-guide-panel-body > * {
  min-width: 0;
}

.sgpt-assistant-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sgpt-assistant-toolbar .sgpt-action {
  width: 100%;
  justify-content: center;
  background: var(--sgpt-green);
  border-color: var(--sgpt-green);
  color: #fff;
  font-weight: 850;
}

.sgpt-assistant-search,
.sgpt-assistant-form input,
.sgpt-assistant-form textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--sgpt-border-strong);
  border-radius: 8px;
  padding: 10px 11px;
  color: #263422 !important;
  background: #ffffff !important;
  background-color: #ffffff !important;
  background-image: none !important;
  -webkit-text-fill-color: #263422;
  caret-color: #263422;
  color-scheme: light;
}

.sgpt-assistant-form input::placeholder,
.sgpt-assistant-form textarea::placeholder {
  color: #8a8f86 !important;
  -webkit-text-fill-color: #8a8f86;
  opacity: 1;
}

.sgpt-assistant-share-preview {
  display: none;
}

.sgpt-assistant-share-preview:not(:empty) {
  display: block;
}

.sgpt-share-card,
.sgpt-assistant-qr-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--sgpt-border);
  border-radius: 8px;
  background: #fbfdf9;
  padding: 10px;
}

.sgpt-qr-thumb {
  width: 88px;
  height: 88px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.sgpt-share-card img,
.sgpt-assistant-qr-card img {
  width: 88px;
  height: 88px;
  border: 1px solid #dcebd3;
  border-radius: 6px;
  background: #fff;
}

.sgpt-share-card p,
.sgpt-assistant-qr-card p {
  margin: 4px 0 8px;
  color: #64715e;
  font-size: 12px;
  line-height: 1.35;
}

.sgpt-share-card input,
.sgpt-assistant-qr-card input {
  width: 100%;
  border: 1px solid #d4e4cc;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
}

.sgpt-quiz-share-box {
  grid-template-columns: minmax(120px, 150px) minmax(0, 1fr);
  margin-top: 14px;
}

.sgpt-quiz-share-box .sgpt-qr-thumb,
.sgpt-quiz-share-box img {
  width: 100%;
  max-width: 150px;
  height: auto;
  aspect-ratio: 1 / 1;
}

.sgpt-assistant-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.sgpt-assistant-sync-status {
  display: none;
  border: 1px solid #bcd4f7;
  background: #eaf3ff;
  color: #1f4f97;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
}

.sgpt-assistant-sync-status.active {
  display: block;
}

.sgpt-assistant-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid #edf1e7;
  border-radius: 8px;
  background: #fbfdf9;
  padding: 6px;
}

.sgpt-assistant-section + .sgpt-assistant-section {
  margin-top: 10px;
}

.sgpt-assistant-section-title {
  color: #7a856f;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 8px 6px;
}

.sgpt-assistant-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  border-radius: 8px;
  border: 1px solid transparent;
}

.sgpt-assistant-item.active {
  background: #eef6e9;
  border-color: #c7dfbc;
}

.sgpt-assistant-select {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: #263422;
  border-radius: 8px;
  padding: 9px;
  text-align: left;
  cursor: pointer;
}

.sgpt-assistant-select:hover {
  background: rgba(255, 255, 255, 0.78);
}

.sgpt-assistant-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #edf4e5;
  overflow: hidden;
  font-size: 19px;
}

.sgpt-assistant-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sgpt-assistant-meta {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.sgpt-assistant-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 850;
}

.sgpt-assistant-sub {
  color: #687460;
  font-size: 12px;
}

.sgpt-assistant-delete {
  width: 28px !important;
  min-width: 28px !important;
  max-width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  flex: 0 0 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent !important;
  box-shadow: none !important;
  color: #66725f;
  cursor: pointer;
  display: grid;
  place-items: center;
  line-height: 0;
}

.sgpt-assistant-delete:hover {
  background: rgba(217, 48, 37, 0.08) !important;
  color: var(--sgpt-danger);
}

.sgpt-assistant-empty {
  padding: 14px;
  color: #687460;
}

.sgpt-assistant-empty-note {
  max-width: 620px;
  margin: 0 auto 20px;
  color: #60705a;
  font-size: 17px;
  text-align: center;
}

.sgpt-assistant-create {
  flex: 0 0 auto;
  border: 1px solid var(--sgpt-border);
  border-radius: 10px;
  background: #fbfdf9;
  overflow: visible;
}

.sgpt-assistant-create summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #2f3f2b;
  font-weight: 850;
  padding: 12px 13px;
  list-style: none;
}

.sgpt-assistant-create summary::-webkit-details-marker {
  display: none;
}

.sgpt-assistant-create summary::before {
  content: "▸";
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: #4d6046;
  transition: transform 0.18s ease;
}

.sgpt-assistant-create[open] {
  background: #f7fbf4;
  border-color: #c7dfbc;
  box-shadow: 0 8px 22px rgba(36, 48, 31, 0.08);
}

.sgpt-assistant-create[open] summary {
  border-bottom: 1px solid #dbe8d2;
}

.sgpt-assistant-create[open] summary::before {
  transform: rotate(90deg);
}

.sgpt-assistant-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  min-width: 0;
  overflow-x: hidden;
  color-scheme: light;
}

.sgpt-assistant-form textarea {
  min-height: 120px;
  max-height: 42vh;
  resize: vertical;
}

.sgpt-assistant-edit-note {
  display: none;
  border: 1px solid #d4e4cc;
  background: #eef6e9;
  color: #394a33;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 800;
}

.sgpt-assistant-edit-note.active {
  display: block;
}

.sgpt-assistant-form-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
  background: linear-gradient(180deg, rgba(247, 251, 244, 0), #f7fbf4 34%);
  box-shadow: 0 -10px 18px rgba(247, 251, 244, 0.92);
}

.sgpt-assistant-form-actions .sgpt-action {
  min-width: 120px;
  justify-content: center;
}

.sgpt-assistant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 8px;
  min-width: 0;
}

.sgpt-assistant-basis {
  display: grid;
  gap: 8px;
}

.sgpt-assistant-basis .sgpt-action {
  width: 100%;
  min-width: 0;
  justify-content: center;
  white-space: normal;
  text-align: center;
}

.sgpt-assistant-basis-preview:empty {
  display: none;
}

.sgpt-assistant-basis-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #d4e4cc;
  background: #fbfdf9;
  border-radius: 8px;
  padding: 9px 10px;
  color: #2f3f2b;
  min-width: 0;
}

.sgpt-assistant-basis-chip div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.sgpt-assistant-basis-chip strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.sgpt-assistant-basis-chip span {
  color: #687460;
  font-size: 12px;
}

.sgpt-assistant-basis-chip button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  cursor: pointer;
  font-size: 20px;
  color: #66725f;
  line-height: 1;
}

.sgpt-assistant-basis-chip button:hover {
  background: rgba(217, 48, 37, 0.08);
  color: var(--sgpt-danger);
}

.sgpt-assistant-size-warning {
  display: none;
  border: 1px solid #e5c26c;
  border-left: 5px solid #c88d20;
  background: #fff8e7;
  color: #5d4513;
  border-radius: 8px;
  padding: 10px 11px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.sgpt-assistant-size-warning.active {
  display: block;
}

.sgpt-assistant-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px;
  padding-right: 4px;
}

.sgpt-assistant-mini {
  border: 1px solid #d4e4cc;
  background: rgba(255, 255, 255, 0.75);
  color: #4d6046;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.sgpt-assistant-mini:hover {
  background: #eef6e9;
}

.sgpt-assistant-share-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 26px;
  z-index: 4;
  min-width: 148px;
  display: grid;
  gap: 3px;
  padding: 6px;
  border: 1px solid #d4e4cc;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(36, 48, 31, 0.16);
}

.sgpt-assistant-share-menu button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #2f3f2b;
  padding: 8px 9px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.sgpt-assistant-share-menu button:hover {
  background: #eef6e9;
}

.sgpt-emoji-field {
  position: relative;
  min-width: 0;
}

.sgpt-emoji-current {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  border: 1px solid var(--sgpt-border-strong);
  border-radius: 8px;
  background: #fff;
  color: #263422;
  padding: 9px 11px;
  cursor: pointer;
  font-weight: 850;
  text-align: left;
}

.sgpt-emoji-current span:first-child {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #eef6e9;
  font-size: 24px;
}

.sgpt-emoji-current:hover,
.sgpt-emoji-current[aria-expanded="true"] {
  border-color: #9fc18f;
  background: #fbfdf9;
}

.sgpt-emoji-popover {
  position: relative;
  inset: auto;
  z-index: 5;
  width: 100%;
  min-height: 360px;
  max-height: min(560px, 70vh);
  margin-top: 8px;
  overflow-y: hidden;
  overflow-x: hidden;
  border: 1px solid rgba(36, 48, 31, 0.14);
  border-radius: 22px;
  background: #ffffff;
  padding: 10px;
  box-shadow: 0 22px 48px rgba(36, 48, 31, 0.22);
}

.sgpt-emoji-popover[hidden] {
  display: none;
}

.sgpt-emoji-host {
  width: 100%;
  min-height: 340px;
}

.sgpt-native-emoji-picker {
  width: 100%;
  height: min(510px, 66vh);
  --background: #ffffff;
  --border-color: transparent;
  --border-radius: 18px;
  --category-emoji-size: 1.2rem;
  --emoji-size: 1.9rem;
  --emoji-padding: 0.46rem;
  --indicator-color: var(--sgpt-green);
  --input-border-color: #9dc8ff;
  --input-border-radius: 18px;
  --input-font-color: #263422;
  --input-placeholder-color: #7d858b;
  --num-columns: 8;
  --outline-color: #6ca8ff;
  --skintone-border-radius: 999px;
}

.sgpt-emoji-loading,
.sgpt-emoji-fallback-note {
  color: #63705d;
  font-size: 13px;
  font-weight: 800;
  padding: 12px;
}

.sgpt-emoji-fallback-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 8px;
  max-height: min(480px, 62vh);
  overflow-y: auto;
  padding: 0 4px 4px;
}

.sgpt-emoji-fallback-grid button {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid transparent;
  background: #ffffff;
  border-radius: 12px;
  cursor: pointer;
  font-size: 30px;
  line-height: 1;
}

.sgpt-emoji-fallback-grid button:hover {
  background: #eef6e9;
  border-color: #8fb47e;
  transform: translateY(-1px);
}

.sgpt-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  overflow-x: hidden;
  background: var(--sgpt-bg);
}

.sgpt-topbar {
  background: var(--sgpt-header);
  color: var(--sgpt-header-text);
  padding: 13px 18px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  align-content: center;
  gap: 16px;
  min-width: 0;
  min-height: 64px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
  z-index: 3;
  user-select: none;
}

.sgpt-mobile-history {
  display: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(36, 48, 31, 0.22);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  color: var(--sgpt-header-text);
  cursor: pointer;
}

.sgpt-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
  margin-left: auto;
}

.sgpt-pill-btn,
.sgpt-icon-btn {
  border: 0;
  cursor: pointer;
  color: var(--sgpt-header-text);
}

.sgpt-pill-btn {
  border: 1px solid rgba(36, 48, 31, 0.22);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 800;
}

.sgpt-pill-btn:hover {
  background: rgba(255, 255, 255, 0.8);
}

.sgpt-assistant-chip {
  min-width: 0;
  max-width: 210px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(36, 48, 31, 0.22);
  background: rgba(255, 255, 255, 0.55);
  color: var(--sgpt-header-text);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  cursor: pointer;
}

.sgpt-assistant-chip:hover {
  background: rgba(255, 255, 255, 0.8);
}

.sgpt-assistant-chip span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sgpt-icon-btn {
  width: 38px;
  height: 38px;
  display: inline-grid !important;
  place-items: center !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  border-radius: 8px;
  background: transparent;
  position: relative;
  line-height: 0;
}

.sgpt-icon-btn:hover {
  background: rgba(36, 48, 31, 0.08);
}

.sgpt-icon-btn svg {
  width: 21px;
  height: 21px;
  display: block;
  stroke: currentColor;
}

.sgpt-icon-btn[data-crossed="true"]::after {
  content: "";
  position: absolute;
  width: 42px;
  height: 3px;
  border-radius: 999px;
  background: #ff4d4f;
  transform: rotate(-35deg);
  box-shadow: 0 0 0 1px rgba(120, 0, 0, 0.08);
}

.sgpt-dropdown {
  position: absolute;
  top: 48px;
  right: 0;
  width: min(320px, calc(100vw - 24px));
  display: none;
  flex-direction: column;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.15);
  max-height: min(70vh, 620px);
  overflow-y: auto;
  z-index: 8;
}

.sgpt-dropdown.active {
  display: flex;
}

.sgpt-menu-section {
  padding: 9px 15px 5px;
  color: #8a95a3;
  background: #fafbfd;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sgpt-menu-info {
  padding: 10px 15px;
  color: #596653;
  background: #fff;
  font-size: 13px;
  line-height: 1.35;
}

.sgpt-menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  min-height: 44px;
  border: 0;
  background: #fff;
  color: #333;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.sgpt-language-details {
  border-top: 1px solid #eef2eb;
  background: #fff;
}

.sgpt-menu-control {
  padding: 11px 15px 14px;
  background: #fff;
  border-top: 1px solid #eef2eb;
}

.sgpt-speed-control {
  padding-top: 10px;
}

.sgpt-menu-control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #333;
  font-size: 14px;
}

.sgpt-menu-control-head label {
  font-weight: 750;
}

.sgpt-speed-control .sgpt-menu-control-head label {
  color: #8a95a3;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sgpt-menu-control-head span {
  color: #5f7952;
  font-weight: 850;
}

.sgpt-range {
  width: 100%;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
  accent-color: var(--sgpt-green);
}

.sgpt-range:focus {
  outline: none;
}

.sgpt-range::-webkit-slider-runnable-track {
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: #d9e4d2;
}

.sgpt-range::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border: 0;
  border-radius: 50%;
  background: var(--sgpt-green);
  box-shadow: 0 1px 4px rgba(36, 48, 31, 0.18);
  appearance: none;
  -webkit-appearance: none;
}

.sgpt-range:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(92, 130, 74, 0.16);
}

.sgpt-range::-moz-range-track {
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: #d9e4d2;
}

.sgpt-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: var(--sgpt-green);
  box-shadow: 0 1px 4px rgba(36, 48, 31, 0.18);
}

.sgpt-language-details summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 15px;
  color: #333;
  font-size: 14px;
  cursor: pointer;
  list-style: none;
}

.sgpt-language-details summary::-webkit-details-marker {
  display: none;
}

.sgpt-language-details summary span {
  color: #5f7952;
  font-weight: 800;
}

.sgpt-language-select {
  width: calc(100% - 30px);
  margin: 0 15px 14px;
  border: 1px solid var(--sgpt-border-strong);
  border-radius: 8px;
  padding: 10px 11px;
  color: #263422;
  background: #fff;
}

.sgpt-menu-item:hover,
.sgpt-menu-item.active {
  background: #eef6ff;
  color: #4a90e2;
}

.sgpt-chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: clamp(18px, 3vw, 34px) clamp(16px, 3.5vw, 54px) clamp(44px, 6vh, 72px);
  background: #f9f9f9;
  line-height: 1.5;
  user-select: text;
  scroll-padding-bottom: 72px;
  overscroll-behavior: contain;
}

.sgpt-chat *:not(button):not(input):not(textarea):not(select) {
  user-select: text;
}

.sgpt-chat > * {
  flex: 0 0 auto;
}

.sgpt-empty {
  max-width: 960px;
  width: min(960px, 100%);
  margin: clamp(22px, 5vh, 54px) auto;
  display: grid;
  gap: 18px;
  color: #8a8f96;
}

.sgpt-empty h2 {
  margin: 0;
  text-align: center;
  color: #85888c;
  font-size: 28px;
}

.sgpt-suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.sgpt-suggestion {
  min-height: 72px;
  border: 1px solid var(--sgpt-border);
  background: #fbfdf9;
  color: #2b3c29;
  border-radius: 8px;
  padding: 16px 18px;
  text-align: left;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(36, 48, 31, 0.05);
}

.sgpt-suggestion:hover {
  background: #f3f9ef;
  border-color: var(--sgpt-border-strong);
}

.sgpt-disclaimer {
  max-width: 720px;
  color: #9ca1a8;
  font-size: 14px;
  text-align: center;
  margin: 0 auto;
}

.sgpt-message {
  max-width: min(900px, calc(100% - 24px));
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 16px;
  line-height: 1.55;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}

.sgpt-message p {
  margin: 0 0 0.75em;
}

.sgpt-message p:last-child {
  margin-bottom: 0;
}

.sgpt-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin: 0.45em 0 0.9em;
  border: 1px solid #dfe8d8;
  border-radius: 8px;
  background: #fbfdf9;
}

.sgpt-table-wrap table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-size: 14px;
}

.sgpt-table-wrap th,
.sgpt-table-wrap td {
  padding: 9px 10px;
  border-bottom: 1px solid #e4ecde;
  border-right: 1px solid #e4ecde;
  text-align: left;
  vertical-align: top;
}

.sgpt-table-wrap th:last-child,
.sgpt-table-wrap td:last-child {
  border-right: 0;
}

.sgpt-table-wrap tr:last-child td {
  border-bottom: 0;
}

.sgpt-table-wrap th {
  background: #eef6e9;
  color: #2f3f2b;
  font-weight: 850;
}

.sgpt-user {
  align-self: flex-end;
  margin-left: auto;
  background: var(--sgpt-user);
  color: #333;
  border-bottom-right-radius: 3px;
}

.sgpt-assistant {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid #eee;
  color: #333;
  border-bottom-left-radius: 3px;
}

.sgpt-status {
  align-self: center;
  color: #77826d;
  font-size: 13px;
  font-style: italic;
  padding: 4px 0;
}

.sgpt-tts-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sgpt-tts-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(94, 131, 75, 0.25);
  border-top-color: var(--sgpt-green);
  border-radius: 999px;
  animation: sgpt-spin 0.8s linear infinite;
}

@keyframes sgpt-spin {
  to {
    transform: rotate(360deg);
  }
}

.sgpt-source-list,
.sgpt-card {
  align-self: flex-start;
  width: min(1080px, calc(100% - 8px));
  background: #ffffff;
  border: 1px solid var(--sgpt-border);
  border-radius: 8px;
  padding: 20px;
  color: #32412e;
  box-shadow: 0 3px 16px rgba(36, 48, 31, 0.06);
  max-height: none;
  overflow: visible;
}

.sgpt-tool-card {
  align-self: center;
  width: min(1080px, calc(100% - 8px));
  margin: 4px auto 8px;
}

.sgpt-fact-card,
.sgpt-quiz-card {
  border-color: #d6e7cb;
  background: #fffefc;
  overflow-wrap: anywhere;
}

.sgpt-fact-card {
  align-self: center;
  width: min(760px, calc(100% - 24px));
  max-width: 100%;
  display: block;
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
}

.sgpt-fact-card * {
  min-width: 0;
}

.sgpt-quiz-card {
  align-self: center;
  width: min(760px, calc(100% - 24px));
  max-width: 100%;
  display: block;
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
}

.sgpt-quiz-card > *,
.sgpt-fact-card > * {
  visibility: visible !important;
}

.sgpt-quiz-meta,
.sgpt-quiz-answer-row,
.sgpt-card-actions {
  display: flex !important;
}

.sgpt-quiz-options,
.sgpt-fact-scale,
.sgpt-meter-title {
  display: grid !important;
}

.sgpt-quiz-progress,
.sgpt-quiz-body,
.sgpt-quiz-question,
.sgpt-source-hint,
.sgpt-meter-row,
.sgpt-meter-track,
.sgpt-meter-reason {
  display: block;
}

.sgpt-card h3 {
  margin: 0 0 14px;
  color: #24301f;
  font-size: 22px;
  line-height: 1.2;
}

.sgpt-guide-card {
  display: grid;
  gap: 14px;
}

.sgpt-guide-card > p {
  margin: -5px 0 0;
  color: #55634f;
  line-height: 1.5;
}

.sgpt-guide-section {
  display: grid;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid #e1edd9;
}

.sgpt-guide-section h4 {
  margin: 0;
  color: #2e3f29;
  font-size: 17px;
  line-height: 1.25;
}

.sgpt-guide-section p {
  margin: 0;
  color: #596653;
  line-height: 1.45;
}

.sgpt-guide-section ul {
  margin: 0;
  padding-left: 20px;
  color: #43513d;
  line-height: 1.5;
}

.sgpt-guide-section li + li {
  margin-top: 6px;
}

.sgpt-usage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sgpt-usage-grid .sgpt-action {
  width: 100%;
  min-height: 48px;
  text-align: left;
}

.sgpt-usage-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sgpt-usage-card {
  border: 1px solid #dcead2;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbf5 100%);
  padding: 14px;
  box-shadow: 0 1px 2px rgba(36, 48, 31, 0.05);
}

.sgpt-usage-card h4 {
  margin: 0 0 6px;
  color: #2e3f29;
  font-size: 16px;
  line-height: 1.25;
}

.sgpt-usage-card p {
  margin: 0 0 10px;
  color: #596653;
  line-height: 1.45;
}

.sgpt-usage-prompt {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid #e1edd9;
  border-radius: 8px;
  background: #ffffff;
  color: #2d3d29;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sgpt-usage-action,
.sgpt-guide-actions .sgpt-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sgpt-usage-action {
  border: 1px solid var(--sgpt-green);
  background: var(--sgpt-green);
  color: #ffffff;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 850;
  cursor: pointer;
}

.sgpt-guide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
}

.sgpt-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.sgpt-action-row {
  align-self: flex-start;
  max-width: min(900px, 86%);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: -4px 0 8px;
  padding-left: 4px;
}

.sgpt-action-row .sgpt-action {
  box-shadow: 0 2px 7px rgba(36, 48, 31, 0.06);
}

.sgpt-action {
  border: 1px solid var(--sgpt-border);
  background: #f7fbf4;
  color: #2f3f2b;
  border-radius: 8px;
  padding: 10px 13px;
  font-weight: 800;
  cursor: pointer;
}

.sgpt-action.primary {
  background: var(--sgpt-green);
  border-color: var(--sgpt-green);
  color: #fff;
}

.sgpt-action:hover {
  filter: brightness(0.98);
  transform: translateY(-1px);
}

.sgpt-source-list ol {
  margin: 0;
  padding-left: 22px;
}

.sgpt-source-list li + li {
  margin-top: 10px;
}

.sgpt-source-list a,
.sgpt-card a {
  color: var(--sgpt-green-dark);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.sgpt-attachment-strip {
  display: none;
  padding: 10px clamp(18px, 4vw, 54px) 0;
  background: #f9f9f9;
  border-top: 1px solid #e5e5e5;
}

.sgpt-attachment-strip.active {
  display: block;
}

.sgpt-attachment-chip {
  display: inline-grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  max-width: min(620px, 100%);
  border: 1px solid var(--sgpt-border);
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  color: #33402f;
}

.sgpt-attachment-thumb {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: #edf4e5;
  font-weight: 900;
}

.sgpt-attachment-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.sgpt-attachment-meta {
  min-width: 0;
}

.sgpt-attachment-sub {
  color: var(--sgpt-muted);
  font-size: 12px;
  margin-top: 2px;
}

.sgpt-remove-attachment {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  color: #66725f;
}

.sgpt-remove-attachment:hover {
  background: rgba(217, 48, 37, 0.08);
  color: var(--sgpt-danger);
}

.sgpt-composer {
  display: grid;
  grid-template-columns: 52px 52px minmax(140px, 1fr) 52px;
  align-items: end;
  gap: 12px;
  padding: 14px clamp(16px, 3.5vw, 54px) calc(18px + env(safe-area-inset-bottom));
  background: var(--sgpt-bg);
  border-top: 0;
}

.sgpt-input-wrap {
  min-width: 0;
}

.sgpt-input {
  width: 100%;
  min-height: 52px;
  max-height: 180px;
  resize: none;
  border: 1px solid #cfdcc8;
  border-radius: 26px;
  padding: 14px 18px;
  color: #263422 !important;
  background: #ffffff !important;
  background-color: #ffffff !important;
  -webkit-text-fill-color: #263422;
  outline: 0;
  line-height: 1.35;
  overflow-y: auto;
  color-scheme: light;
  box-shadow: 0 1px 4px rgba(36, 48, 31, 0.08);
}

.sgpt-input:focus {
  border-color: #8fb47e;
  box-shadow: 0 0 0 3px rgba(94, 131, 75, 0.14);
}

.sgpt-input::placeholder {
  color: #8a8f86 !important;
  -webkit-text-fill-color: #8a8f86;
}

.sgpt-composer-btn {
  width: 52px;
  height: 52px;
  display: inline-grid !important;
  place-items: center !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  border: 0;
  border-radius: 50%;
  color: #111;
  background: transparent;
  cursor: pointer;
  line-height: 0;
}

.sgpt-composer-btn:hover {
  background: #f0f0f0;
}

.sgpt-composer-btn svg {
  width: 27px;
  height: 27px;
  display: block;
  stroke: currentColor;
}

.sgpt-send {
  color: #6f6f6f;
}

.sgpt-send:hover {
  color: #24301f;
}

.sgpt-upload-wrap {
  position: relative;
}

.sgpt-upload-menu {
  position: absolute;
  left: 0;
  bottom: 62px;
  display: none;
  min-width: 260px;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.16);
  z-index: 10;
}

.sgpt-upload-menu.active {
  display: flex;
}

.sgpt-upload-menu button {
  border: 0;
  background: #fff;
  color: #333;
  cursor: pointer;
  padding: 13px 15px;
  text-align: left;
}

.sgpt-upload-menu button:hover {
  background: #f0f7ff;
  color: #4a90e2;
}

.sgpt-camera-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  place-items: center;
  background: rgba(14, 23, 12, 0.55);
  padding: 20px;
}

.sgpt-camera-modal.active {
  display: grid;
}

.sgpt-qr-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  place-items: center;
  background: rgba(14, 23, 12, 0.58);
  padding: 20px;
}

.sgpt-qr-modal.active {
  display: grid;
}

.sgpt-qr-modal-panel {
  width: min(640px, 100%);
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.25);
  padding: 16px;
}

.sgpt-qr-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  color: #24301f;
  font-size: 18px;
  font-weight: 850;
}

.sgpt-qr-modal img {
  display: block;
  width: min(520px, 100%);
  height: auto;
  margin: 0 auto;
  border: 1px solid #dcebd3;
  border-radius: 8px;
  background: #fff;
}

.sgpt-qr-modal p {
  margin: 12px 0 0;
  color: #586654;
  text-align: center;
  font-size: 14px;
}

.sgpt-camera-panel {
  width: min(720px, 100%);
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.25);
}

.sgpt-camera-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--sgpt-header);
  color: var(--sgpt-header-text);
  font-weight: 850;
}

.sgpt-camera-panel video {
  width: 100%;
  max-height: 58vh;
  display: block;
  background: #111;
}

.sgpt-camera-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 16px;
}

.sgpt-fact-scale {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  color: #5c6956;
  font-weight: 800;
  margin: 12px 0 10px;
  overflow-wrap: normal;
  word-break: normal;
}

.sgpt-fact-scale span:nth-child(2) {
  text-align: center;
}

.sgpt-fact-scale span:nth-child(3) {
  text-align: right;
}

.sgpt-meter-row {
  border-top: 1px solid var(--sgpt-border);
  padding: 14px 0;
}

.sgpt-meter-row:first-of-type {
  border-top: 0;
}

.sgpt-meter-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  color: #24301f;
  font-weight: 900;
  margin-bottom: 10px;
}

.sgpt-meter-title > span:first-child,
.sgpt-meter-title a {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

.sgpt-meter-pill {
  border: 1px solid var(--sgpt-border);
  background: #f7fbf4;
  border-radius: 999px;
  padding: 5px 10px;
  color: #607058;
  font-size: 13px;
  font-weight: 800;
  justify-self: end;
  max-width: 100%;
  white-space: normal;
  line-height: 1.25;
}

.sgpt-meter-track {
  width: 100%;
  height: 28px;
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  background:
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent calc(10% - 1px),
      rgba(36, 48, 31, 0.16) calc(10% - 1px),
      rgba(36, 48, 31, 0.16) 10%
    ),
    linear-gradient(90deg, #f2c5c0 0%, #f4edcd 50%, #cfe5c2 100%);
}

.sgpt-meter-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #24301f;
  border: 4px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
  transition: left 0.35s ease;
}

.sgpt-meter-reason {
  margin-top: 10px;
  color: #4d5948;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.45;
}

@media (max-width: 640px) {
  .sgpt-meter-title {
    grid-template-columns: 1fr;
  }

  .sgpt-meter-pill {
    justify-self: start;
  }
}

.sgpt-quiz-progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e7efdf;
  overflow: hidden;
  margin: 10px 0 18px;
}

.sgpt-quiz-progress-bar {
  height: 100%;
  width: 0;
  background: var(--sgpt-green);
  transition: width 0.2s ease;
}

.sgpt-quiz-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.sgpt-quiz-body {
  min-width: 0;
}

.sgpt-quiz-pill {
  border: 1px solid var(--sgpt-border);
  border-radius: 999px;
  background: #f7fbf4;
  color: #607058;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 800;
}

.sgpt-quiz-question {
  font-size: 19px;
  font-weight: 850;
  margin-bottom: 14px;
  line-height: 1.32;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: auto;
}

.sgpt-quiz-options {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  width: 100%;
}

.sgpt-quiz-option {
  width: 100%;
  border: 1px solid var(--sgpt-border);
  background: #fbfdf9;
  color: #2d3d29;
  border-radius: 8px;
  padding: 12px 13px;
  text-align: left;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.35;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.sgpt-quiz-actions {
  align-items: center;
}

.sgpt-quiz-option.correct {
  border-color: #7ca268;
  background: #eef7ea;
}

.sgpt-quiz-option.incorrect {
  border-color: #e6a39c;
  background: #fff1ef;
}

.sgpt-quiz-answer-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.sgpt-quiz-answer-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--sgpt-border-strong);
  border-radius: 8px;
  padding: 11px 12px;
}

.sgpt-feedback {
  margin-top: 12px;
  border-left: 5px solid #7ca268;
  background: #f3f8ef;
  border-radius: 8px;
  padding: 12px;
  color: #354830;
}

.sgpt-source-hint {
  margin-top: 8px;
  color: #66725f;
  font-size: 13px;
}

@media (max-width: 1180px) {
  .sgpt-shell {
    grid-template-columns: minmax(240px, 290px) minmax(0, 1fr);
  }

  .sgpt-topbar {
    padding: 11px 14px;
    gap: 10px;
  }

  .sgpt-controls {
    gap: 8px;
  }

  .sgpt-assistant-chip {
    max-width: 170px;
  }

  .sgpt-chat {
    padding-left: clamp(14px, 2vw, 28px);
    padding-right: clamp(14px, 2vw, 28px);
  }
}

@media (max-width: 980px) {
  .sgpt-shell {
    grid-template-columns: minmax(220px, 270px) minmax(0, 1fr);
  }

  .sgpt-brand img {
    max-height: 54px;
    width: min(148px, 100%);
  }

  .sgpt-history {
    padding: 10px;
  }

  .sgpt-history-item {
    padding-right: 36px;
  }

  .sgpt-card,
  .sgpt-source-list,
  .sgpt-fact-card,
  .sgpt-quiz-card {
    padding: 16px;
  }
}

@media (max-width: 820px) {
  .sgpt-webapp {
    height: calc(100vh - var(--sgpt-wp-admin-offset)) !important;
    min-height: 0;
  }

  .sgpt-shell {
    grid-template-columns: 1fr;
    position: relative;
  }

  .sgpt-sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    width: min(86vw, 330px);
    z-index: 20;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 14px 0 34px rgba(0, 0, 0, 0.18);
  }

  .sgpt-shell.history-open .sgpt-sidebar {
    transform: translateX(0);
  }

  .sgpt-mobile-history {
    display: grid;
    place-items: center;
  }

  .sgpt-topbar {
    justify-content: space-between;
    padding: 10px 12px;
    gap: 8px;
  }

  .sgpt-controls {
    gap: 6px;
  }

  .sgpt-assistant-chip {
    max-width: 46px;
    padding: 8px 10px;
  }

  .sgpt-assistant-chip span:last-child {
    display: none;
  }

  .sgpt-assistant-panel,
  .sgpt-guide-panel {
    justify-content: stretch;
    padding: 8px;
  }

  .sgpt-assistant-panel-inner,
  .sgpt-guide-panel-inner {
    width: 100%;
    border-left: 1px solid var(--sgpt-border);
  }

  .sgpt-assistant-panel-header,
  .sgpt-guide-panel-header {
    padding: 15px 14px 12px;
  }

  .sgpt-assistant-panel-body,
  .sgpt-guide-panel-body {
    padding: 12px 14px 16px;
  }

  .sgpt-assistant-list {
    flex: 1 1 auto;
    max-height: none;
    min-height: 180px;
  }

  .sgpt-assistant-grid {
    grid-template-columns: 1fr;
  }

  .sgpt-suggestions {
    grid-template-columns: 1fr;
  }

  .sgpt-usage-grid {
    grid-template-columns: 1fr;
  }

  .sgpt-message {
    max-width: 96%;
    font-size: 15px;
  }

  .sgpt-action-row {
    max-width: 96%;
  }

  .sgpt-composer {
    grid-template-columns: 46px 46px minmax(0, 1fr) 46px;
    gap: 8px;
    padding: 12px 12px calc(14px + env(safe-area-inset-bottom));
  }

  .sgpt-pill-btn {
    display: none;
  }
}

@media (max-width: 520px) {
  .sgpt-webapp {
    font-size: 15px;
  }

  .sgpt-sidebar {
    width: min(92vw, 340px);
  }

  .sgpt-sidebar-header {
    padding: 14px 12px 10px;
  }

  .sgpt-brand img {
    max-height: 48px;
    width: min(136px, 100%);
  }

  .sgpt-topbar {
    min-height: 56px;
    padding: 8px;
  }

  .sgpt-mobile-history,
  .sgpt-icon-btn {
    width: 34px;
    height: 34px;
  }

  .sgpt-icon-btn svg {
    width: 19px;
    height: 19px;
  }

  .sgpt-icon-btn[data-crossed="true"]::after {
    width: 34px;
    height: 2px;
  }

  .sgpt-assistant-chip {
    max-width: 40px;
    min-height: 34px;
    padding: 7px 9px;
  }

  .sgpt-chat {
    gap: 10px;
    padding: 14px 10px 92px;
  }

  .sgpt-empty {
    margin: 18px auto;
    gap: 12px;
  }

  .sgpt-empty h2 {
    font-size: 23px;
  }

  .sgpt-suggestion {
    min-height: 58px;
    padding: 13px 14px;
    font-size: 15px;
  }

  .sgpt-message {
    max-width: 100%;
    padding: 12px 13px;
    font-size: 15px;
  }

  .sgpt-card,
  .sgpt-source-list,
  .sgpt-fact-card,
  .sgpt-quiz-card {
    width: 100%;
    padding: 14px;
  }

  .sgpt-card h3 {
    font-size: 20px;
  }

  .sgpt-fact-scale {
    font-size: 12px;
    gap: 5px;
  }

  .sgpt-meter-track {
    height: 24px;
  }

  .sgpt-meter-marker {
    width: 28px;
    height: 28px;
  }

  .sgpt-share-card,
  .sgpt-assistant-qr-card {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
  }

  .sgpt-qr-thumb,
  .sgpt-share-card img,
  .sgpt-assistant-qr-card img {
    width: 72px;
    height: 72px;
  }

  .sgpt-quiz-share-box {
    grid-template-columns: minmax(0, 1fr);
  }

  .sgpt-quiz-share-box .sgpt-qr-thumb,
  .sgpt-quiz-share-box img {
    width: min(180px, 100%);
    max-width: 180px;
    height: auto;
  }

  .sgpt-composer {
    grid-template-columns: 40px 40px minmax(0, 1fr) 40px;
    gap: 6px;
    padding: 9px 8px calc(10px + env(safe-area-inset-bottom));
  }

  .sgpt-composer-btn {
    width: 40px;
    height: 40px;
  }

  .sgpt-composer-btn svg {
    width: 23px;
    height: 23px;
  }

  .sgpt-input {
    min-height: 44px;
    border-radius: 22px;
    padding: 10px 13px;
  }

  .sgpt-dropdown {
    position: fixed;
    top: calc(var(--sgpt-wp-admin-offset) + 56px);
    right: 8px;
    width: calc(100vw - 16px);
    max-height: calc(100vh - var(--sgpt-wp-admin-offset) - 72px);
  }

  .sgpt-assistant-panel,
  .sgpt-guide-panel {
    padding: 0;
  }

  .sgpt-assistant-panel-inner,
  .sgpt-guide-panel-inner {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
}
