:root {
  color-scheme: light;
  --ink: #232d2a;
  --muted: #69736e;
  --line: #d9ded8;
  --paper: #fffefa;
  --canvas: #f7f5f0;
  --green: #225a4c;
  --green-dark: #18483d;
  --green-soft: #e8f0eb;
  --warning: #805625;
  --warning-bg: #fbf3e4;
  --danger: #9a4c46;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); line-height: 1.55; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid #88ad9d; outline-offset: 2px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.025em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.08rem; }
.shell { min-height: 100dvh; max-width: 1440px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 40px); display: flex; flex-direction: column; }
.site-header { min-height: 88px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { height: 39px; width: 39px; display: grid; place-items: center; border-radius: 11px; background: var(--green); color: white; font-size: 20px; font-weight: 700; }
.brand strong, .brand small { display: block; line-height: 1.2; }
.brand strong { letter-spacing: .08em; }
.brand small { margin-top: 4px; color: var(--muted); font-size: .65rem; letter-spacing: .09em; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.username { color: var(--muted); font-size: .87rem; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { flex: 1; }
.panel { border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 8px 32px rgba(28, 48, 38, .025); }
.centered { margin: 100px auto; max-width: 550px; padding: 48px; text-align: center; color: var(--muted); }
.login-view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(310px, 430px); align-items: center; gap: clamp(32px, 8vw, 120px); max-width: 1080px; margin: min(12vh, 110px) auto 80px; }
.login-intro { max-width: 530px; }
.login-intro h1 { max-width: 10ch; margin-bottom: 25px; }
.login-intro > p:last-child { color: var(--muted); max-width: 34em; line-height: 1.85; }
.eyebrow { margin-bottom: 10px; color: var(--green); font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.login-form { padding: 34px; display: flex; flex-direction: column; }
.login-form h2 { margin-bottom: 24px; }
.login-form label { font-size: .87rem; font-weight: 650; margin: 0 0 8px; }
.login-form input { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 13px; margin: 0 0 20px; background: #fff; color: var(--ink); }
.form-status { min-height: 22px; color: var(--danger); font-size: .85rem; margin: -4px 0 12px; }
.form-note { color: var(--muted); font-size: .78rem; margin: 18px 0 0; }
.button { border: 1px solid var(--line); border-radius: 10px; min-height: 40px; padding: 9px 15px; white-space: nowrap; background: white; color: var(--ink); font-weight: 620; transition: background .15s, border-color .15s, transform .15s; }
.button:hover:not(:disabled) { border-color: #aac1b4; background: #f8faf8; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button-primary { background: var(--green); border-color: var(--green); color: white; }
.button-primary:hover:not(:disabled) { background: var(--green-dark); border-color: var(--green-dark); }
.button-wide { width: 100%; min-height: 47px; }
.button-quiet { background: transparent; }
.button-text { border-color: transparent; background: transparent; padding-left: 0; color: var(--green); }
.button-danger-quiet { background: transparent; color: var(--danger); }
.button-danger-quiet:hover:not(:disabled) { background: #fdf6f4; border-color: #e6c1bc; }
.app-heading { padding: 42px 0 28px; display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.app-heading h1 { margin-bottom: 9px; }
.subtle { color: var(--muted); }
.small { font-size: .82rem; }
.app-heading .subtle { margin-bottom: 0; }
.app-layout { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: 20px; align-items: start; }
.stories-panel { padding: 22px 14px; min-height: 340px; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-heading h2, .section-heading h3 { margin-bottom: 15px; }
.count { color: var(--muted); font-size: .78rem; }
.list-status { color: var(--muted); font-size: .82rem; margin: 0 7px 10px; }
.list-status:empty { display: none; }
.stories-list { display: grid; gap: 7px; }
.story-item { width: 100%; display: block; text-align: left; border: 1px solid transparent; border-radius: 13px; padding: 13px 12px; color: var(--ink); background: transparent; white-space: normal; }
.story-item:hover, .story-item:focus-visible { background: #f3f7f3; }
.story-item.is-current { background: var(--green-soft); border-color: #cfdfd4; }
.story-item strong { display: block; font-size: .96rem; overflow-wrap: anywhere; }
.story-item span { display: block; margin-top: 4px; color: var(--muted); font-size: .74rem; }
.empty-story { min-height: 400px; padding: 80px 25px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.empty-symbol { color: #8bae9a; font-size: 40px; margin-bottom: 20px; }
.empty-story p { color: var(--muted); }
.empty-story .button { margin-top: 12px; }
.story-view { padding: clamp(18px, 3vw, 32px); min-width: 0; }
.story-toolbar { display: flex; justify-content: space-between; align-items: start; gap: 15px; border-bottom: 1px solid var(--line); padding-bottom: 22px; }
.story-title-block { min-width: 0; }
.story-title-block h2 { font-size: clamp(1.35rem, 3vw, 1.8rem); margin-bottom: 6px; overflow-wrap: anywhere; }
.story-title-block .subtle { margin-bottom: 0; }
.story-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 6px; }
.story-actions .button { min-height: 36px; padding: 6px 11px; font-size: .82rem; }
.mobile-back { display: none; }
.recording-note { display: flex; align-items: start; gap: 10px; padding: 13px 16px; margin: 24px 0 32px; border-radius: 10px; color: var(--green-dark); background: var(--green-soft); font-size: .83rem; }
.recording-note p { margin: 0; }
.note-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-top: 7px; }
.composer-section { padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.save-status { font-size: .79rem; color: var(--muted); text-align: right; }
.save-status[data-state="saved"] { color: var(--green); }
.save-status[data-state="error"], .save-status[data-state="offline"], .save-status[data-state="conflict"] { color: var(--warning); }
textarea { width: 100%; display: block; resize: vertical; min-height: 190px; border: 1px solid #cbd4cc; border-radius: 13px; padding: 17px; background: white; color: var(--ink); line-height: 1.8; font-size: 1rem; }
textarea::placeholder { color: #95a09a; }
.composer-footer { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding-top: 13px; }
.composer-footer p { max-width: 450px; margin: 0; }
.composer-actions, .inline-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 8px; }
.notice { border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px; margin-top: 12px; background: #f7f9f7; color: var(--ink); font-size: .83rem; }
.notice p { margin-bottom: 10px; }
.notice-warning { background: var(--warning-bg); border-color: #e9d7b4; color: var(--warning); }
.history-section { padding-top: 29px; }
.messages-list { display: grid; gap: 12px; }
.message { max-width: 100%; border: 1px solid var(--line); border-radius: 13px; background: #fcfcf9; padding: 15px 18px; }
.message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; }
.message time { display: block; color: var(--muted); margin-top: 12px; font-size: .72rem; }
.empty-message { color: var(--muted); font-size: .88rem; padding: 20px 0 35px; }
.site-footer { display: flex; justify-content: space-between; gap: 15px; color: var(--muted); font-size: .72rem; margin-top: 50px; padding: 23px 0 max(23px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 800px) {
  .login-view { grid-template-columns: 1fr; gap: 23px; margin: 48px auto 65px; max-width: 480px; }
  .login-intro h1 { max-width: none; font-size: 2.25rem; margin-bottom: 12px; }
  .app-layout { grid-template-columns: 1fr; }
  .stories-panel { min-height: 0; }
  .stories-panel.is-collapsed { display: none; }
  .mobile-back { display: inline-flex; }
  .story-toolbar { flex-wrap: wrap; }
  .story-title-block { order: 1; width: 100%; }
  .story-actions { order: 2; width: 100%; justify-content: start; }
  .empty-story { min-height: 260px; padding: 45px 20px; }
}

@media (max-width: 560px) {
  .shell { padding: 0 14px; }
  .site-header { min-height: 70px; }
  .brand small { display: none; }
  .username { display: none; }
  .login-view { margin-top: 35px; }
  .login-form { padding: 25px 20px; }
  .app-heading { align-items: start; padding-top: 30px; }
  .app-heading h1 { font-size: 2rem; }
  .app-heading .subtle { font-size: .84rem; }
  .app-heading .button { font-size: .8rem; padding: 7px 10px; }
  .story-view { padding: 18px 15px; }
  .composer-footer { flex-direction: column; }
  .composer-actions { width: 100%; }
  .composer-actions .button-primary { flex: 1; }
  textarea { min-height: 230px; }
  .site-footer { margin-top: 30px; }
}
