:root {
  color-scheme: light;
  --ink: #162c41;
  --muted: #455d76;
  --paper: #eaf1f9;
  --panel: #f9fcff;
  --line: #c1d1e2;
  --accent-wash: #f6e5ea;
  --primary: #234d76;
  --success-wash: #deeceb;
  --shadow: 0 12px 26px #102b4b1c;
  --serif: Georgia, 'Times New Roman', serif;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--paper);
  color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
a { color: inherit; }
button, select, input { font: inherit; }
button, select { min-height: 44px; }
button { cursor: pointer; }
button:disabled, select:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid #287abc; outline-offset: 3px; }
.topbar { background: #112941; color: #f2f8ff; border-bottom: 1px solid #294766; }
.top-inner { max-width: 1440px; margin: auto; padding: 9px clamp(14px, 4vw, 55px); min-height: 64px; display: flex; gap: 14px; align-items: center; justify-content: space-between; }
.title-group { min-width: 0; display: flex; align-items: center; gap: clamp(9px, 1.5vw, 19px); }
.brand-logo { flex: none; display: block; width: clamp(35px, 4vw, 46px); height: clamp(35px, 4vw, 46px); border-radius: 7px; }
h1, h2, p { margin: 0; }
h1 { font-family: var(--serif); font-size: clamp(1.35rem, 3.15vw, 2.73rem); font-weight: 700; letter-spacing: -.037em; line-height: 1.05; }
.sister { font-size: .89rem; font-weight: 690; color: #deedfc; padding: 8px 0; white-space: nowrap; text-underline-offset: 4px; }
.topbar :focus-visible { outline-color: #91ccff; }
.page { max-width: 1440px; margin: auto; padding: 14px clamp(14px, 4vw, 55px) 20px; }
.intro { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.deck { font-size: clamp(.95rem, 2vw, 1.07rem); color: var(--muted); line-height: 1.42; }
.modes { display: inline-flex; align-items: center; gap: 3px; padding: 4px; background: #dce8f3; border: 1px solid var(--line); border-radius: 11px; flex-shrink: 0; }
.modes button { border: 0; border-radius: 7px; background: transparent; color: var(--ink); font-size: .9rem; font-weight: 700; padding: 8px 13px; }
.modes button[aria-pressed=true] { background: var(--primary); color: #f4f9ff; }
.layout { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(310px, 1fr); align-items: start; gap: clamp(15px, 2vw, 27px); }
.screen { margin: 0; overflow: hidden; border-radius: 15px; background: #142b43; color: #f4f9ff; box-shadow: var(--shadow); border: 1px solid #142b43; }
.screen-title, .screen-bottom { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 11px 15px; }
.screen-title strong { font-size: .92rem; }
.screen-badge { border: 1px solid #607e9a; color: #edf5fc; border-radius: 7px; padding: 4px 8px; font-size: .8rem; }
.screen-bottom { min-height: 43px; font-size: .9rem; color: #e0ecf7; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 15px; padding: clamp(14px, 2vw, 23px); display: grid; gap: 15px; box-shadow: var(--shadow); }
.panel h2 { font-family: var(--serif); font-size: clamp(1.57rem, 2.7vw, 2.05rem); line-height: 1.06; letter-spacing: -.03em; }
.help { color: var(--muted); font-size: .94rem; line-height: 1.45; }
.field { display: grid; gap: 6px; }
.field label, fieldset > legend { font-size: .89rem; font-weight: 720; }
select { width: 100%; min-width: 0; border: 1px solid #9aafc4; border-radius: 8px; color: var(--ink); background: #ffffff; padding: 9px 30px 9px 10px; appearance: none; }
.select-wrap { display: block; position: relative; min-width: 0; }
.select-wrap::after { content: ''; border-bottom: 2px solid #3d5d7c; border-right: 2px solid #3d5d7c; width: 8px; height: 8px; transform: rotate(45deg); position: absolute; right: 13px; top: calc(50% - 6px); pointer-events: none; }
.action-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.btn { border: 1px solid transparent; border-radius: 8px; font-weight: 720; font-size: .94rem; padding: 8px 13px; background: var(--primary); color: #f5faff; }
.btn:hover:not(:disabled) { background: #183b5c; }
.btn.secondary { background: transparent; border-color: #9eafc2; color: var(--ink); }
.btn.secondary:hover:not(:disabled) { background: #e6eff8; }
.btn.light { background: #24466a; border-color: #6585a3; color: #f2f8ff; }
.btn.light:hover:not(:disabled) { background: #315d86; }
.result { border-radius: 8px; padding: 10px 12px; background: #e4edf7; line-height: 1.46; font-size: .92rem; }
.result[data-tone=success] { background: var(--success-wash); color: #1e4b43; }
.result[data-tone=error] { background: var(--accent-wash); color: #733347; }
.footer { color: var(--muted); font-size: .83rem; margin-top: 17px; display: flex; flex-wrap: wrap; gap: 5px 16px; }
@media (max-width: 910px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .page, .top-inner { max-width: 760px; }
}
@media (max-width: 580px) {
  .intro { align-items: flex-start; flex-direction: column; gap: 9px; margin-bottom: 12px; }
  .top-inner { gap: 9px; min-height: 58px; }
  .sister { font-size: .79rem; }
  .screen-title, .screen-bottom { padding-inline: 10px; }
}
