:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #24332b;
  background: #f3f5f1;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --muted: #78867e;
  --line: #e0e7e1;
  --green: #396c50;
  --green-dark: #2e5941;
  --surface: #fff;
  --shadow: 0 12px 32px rgba(39, 62, 47, .055);
}

* { box-sizing: border-box; }

body { min-width: 320px; margin: 0; }

button, input, select, textarea { font: inherit; }

button { cursor: pointer; }

button:disabled { cursor: not-allowed; opacity: .48; }

.lab-shell { width: min(1050px, calc(100% - 36px)); margin: 0 auto; padding: 32px 0 60px; }

.page-header { margin-bottom: 24px; }

.back-link { color: #5d7565; text-decoration: none; font-size: 12px; }
.back-link:hover { color: var(--green-dark); }

.eyebrow { margin: 0 0 8px; color: #8b9a90; font-size: 9px; font-weight: 700; letter-spacing: 1.5px; }
.page-header .eyebrow { margin-top: 29px; }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(27px, 4vw, 36px); font-weight: 650; letter-spacing: -1.2px; }
h2 { margin: 0; font-size: 18px; font-weight: 620; letter-spacing: -.35px; }
h3 { margin: 0; font-size: 13px; font-weight: 620; }
.intro { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

.notice, .identity-section, .message-section, .attachment-section { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.notice { margin-bottom: 22px; padding: 17px 20px; border-color: #e6e9d7; background: #fafbf5; }
.notice strong { color: #556b4f; font-size: 12px; }
.notice p { margin: 6px 0 0; color: #78806c; font-size: 11px; line-height: 1.8; }

.identity-section, .message-section, .attachment-section { margin-bottom: 22px; padding: 22px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.section-heading .eyebrow { margin-bottom: 6px; }
.identity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.identity-card { min-width: 0; padding: 16px; border: 1px solid #edf0ed; border-radius: 12px; background: #fcfdfb; }
.identity-title { display: flex; align-items: center; gap: 11px; margin-bottom: 15px; }
.identity-title h3 { margin-bottom: 3px; }
.identity-title p { margin: 0; color: var(--muted); font-size: 10px; }
.avatar { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; font-weight: 700; }
.avatar-alice { color: #52795d; background: #e9f1e9; }
.avatar-bob { color: #69708a; background: #edf0f7; }
.identity-card dl { display: grid; grid-template-columns: 98px minmax(0, 1fr); gap: 8px 10px; margin: 0; font-size: 10px; }
.identity-card dt { color: #87938b; }
.identity-card dd { overflow: hidden; margin: 0; color: #526158; font-family: "Cascadia Code", Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }

.controls-row { display: flex; align-items: end; gap: 12px; margin: 12px 0 16px; }
.controls-row label { display: grid; gap: 6px; color: #738077; font-size: 10px; }
.controls-row select { min-width: 150px; height: 36px; padding: 0 10px; color: #33443a; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 11px; }
.direction-arrow { padding-bottom: 9px; color: #8ca093; }
.field-label { display: block; margin-bottom: 7px; color: #738077; font-size: 10px; }
textarea { display: block; width: 100%; min-height: 74px; padding: 11px 12px; resize: vertical; color: #33443a; border: 1px solid var(--line); border-radius: 9px; outline: none; font-size: 12px; line-height: 1.7; }
textarea:focus, select:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid rgba(64, 117, 80, .2); outline-offset: 2px; }
.relay-state, .size-note { margin: 0; color: #8a968e; font-size: 10px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 13px 0 16px; }
.primary-button, .secondary-button, .danger-button { min-height: 35px; padding: 0 13px; border-radius: 8px; font-size: 10px; font-weight: 600; transition: background .15s, border-color .15s; }
.primary-button { color: white; border: 1px solid var(--green); background: var(--green); }
.primary-button:hover:not(:disabled) { border-color: var(--green-dark); background: var(--green-dark); }
.secondary-button { color: #4d6656; border: 1px solid #dce6de; background: #f7faf7; }
.secondary-button:hover:not(:disabled) { border-color: #bfcfc2; background: #f0f6f1; }
.danger-button { color: #88514b; border: 1px solid #eddcda; background: #fff9f8; }
.danger-button:hover:not(:disabled) { border-color: #dfc0bb; background: #fff3f1; }

.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.result-card { min-width: 0; overflow: hidden; border: 1px solid #edf0ed; border-radius: 10px; background: #fbfcfb; }
.result-card h3 { padding: 10px 12px; color: #69786f; border-bottom: 1px solid #edf0ed; font-size: 10px; }
.result-card pre { min-height: 72px; max-height: 225px; overflow: auto; margin: 0; padding: 11px 12px; color: #5c6d62; font: 9px/1.7 "Cascadia Code", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.result-card pre.success { color: #356d4b; }
.result-card pre.error { color: #9a514a; }

input[type="file"] { display: block; width: 100%; padding: 10px; color: #66756b; border: 1px dashed #ccd8ce; border-radius: 9px; background: #fbfdfb; font-size: 10px; }
.attachment-result { min-height: 72px; padding: 12px; color: #758279; font-size: 10px; line-height: 1.7; }
.attachment-result.error { color: #9a514a; }
.attachment-result a { display: inline-flex; margin-top: 8px; color: var(--green); font-weight: 650; text-decoration: none; }
.attachment-result img { display: block; max-width: min(260px, 100%); max-height: 180px; margin-top: 9px; border-radius: 8px; object-fit: contain; }
.page-footnote { max-width: 850px; margin: 18px auto 0; color: #87928a; font-size: 10px; line-height: 1.8; text-align: center; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: min(420px, calc(100vw - 40px)); padding: 11px 14px; color: white; border-radius: 9px; background: #31473a; box-shadow: 0 8px 24px rgba(0,0,0,.14); font-size: 11px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .18s, transform .18s; }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 700px) {
  .lab-shell { width: min(100% - 24px, 560px); padding-top: 20px; }
  .identity-section, .message-section, .attachment-section { padding: 16px; }
  .identity-grid, .result-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: start; }
  .controls-row { gap: 8px; }
  .controls-row select { min-width: 0; width: 100%; }
  .controls-row label { flex: 1; min-width: 0; }
  .button-row > button { flex: 1 1 145px; }
}
