:root {
  --green: #28ff37;
  --green-dark: #0a7d16;
  --green-soft: #e9ffeb;
  --ink: #111111;
  --muted: #5b5b5b;
  --line: #e2e2e2;
  --paper: #ffffff;
  --bg: #f6f7f5;
  --radius: 16px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 20px 24px;
}

h1,
h2 {
  line-height: 1.2;
  margin: 0 0 12px;
}

h2 {
  font-size: 1.25rem;
}

p,
ul,
ol {
  margin: 0 0 12px;
}

ul,
ol {
  padding-left: 1.3em;
}

li + li {
  margin-top: 6px;
}

a {
  color: var(--green-dark);
}

.hero {
  text-align: center;
  padding: 24px 0 28px;
}

.hero-icon {
  border-radius: 22px;
  box-shadow: 0 6px 24px rgb(0 0 0 / 12%);
}

.hero h1 {
  font-size: 2.6rem;
  margin: 18px 0 4px;
  letter-spacing: -0.02em;
}

.slogan {
  display: inline-block;
  font-size: 1.2rem;
  font-weight: 600;
  background: var(--green);
  padding: 2px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}

.lead {
  font-size: 1.1rem;
  color: #2b2b2b;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 22px;
}

.btn {
  appearance: none;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 14px 22px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 52px;
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}

.btn-secondary {
  background: var(--paper);
  color: var(--ink);
}

.btn:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card > :last-child {
  margin-bottom: 0;
}

#meet {
  border: 2px solid var(--green);
  background: var(--green-soft);
}

.status {
  background: var(--green-soft);
  border-radius: 10px;
  padding: 10px 14px;
}

#install-prompt-button {
  width: 100%;
  margin-bottom: 12px;
}

.platforms details {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.platforms summary {
  font-weight: 600;
  cursor: pointer;
}

.platforms ol {
  margin-top: 10px;
}

.note {
  color: var(--muted);
  font-size: 0.95rem;
}

.qr {
  text-align: center;
}

.qr img {
  display: block;
  margin: 4px auto 12px;
  width: 200px;
  height: 200px;
}

.back {
  margin-bottom: 20px;
}

.declarations li {
  list-style: none;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}

.declarations {
  padding: 0;
}

.declarations li + li {
  margin-top: 10px;
}

.welcome {
  font-size: 1.15rem;
  font-weight: 600;
}

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

body.chat-open main > :not(#chat),
body.chat-open footer {
  display: none;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.chat-header h2 {
  flex: 1;
  margin: 0;
  text-align: center;
}

.link-button {
  appearance: none;
  border: 0;
  background: none;
  color: var(--green-dark);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px 0;
}

.chat-menu {
  position: relative;
}

.chat-menu summary {
  list-style: none;
  cursor: pointer;
  color: var(--green-dark);
  text-decoration: underline;
  padding: 8px 0;
}

.chat-menu summary::-webkit-details-marker {
  display: none;
}

.chat-menu-items {
  position: absolute;
  right: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-width: 220px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 12%);
  overflow: hidden;
}

.chat-menu-items button {
  appearance: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  font: inherit;
  text-align: left;
  padding: 12px 16px;
  cursor: pointer;
}

.chat-menu-items a {
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  padding: 12px 16px;
}

#chat-forget {
  color: #b00020;
}

.chat-menu-version {
  margin: 0;
  padding: 10px 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.update-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 10;
  max-width: 616px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 14px;
  padding: 10px 12px 10px 16px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 25%);
}

.update-banner .btn-primary {
  background: var(--green);
  color: var(--ink);
  border-color: var(--green);
}

.chat-log {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-log li + li {
  margin-top: 0;
}

.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 18px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

#dcb-log .msg {
  flex-direction: column;
  gap: 4px;
}

#dcb-log .msg-time {
  display: block;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

#dcb-log .msg-body {
  display: block;
}

.msg-bi {
  align-self: flex-start;
  background: var(--paper);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}

.msg-user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--paper);
  border-bottom-right-radius: 6px;
}

.msg-earlier {
  opacity: 0.55;
}

.msg-replay {
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 2px;
  line-height: 1.55;
}

.chat-panel {
  margin-bottom: 16px;
}

.voice-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.voice-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

.voice-list li + li {
  margin-top: 8px;
}

.voice-name {
  flex: 1 1 100%;
  font-weight: 600;
}

.btn-small {
  min-height: 40px;
  padding: 6px 16px;
  font-size: 0.95rem;
}

#chat-text-mode,
#chat-voice-recheck {
  width: 100%;
}

.voice-help details {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.voice-help summary {
  font-weight: 600;
  cursor: pointer;
}

.voice-help ol {
  margin-top: 10px;
}

.chat-voice-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font: inherit;
}

.chat-voice-toggle-inline {
  padding: 0 0 0.5rem;
  width: fit-content;
}

.chat-voice-toggle input {
  width: 1.1rem;
  height: 1.1rem;
}

.chat-talk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}

.chat-form textarea {
  width: 100%;
  min-height: 3.5rem;
  resize: vertical;
  font: inherit;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border, #ccc);
  border-radius: 0.35rem;
}

.chat-form {
  display: flex;
  gap: 8px;
}

.chat-form input {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 12px 16px;
  border: 2px solid var(--ink);
  border-radius: 999px;
}

.mic-button {
  min-width: 52px;
  padding: 0 12px;
}

.mic-button.listening {
  background: #b00020;
  border-color: #b00020;
  color: var(--paper);
}

.chat-form input:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

.btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.rating-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.journal-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.journal-legend summary,
.journal-part summary {
  font-weight: 600;
  cursor: pointer;
}

.journal-legend ul {
  margin-top: 10px;
}

.journal-list {
  list-style: none;
  padding: 0;
}

.journal-list > li + li {
  margin-top: 0;
}

.journal-entry h2 {
  margin-bottom: 4px;
}

.journal-part {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.journal-part > :nth-child(2) {
  margin-top: 10px;
}

.journal-dl dt {
  font-weight: 600;
}

.journal-dl dd {
  margin: 0 0 8px;
}

.compliance {
  list-style: none;
  padding: 0;
}

.badge {
  display: inline-block;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-kept {
  background: var(--green-soft);
  color: var(--green-dark);
}

.badge-violated {
  background: #ffe5e8;
  color: #b00020;
}

.badge-unchecked {
  background: #fff4d6;
  color: #7a5200;
}

.badge-not_applicable {
  background: #eeeeee;
  color: var(--muted);
}

.journal-rating {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.journal-rating textarea {
  display: block;
  width: 100%;
  font: inherit;
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 10px 0;
  resize: vertical;
}

.journal-rating .note {
  margin: 8px 0 0;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.account-more {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.account-more summary {
  font-weight: 600;
  cursor: pointer;
}

.account-more > :nth-child(2) {
  margin-top: 10px;
}

.account-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.account-form label {
  flex-basis: 100%;
}

.account-form input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-family: ui-monospace, Consolas, monospace;
  text-transform: uppercase;
  padding: 12px 16px;
  border: 2px solid var(--ink);
  border-radius: 999px;
}

.account-form input:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

.code-reveal {
  border: 2px solid var(--green);
  background: var(--green-soft);
}

.recovery-code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--paper);
  border: 1px dashed var(--ink);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  word-break: break-all;
  user-select: all;
}

.checkbox {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 4px 0 12px;
}

.checkbox input {
  width: 22px;
  height: 22px;
}

.turnstile {
  margin: 12px 0;
}

.account-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  margin: 0 0 12px;
}

.account-info dt {
  font-weight: 600;
}

.account-info dd {
  margin: 0;
}

.table-scroll {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.admin-teach-heading {
  margin-top: 1.75rem;
}

.admin-teach-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  margin: 0.75rem 0;
}

#admin-teach-chain-status {
  white-space: pre-wrap;
  margin: 0.75rem 0;
  padding: 0.65rem 0.75rem;
  border-left: 3px solid color-mix(in srgb, currentColor 35%, transparent);
}

.admin-teach-experiment {
  margin: 1.25rem 0;
  padding: 0.5rem 0;
}

.admin-teach-experiment summary {
  cursor: pointer;
  font-weight: 600;
}

.admin-teach-session-log {
  max-height: 22rem;
  overflow: auto;
  margin: 0.75rem 0;
  padding: 0.65rem 0.75rem;
  border-left: 3px solid color-mix(in srgb, currentColor 35%, transparent);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  white-space: pre-wrap;
}

.admin-teach-msg.bi {
  opacity: 0.95;
}

.admin-teach-msg.search {
  opacity: 0.75;
  font-size: 0.92em;
}

.admin-teach-session-compose {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.75rem 0 1.25rem;
}

.admin-teach-session-compose textarea {
  width: 100%;
  box-sizing: border-box;
}

#admin-teach-corpus-list {
  white-space: pre-wrap;
}

.admin-teach-corpus-controls input[type='file'] {
  max-width: 100%;
}

.admin-teach-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.admin-teach-label select {
  min-width: 16rem;
  max-width: 100%;
}

.admin-teach-ruling {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-teach-ruling textarea,
.admin-teach-ruling input {
  width: 100%;
  box-sizing: border-box;
}

.admin-teach-ruling-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.admin-disputes-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.admin-dispute-detail {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent);
}

.admin-dispute-detail textarea,
.admin-dispute-detail select,
.admin-dispute-detail .btn {
  margin: 0.35rem 0.35rem 0.35rem 0;
}

.admin-dispute-msg {
  margin: 0.35rem 0;
  white-space: pre-wrap;
}

.admin-teach-result {
  margin-top: 1rem;
}

.admin-teach-disclaimer,
.admin-teach-final {
  margin: 0.5rem 0;
}

.admin-teach-round {
  margin: 1.25rem 0;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.admin-teach-task {
  margin: 1rem 0;
  padding: 0.75rem 0;
}

.admin-teach-crit {
  margin: 0.4rem 0 0.6rem;
}

.admin-teach-crit .note {
  margin: 0.15rem 0;
}

.dcb-photo-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0 1rem;
}

.dcb-photo-preview {
  max-width: 160px;
  max-height: 160px;
  width: auto;
  height: auto;
  object-fit: cover;
  border: 1px solid var(--border, #ccc);
}

.dcb-session-photos {
  margin: 1rem 0;
}

.dcb-photo-upload {
  display: grid;
  gap: 0.35rem;
  max-width: 28rem;
  margin-bottom: 0.75rem;
}

.dcb-photo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.dcb-photo-list li {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 120px;
  font-size: 0.85rem;
}

.dcb-photo-list img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border: 1px solid var(--border, #ccc);
}

.dcb-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dcb-form input,
.dcb-form select,
.dcb-form textarea {
  font: inherit;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  width: 100%;
}

.dcb-form textarea {
  resize: vertical;
}

.dcb-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.dcb-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.dcb-columns {
  display: grid;
  gap: 16px;
  margin-top: 12px;
}

@media (min-width: 720px) {
  .dcb-columns {
    grid-template-columns: 1fr 1fr;
  }
}

.dcb-pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  margin: 0 0 12px;
}

.dcb-report-block {
  margin-bottom: 12px;
}

.dcb-report-block h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  padding: 8px 20px max(28px, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.95rem;
}

@media (min-width: 560px) {
  .actions {
    flex-direction: row;
    justify-content: center;
  }
}
