:root {
  --ink: #18343b;
  --muted: #63777b;
  --teal: #1c535c;
  --teal-light: #eaf5f2;
  --bg: #f4f3ef;
  --border: #dfE4e2;
  --warm: #c18b48;
  --white: #fff;
  --shadow: 0 12px 34px rgba(28,50,48,.055);
  color-scheme: light;
}
* {box-sizing:border-box}
html {min-height:100%;background:var(--bg);-webkit-text-size-adjust:100%}
body {margin:0;min-width:300px;background:var(--bg);color:var(--ink);font:15px/1.45 system-ui,-apple-system,"Segoe UI",sans-serif}
button,input,select,textarea {font:inherit}
button {cursor:pointer;-webkit-tap-highlight-color:transparent}
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #dfb36e;outline-offset:2px}
.app-shell{width:min(100%,540px);margin:0 auto;padding: max(18px,env(safe-area-inset-top)) 14px calc(25px + env(safe-area-inset-bottom))}
.app-header{display:flex;align-items:center;gap:12px;margin:3px 3px 17px}
.brand-mark{width:55px;height:55px;flex:none;border-radius:17px;background:#173b43;box-shadow:inset 0 0 0 1px #497278;display:flex;flex-direction:column;align-items:center;justify-content:center;color:#f5e2bc}
.brand-mark>span:first-child{font-family:Georgia,serif;font-weight:700;font-size:30px;line-height:28px}
.brand-mini{font-size:9px;letter-spacing:3px;color:#b5d4ce;margin-left:3px}
.eyebrow{font-size:10px;font-weight:800;letter-spacing:1.5px;color:#6c817d}
h1{font-family:Georgia,serif;font-size:27px;letter-spacing:-.7px;line-height:1.15;margin:2px 0}
.edition{font-family:system-ui,sans-serif;font-weight:650;font-size:10px;letter-spacing:.2px;vertical-align:middle;border:1px solid #d0d9d7;border-radius:6px;padding:3px 5px;color:#78908b}
.app-header p{margin:3px 0 0;color:#6e807d;font-size:12px}
.test-ribbon{display:flex;gap:10px;align-items:flex-start;border:1px solid #dfd9c4;background:#fcf8ea;border-radius:12px;color:#77613a;font-size:12px;padding:10px 12px;margin-bottom:13px}
.ribbon-dot{width:8px;height:8px;flex:none;border-radius:50%;background:#bb8c47;margin-top:4px}
.panel{background:var(--white);border:1px solid #e7eae8;border-radius:18px;padding:17px 16px;margin-bottom:12px;box-shadow:var(--shadow)}
.panel-header{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:13px}
h2{font-family:Georgia,serif;font-size:19px;line-height:1.15;margin:0;font-weight:700}
.text-button{border:none;padding:6px 0;background:transparent;color:var(--teal);font-weight:700;font-size:12px;text-decoration:underline;text-decoration-color:#bbd6d0;text-underline-offset:4px}
.field-label{display:block;font-size:13px;font-weight:750;margin:0 0 6px;color:#2f5156}
textarea{display:block;resize:vertical;width:100%;border:1.5px solid #d7e0df;border-radius:11px;padding:11px 12px;color:#203b40;background:#fbfcfb;min-height:76px;max-height:160px;line-height:1.4}
textarea::placeholder{color:#93a1a0}
.length-row{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:14px 0}
.length-row .field-label{margin-bottom:2px}
.hint{margin:0;font-size:11px;color:#80908e}
.select-wrap{position:relative}
select{background:#f8faf9;border:1.5px solid #d4dfdc;border-radius:10px;color:#1e4146;font-size:17px;font-weight:800;min-width:84px;padding:9px 30px 9px 12px;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%233b6b68' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center}
.letter-heading{display:flex;align-items:center;justify-content:space-between;margin:8px 0 7px}
.letter-heading .field-label{margin:0}
.small-caption{color:#83918e;font-size:11px}
.letters-grid{display:grid;grid-template-columns:repeat(var(--columns, 8),minmax(0,1fr));gap:4px;width:100%;align-items:stretch}
.letter-cell{height:47px;position:relative;min-width:0;border:1.5px solid #dfe5e3;background:#fafbf9;border-radius:7px;transition:border .12s ease,background .12s ease}
.letter-cell:focus-within,.letter-cell.active{outline:2px solid #789f9e;outline-offset:1px}
.letter-cell.certain{background:#e6f4ed;border-color:#6ea28a}
.letter-cell.uncertain{background:#fff4dc;border-color:#d1a35c}
.letter-cell input{width:100%;height:100%;border:0;outline:0!important;background:transparent;border-radius:7px;text-align:center;padding:0 1px 3px;color:#203d43;font-size:21px;font-weight:800;line-height:1;caret-color:var(--teal);text-transform:none;}
.letter-cell.uncertain input{color:#9a661f}
.letter-cell .index{position:absolute;bottom:1px;left:0;right:0;text-align:center;font-size:9px;font-weight:550;color:#9daaa8;pointer-events:none;line-height:10px}
.legend{display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px;margin:11px 0;color:#617672;font-size:11px}
.legend span{white-space:nowrap;display:inline-flex;align-items:center;gap:5px}
.legend-token{width:19px;height:19px;border-radius:4px;display:inline-flex;align-items:center;justify-content:center;font-size:12px;border:1px solid #e4e7e4}
.legend-token.certain{background:#e6f4ed;border-color:#6ea28a}
.legend-token.uncertain{background:#fff4dc;border-color:#d1a35c}
.legend-token.unknown{background:#fafbf9}
.letter-tools{border-top:1px dashed #e5e9e7;padding-top:10px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px}
.selection-text{color:#708482;font-size:11px;max-width:190px}
.tool-actions{display:flex;align-items:center;gap:5px}
.outline-button,.icon-button{border:1px solid #d9e2df;background:#f8faf9;border-radius:8px;color:#365b5e;font-size:11px;font-weight:650;padding:8px 9px}
.outline-button strong{font-size:15px;margin-left:2px}
.icon-button{font-size:21px;line-height:17px;padding:8px 11px}
.outline-button:disabled,.icon-button:disabled{opacity:.42;cursor:default}
.inline-notice{font-size:12px;background:#f7f3e7;color:#806338;border-radius:8px;padding:8px 10px;margin:10px 0 0}
.primary-actions{display:flex;gap:9px;align-items:center;margin-top:15px}
.primary-button{flex:1;border:0;border-radius:11px;background:var(--teal);color:white;padding:12px 9px;min-height:47px;font-weight:800;font-size:14px;box-shadow:0 4px 12px rgba(30,82,89,.15)}
.primary-button:active{transform:translateY(1px)}
.search-glyph{font-size:23px;vertical-align:-1px;margin-right:5px;line-height:0}
.reset-button{border:1px solid #d7e0dc;background:#fff;border-radius:11px;padding:11px 9px;min-height:47px;color:#5a7774;font-size:11px;font-weight:700}
.save-status{margin:10px 0 0;color:#899692;font-size:10px;text-align:center}
.answer-panel,.observations-panel{padding-top:15px;padding-bottom:17px}
.panel-tag{background:#eef3f2;color:#54736f;border-radius:30px;padding:4px 9px;font-size:10px;font-weight:750}
.panel-tag.subtle{background:#f6f4ec;color:#8c7b62}
.empty-heading{margin:0 0 4px;font-weight:750;color:#54716e}
.answer-secondary{font-size:12px;color:#82918f;line-height:1.5;margin:0}
.answer-content p,.observations-content p{margin:0 0 7px}
.answer-content p:last-child,.observations-content p:last-child{margin-bottom:0}
.prepared-info{display:grid;gap:6px;font-size:13px}
.prepared-info strong{color:#213f42}
.prepared-info code{background:#f0f5f4;border:1px solid #e4ecea;border-radius:6px;padding:4px 8px;font-size:14px;letter-spacing:1px;white-space:pre-wrap;overflow-wrap:anywhere}
.no-ai{color:#8a7350;font-size:12px;background:#fff7e9;border-radius:8px;padding:8px 10px;margin-top:9px!important}
.app-footer{text-align:center;color:#9aa6a2;font-size:10px;padding:7px 8px}
@media(max-width:380px){.app-shell{padding-left:10px;padding-right:10px}.panel{padding:15px 12px}.letters-grid{gap:3px}.letter-cell{height:45px}.letter-cell input{font-size:19px}.legend{gap:7px 10px}.selection-text{max-width:none}}
@media(min-width:500px){.app-shell{padding-top:25px}.letter-cell{height:52px}}
@media(prefers-reduced-motion:reduce){*{transition:none!important}}
