:root { font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #17231c; background: #f4f7f5; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }
.site-header { display: flex; justify-content: space-between; gap: 2rem; padding: 2rem clamp(1rem, 5vw, 4rem); background: #126b3a; color: white; }
.site-header h1 { margin: .15rem 0 .4rem; font-size: clamp(1.8rem, 4vw, 3rem); }
.site-header p { margin: 0; max-width: 55rem; line-height: 1.55; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-weight: 800; font-size: .8rem; opacity: .85; }
.score { align-self: center; white-space: nowrap; background: rgba(255,255,255,.15); padding: .8rem 1rem; border-radius: 999px; font-weight: 700; }
.layout { display: grid; grid-template-columns: minmax(190px, 250px) minmax(0, 900px); gap: 1.5rem; align-items: start; max-width: 1220px; margin: 0 auto; padding: 2rem 1rem; }
.function-panel, .trainer-card { background: white; border: 1px solid #dce6df; border-radius: 18px; box-shadow: 0 10px 30px rgba(28,60,40,.08); }
.function-panel { padding: 1rem; position: sticky; top: 1rem; }
.function-panel h2 { margin: .25rem 0 1rem; font-size: 1.05rem; }
.function-list { display: grid; gap: .45rem; margin-bottom: 1rem; }
.function-button { width: 100%; border: 1px solid #cfdcd3; background: #f8fbf9; text-align: left; padding: .72rem .8rem; border-radius: 10px; font-weight: 700; }
.function-button:hover, .function-button.active { border-color: #126b3a; background: #e9f6ee; color: #0b572e; }
.trainer-card { padding: clamp(1rem, 3vw, 2rem); }
.task-head { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.task-head h2 { margin: .35rem 0 0; }
.badge { display: inline-block; margin: 0; background: #e9f6ee; color: #0b572e; border-radius: 999px; padding: .35rem .65rem; font-weight: 800; font-size: .82rem; }
.counter { color: #607067; font-size: .9rem; }
.task-text { font-size: 1.08rem; line-height: 1.55; margin: 1.3rem 0; }
.sheet-wrap { overflow-x: auto; border: 1px solid #b7c7bc; border-radius: 10px; margin-bottom: 1.3rem; background: white; }
.sheet { border-collapse: collapse; min-width: 480px; width: 100%; }
.sheet th, .sheet td { border: 1px solid #c8d4cc; min-width: 88px; height: 42px; padding: .45rem .6rem; text-align: right; }
.sheet thead th, .sheet tbody th { background: #edf2ee; font-weight: 700; text-align: center; color: #4b5c51; }
.sheet td.text { text-align: left; }
.formula-label { display: block; font-weight: 800; margin-bottom: .45rem; }
.formula-row { display: grid; grid-template-columns: 1fr auto; gap: .7rem; }
#formulaInput { width: 100%; min-height: 50px; border: 2px solid #9eb2a4; border-radius: 10px; padding: .75rem .9rem; font-family: Consolas, monospace; font-size: 1rem; }
#formulaInput:focus { outline: 3px solid rgba(18,107,58,.2); border-color: #126b3a; }
.primary, .secondary { border-radius: 10px; padding: .72rem 1rem; font-weight: 800; border: 1px solid transparent; }
.primary { background: #126b3a; color: white; }
.primary:hover { background: #0b572e; }
.secondary { background: white; border-color: #b9c8be; color: #26352c; }
.secondary:hover { background: #f1f6f2; }
.full { width: 100%; }
.feedback { min-height: 54px; margin-top: .8rem; border-radius: 10px; padding: .75rem .9rem; line-height: 1.45; }
.feedback:empty { padding: 0; }
.feedback.success { background: #e6f6eb; color: #075629; border: 1px solid #9ed3ae; }
.feedback.error { background: #fff0ee; color: #8d2118; border: 1px solid #e8b0aa; }
.feedback.info { background: #eef5ff; color: #234f7e; border: 1px solid #b6d0ee; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
footer { text-align: center; padding: 1.5rem; color: #617067; font-size: .9rem; }
@media (max-width: 760px) {
  .site-header { display: block; padding: 1.4rem 1rem; }
  .score { display: inline-block; margin-top: 1rem; }
  .layout { grid-template-columns: 1fr; padding: 1rem; }
  .function-panel { position: static; }
  .function-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .formula-row { grid-template-columns: 1fr; }
  .formula-row .primary { width: 100%; min-height: 48px; }
  .actions { display: grid; grid-template-columns: 1fr; }
  .actions button { min-height: 46px; }
}
