:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-strong: #f0f4f9;
  --ink: #172033;
  --muted: #667085;
  --line: #dbe2ea;
  --blue: #1a73e8;
  --green: #19a15f;
  --amber: #c77800;
  --red: #d92d20;
  --violet: #8358d4;
  --shadow: 0 18px 48px rgba(28, 38, 55, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans SC", "Noto Sans Malay", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(25, 161, 95, 0.09), transparent 26rem),
    var(--bg);
  color: var(--ink);
}

button,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: 9.5rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 4.25rem;
  padding: 0.7rem clamp(0.85rem, 2vw, 1.4rem);
  background: rgba(247, 248, 251, 0.84);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(219, 226, 234, 0.78);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  flex: 1;
}

.brand-lockup strong,
.brand-lockup span:not(.gemini-mark) {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-lockup strong {
  font-size: 0.95rem;
}

.brand-lockup span:not(.gemini-mark) {
  color: var(--muted);
  font-size: 0.76rem;
}

.gemini-mark,
.assistant-orb {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 62% 24%, #ffffff 0 8%, transparent 9%),
    conic-gradient(from 210deg, #1a73e8, #19a15f, #fbbc04, #d92d20, #8358d4, #1a73e8);
  box-shadow: 0 8px 24px rgba(26, 115, 232, 0.2);
  flex: 0 0 auto;
}

.icon-button,
.send-button,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  color: var(--ink);
  background: transparent;
}

.icon-button {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
}

.icon-button:hover,
.control-pill:hover,
.small-button:hover {
  background: var(--surface-strong);
}

.ghost {
  color: var(--muted);
}

i,
svg {
  width: 1.1rem;
  height: 1.1rem;
  stroke-width: 2.1;
}

.language-switch select,
.field select {
  min-height: 2.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 0.85rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  outline: none;
}

.workspace {
  width: min(100%, 1160px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem clamp(0.85rem, 2vw, 1.4rem) 0;
}

.chat-feed {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.message {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
}

.message-bubble,
.progress-panel,
.result-section,
.inspector-block {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(219, 226, 234, 0.92);
  box-shadow: 0 10px 30px rgba(28, 38, 55, 0.06);
}

.message-bubble {
  border-radius: 1.55rem;
  border-top-left-radius: 0.45rem;
  padding: 1rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--blue);
  font-size: 0.73rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.45rem;
  font-size: clamp(1.45rem, 4.5vw, 2.15rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.message-bubble p:last-child,
.compact-note p,
.progress-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.progress-panel {
  border-radius: 1.25rem;
  padding: 0.95rem;
}

.progress-header,
.section-head,
.score-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.progress-header {
  margin-bottom: 0.65rem;
  font-weight: 700;
}

.progress-track {
  height: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 160ms ease;
}

.results {
  display: grid;
  gap: 1rem;
}

.results[hidden] {
  display: none;
}

.score-band {
  align-items: center;
  padding: 1rem;
  border-radius: 1.5rem;
  background:
    linear-gradient(135deg, rgba(26, 115, 232, 0.11), rgba(25, 161, 95, 0.1)),
    rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(219, 226, 234, 0.9);
}

.score-ring {
  --score: 0;
  width: 6.8rem;
  aspect-ratio: 1;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle closest-side, white 72%, transparent 73%),
    conic-gradient(var(--ring-color, var(--green)) calc(var(--score) * 1%), #d8e1eb 0);
  box-shadow: inset 0 0 0 1px rgba(219, 226, 234, 0.9);
}

.score-ring span {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

.score-ring small {
  color: var(--muted);
  font-size: 0.66rem;
  transform: translateY(-0.25rem);
}

.score-ring > * {
  grid-area: 1 / 1;
}

.score-ring small {
  align-self: end;
  margin-bottom: 1.3rem;
}

.score-band p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.48;
}

.result-section {
  border-radius: 1.25rem;
  padding: 1rem;
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.platform-card {
  min-height: 7.25rem;
  border-radius: 0.5rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.platform-card strong,
.issue-card strong {
  display: block;
}

.platform-card span {
  color: var(--muted);
  font-size: 0.8rem;
}

.platform-score {
  margin-top: 0.6rem;
  display: flex;
  align-items: end;
  gap: 0.35rem;
  font-weight: 800;
  font-size: 1.8rem;
}

.platform-score small {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
  transform: translateY(-0.28rem);
}

.soft-chip,
.severity-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.55rem;
  border-radius: 999px;
  padding: 0 0.62rem;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 720;
}

.issue-list {
  display: grid;
  gap: 0.72rem;
  margin-top: 0.9rem;
}

.issue-card {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.85rem;
  background: var(--surface);
}

.issue-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.55rem;
}

.issue-card p {
  margin-bottom: 0.45rem;
  color: var(--muted);
  line-height: 1.45;
}

.match-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.55rem 0;
}

.match-row span {
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.76rem;
  font-weight: 700;
}

.severity-critical {
  color: #ffffff;
  background: var(--red);
}

.severity-high {
  color: #7f1d1d;
  background: #fee2e2;
}

.severity-medium {
  color: #7c4a03;
  background: #fef3c7;
}

.severity-low {
  color: #14532d;
  background: #dcfce7;
}

.rewrite-tabs {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  margin: 0.9rem 0 0.7rem;
  border-radius: 999px;
  background: var(--surface-strong);
}

.rewrite-tab {
  border: 0;
  border-radius: 999px;
  min-height: 2rem;
  padding: 0 0.85rem;
  color: var(--muted);
  background: transparent;
  font-weight: 720;
}

.rewrite-tab.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(28, 38, 55, 0.08);
}

.rewrite-box {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  min-height: 8rem;
  border-radius: 0.85rem;
  padding: 0.9rem;
  background: #f8fafc;
  color: #243041;
  line-height: 1.55;
  border: 1px solid var(--line);
}

.small-button {
  gap: 0.35rem;
  min-height: 2rem;
  border-radius: 999px;
  padding: 0 0.72rem;
  font-weight: 720;
}

.advice-list {
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.advice-list li {
  position: relative;
  padding-left: 1.15rem;
  color: var(--muted);
  line-height: 1.48;
}

.advice-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.63rem;
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: var(--green);
}

.source-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.source-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.72rem 0.78rem;
  background: var(--surface);
}

.source-list a:hover {
  border-color: #b7c5d4;
}

.inspector {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.inspector-block {
  border-radius: 1.25rem;
  padding: 1rem;
}

.field {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.8rem;
  font-size: 0.86rem;
  font-weight: 720;
}

.field span {
  color: var(--muted);
}

.field select {
  width: 100%;
  border-radius: 0.8rem;
  background: var(--surface);
}

.platform-toggles {
  display: grid;
  gap: 0.5rem;
}

.platform-toggles label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.55rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  padding: 0 0.75rem;
  background: var(--surface);
  font-weight: 720;
}

.platform-toggles input {
  accent-color: var(--blue);
}

.compact-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
}

.compact-note i {
  color: var(--green);
  margin-top: 0.12rem;
}

.composer {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  width: min(100%, 760px);
  transform: translateX(-50%);
  padding: 0.7rem 0.85rem calc(0.85rem + env(safe-area-inset-bottom));
  background: rgba(247, 248, 251, 0.9);
  backdrop-filter: blur(18px);
  border-top: 1px solid rgba(219, 226, 234, 0.86);
  box-shadow: 0 -18px 40px rgba(28, 38, 55, 0.08);
}

.quick-controls,
.attachment-tray {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.55rem;
}

.control-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  border: 0;
  min-height: 2.15rem;
  border-radius: 999px;
  padding: 0 0.8rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  font-weight: 720;
  white-space: nowrap;
}

.attachment-tray[hidden] {
  display: none;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2rem;
  max-width: 15rem;
  border-radius: 999px;
  padding: 0 0.68rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 720;
}

.attachment-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.55rem;
  gap: 0.55rem;
  align-items: end;
  min-height: 3.45rem;
  border-radius: 1.7rem;
  padding: 0.6rem 0.6rem 0.6rem 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 1px solid rgba(219, 226, 234, 0.95);
}

textarea {
  width: 100%;
  max-height: 10rem;
  resize: none;
  border: 0;
  outline: none;
  padding: 0.55rem 0;
  background: transparent;
  color: var(--ink);
  line-height: 1.48;
}

textarea::placeholder {
  color: #8a94a6;
}

.send-button {
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 50%;
  color: #ffffff;
  background: #1f2937;
}

.send-button:hover {
  background: #0f172a;
}

.embed-mode {
  background: #ffffff;
}

.embed-mode .app-shell {
  min-height: 100dvh;
  padding-bottom: 8.75rem;
}

.embed-mode .topbar {
  min-height: 3.6rem;
  padding: 0.55rem 0.75rem;
  background: rgba(255, 255, 255, 0.92);
}

.embed-mode .workspace {
  width: min(100%, 760px);
  grid-template-columns: 1fr;
  padding: 0.75rem 0.75rem 0;
}

.embed-mode .inspector,
.embed-mode .sources-section {
  display: none;
}

.embed-mode .message-bubble {
  border-radius: 1.15rem;
  border-top-left-radius: 0.4rem;
}

.embed-mode h1 {
  font-size: clamp(1.25rem, 5vw, 1.55rem);
}

.embed-mode .message-bubble p:last-child {
  font-size: 0.88rem;
}

.embed-mode .composer {
  width: min(100%, 760px);
  padding: 0.58rem 0.75rem calc(0.7rem + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.9);
}

.embed-mode .prompt-bar {
  box-shadow: 0 12px 34px rgba(28, 38, 55, 0.12);
}

.empty-state {
  color: var(--muted);
  line-height: 1.45;
}

@media (min-width: 900px) {
  .app-shell {
    padding-bottom: 10rem;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr) 18rem;
    align-items: start;
  }

  .inspector {
    position: sticky;
    top: 5rem;
  }
}

@media (max-width: 620px) {
  .topbar {
    min-height: 3.85rem;
  }

  .brand-lockup span:not(.gemini-mark) {
    display: none;
  }

  .workspace {
    padding-top: 0.75rem;
  }

  .message {
    grid-template-columns: 1.8rem minmax(0, 1fr);
  }

  .gemini-mark,
  .assistant-orb {
    width: 1.8rem;
    height: 1.8rem;
  }

  .message-bubble {
    padding: 0.9rem;
  }

  .score-band {
    align-items: start;
  }

  .score-ring {
    width: 5.7rem;
  }

  .platform-grid {
    grid-template-columns: 1fr;
  }

  .inspector {
    order: -1;
  }

  .inspector-block {
    border-radius: 1rem;
  }
}
