@font-face {
  font-family: 'UTMHelveIns';
  src: url('./font/UTMHelveIns.ttf') format('truetype');
}

:root{
  --brand-green:#009140;
  --brand-red:#d8261c;
  --bg:#f3f7f4;
  --panel:#ffffff;
  --line:#cfe3d6;
  --text:#244236;
  --muted:#5f786b;
}

*{ box-sizing:border-box; }

html, body{
  margin:0;
  padding:0;
}

body{
  background:var(--bg);
  color:var(--text);
  font-family:"Roboto", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight:400;
}

.header{
  background:#fff;
  padding:26px 0 18px;
  text-align:center;
}

.header-inner{
  max-width:1180px;
  margin:0 auto;
  padding:0 18px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
}

.logo{
  height:92px;
  width:auto;
  display:block;
}

.title-group{
  text-align:center;
}

.title-group h1{
  font-family:'UTMHelveIns', Arial, sans-serif;
  font-size:38px;
  line-height:1.25;
  font-weight:normal;
  color:var(--brand-green);
  text-align:center;
  max-width:950px;
  margin:auto;
}

.page{
  max-width:1180px;
  margin:0 auto;
  padding:22px 18px 34px;
}

.layout{
  display:grid;
  grid-template-columns:minmax(0, 1fr) 330px;
  gap:18px;
  align-items:start;
}

.card, .box, .status-box{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:22px;
  box-shadow:0 8px 24px rgba(0,145,64,.04);
}

.card{ padding:16px; }

.preview-controls{
  margin-top:14px;
  padding:14px;
  border-radius:18px;
  background:#fbfefd;
}

.control-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

.control-head h3{
  margin:0;
  font-size:18px;
  line-height:1.3;
  color:var(--brand-red);
}

.control-head p{
  margin:0;
  font-size:13px;
  line-height:1.5;
  color:var(--muted);
}

.zoom-chip{
  flex:0 0 auto;
  min-width:66px;
  text-align:center;
  padding:6px 10px;
  line-height:1;
  border-radius:999px;
  background:#edf7f0;
  border:1px solid #d5e9dc;
  color:var(--brand-green);
  font-weight:700;
  font-size:14px;
}

.compact-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}

.primary-actions{
  margin-top:10px;
}

.card-title{
  margin:0 0 10px;
  font-size:21px;
  line-height:1.3;
  font-weight:700;
  color:var(--brand-red);
}

.toolbar{
  display:flex;
  justify-content:center;
  flex-wrap:wrap;
  gap:14px;
  margin:18px 0;
}

button{
  appearance:none;
  border:none;
  border-radius:14px;
  padding:12px 18px;
  font-family:'UTMHelveIns', Arial, sans-serif;
  font-size:14px;
  line-height:1.2;
  font-weight:normal;
  cursor:pointer;
  transition:transform .15s ease, box-shadow .15s ease, opacity .15s ease, background .15s ease;
}

button:hover{ transform:translateY(-1px); }

button:disabled{
  opacity:.55;
  cursor:not-allowed;
  transform:none;
  box-shadow:none;
}

.btn-primary{
  background:var(--brand-green);
  color:#fff;
  box-shadow:0 6px 16px rgba(0,145,64,.16);
}

.btn-secondary{
  background:#edf4ef;
  color:var(--text);
  border:1px solid #d9e7de;
}

.btn-red{
  background:var(--brand-red);
  color:#fff;
  box-shadow:0 6px 16px rgba(216,38,28,.14);
}

.picker{
  border:2px dashed #bed9c7;
  border-radius:18px;
  padding:22px 18px;
  text-align:center;
  cursor:pointer;
  background:linear-gradient(180deg,#fcfefd 0%, #f4faf6 100%);
  margin-bottom:14px;
  transition:border-color .15s ease, background .15s ease;
}

.picker:hover{
  border-color:var(--brand-green);
  background:#f4fbf6;
}

.picker strong{
  display:block;
  margin-bottom:6px;
  font-size:16px;
  line-height:1.4;
  font-weight:normal;
  color:var(--brand-green);
}

.picker small{
  display:block;
  font-size:13px;
  line-height:1.6;
  color:var(--muted);
  font-weight:normal;
}

.preview-shell{
  position:relative;
  background:linear-gradient(180deg,#e9f4ed 0%, #deeee5 100%);
  border:1px solid #d7e7dd;
  border-radius:22px;
  padding:12px;
  overflow:hidden;
}

canvas{
  display:block;
  width:100%;
  height:auto;
  border-radius:18px;
  background:#deeee5;
  cursor:grab;
  user-select:none;
  -webkit-user-select:none;
  touch-action:none;
}

canvas.dragging{ cursor:grabbing; }

.loading-overlay{
  position:absolute;
  inset:12px;
  display:none;
  align-items:center;
  justify-content:center;
  border-radius:18px;
  background:rgba(243,247,244,.8);
}

.loading-overlay.show{ display:flex; }

.loading-card{
  min-width:220px;
  max-width:300px;
  padding:18px 16px;
  text-align:center;
  background:#fff;
  border:1px solid #d9e7de;
  border-radius:18px;
  box-shadow:0 10px 28px rgba(0,0,0,.05);
}

.spinner{
  width:28px;
  height:28px;
  margin:0 auto 10px;
  border-radius:50%;
  border:3px solid #d6e6dc;
  border-top-color:var(--brand-green);
  animation:spin .85s linear infinite;
}

@keyframes spin{ to{ transform:rotate(360deg); } }

.status-box{
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding:14px;
  margin-bottom:12px;
  background:#f7fbf8;
}

.status-dot{
  width:11px;
  height:11px;
  margin-top:5px;
  border-radius:50%;
  background:var(--brand-red);
  flex:0 0 auto;
  box-shadow:0 0 0 4px rgba(216,38,28,.08);
}

.status-box.ready .status-dot{
  background:var(--brand-green);
  box-shadow:0 0 0 4px rgba(0,145,64,.10);
}

.status-title{
  margin:0 0 4px;
  font-size:15px;
  line-height:1.3;
  font-weight:700;
  color:var(--brand-red);
}

.status-text{
  margin:0;
  font-size:13px;
  line-height:1.6;
  color:var(--muted);
}

.box{
  padding:14px;
  margin-bottom:12px;
  background:#f9fcfa;
}

.box h3{
  margin:0 0 8px;
  font-size:16px;
  line-height:1.3;
  font-weight:700;
  color:var(--brand-red);
}

.box p, .box ul{
  margin:0;
  font-size:13px;
  line-height:1.7;
  color:var(--muted);
}

.box ul{ padding-left:18px; }
.box li + li{ margin-top:6px; }

.zoom-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
  color:var(--brand-red);
  font-size:15px;
  line-height:1.3;
  font-weight:700;
}

.zoom-buttons{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-top:12px;
}

.steps{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:14px;
  margin:12px 0 18px;
}

.step{
  display:flex;
  align-items:center;
  gap:10px;
  background:#f7fbf8;
  border:1px solid #d9e7de;
  border-radius:14px;
  padding:12px 14px;
  font-size:14px;
  color:#5f786b;
}

.step-num{
  width:26px;
  height:26px;
  border-radius:50%;
  background:#009140;
  color:white;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:13px;
}

.actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-top:12px;
}

.zoom-buttons{
  margin-top:10px;
}

input[type="range"]{
  width:100%;
  accent-color:#2b7cff;
  cursor:pointer;
}

.share-note{
  margin-top:12px;
  padding:10px 12px;
  border-radius:14px;
  background:#fff4f3;
  border:1px solid #f3c7c3;
  color:#d8261c;
  font-size:13px;
  line-height:1.5;
  text-align:center;
}

/* Mobile */
@media (max-width: 768px){
  .header{
    padding:12px 0 8px;
  }

  .header-inner{
    padding:0 10px;
    gap:6px;
  }

  .logo{
    height:58px;
  }

  .title-group h1{
    font-size:22px;
    line-height:1.15;
    max-width:100%;
  }

  .page{
    max-width:100%;
    padding:12px 10px 18px;
  }

  .layout{
    grid-template-columns:1fr;
    gap:12px;
  }

  .card,
  .box,
  .status-box{
    border-radius:18px;
  }

  .card,
  .box{
    padding:12px;
  }

  .card-title{
    font-size:18px;
  }

  .status-title,
  .box h3,
  .zoom-row{
    font-size:16px;
  }

  .control-head{
    flex-direction:column;
    align-items:stretch;
    gap:8px;
  }

  .control-head h3{
    font-size:17px;
  }

  .zoom-chip{
    align-self:flex-start;
  }

  .steps{
    grid-template-columns:1fr;
    gap:10px;
    margin:10px 0 14px;
  }

  .step{
    padding:10px 12px;
    font-size:14px;
  }

  .step-num{
    width:24px;
    height:24px;
    font-size:12px;
  }

  .toolbar{
    display:grid;
    grid-template-columns:1fr;
    gap:8px;
    margin:14px 0;
  }

  .toolbar button{
    width:100%;
    min-width:0;
  }

  .picker{
    padding:16px 12px;
    border-radius:14px;
  }

  .picker strong{
    font-size:15px;
  }

  .picker small{
    font-size:12px;
    line-height:1.5;
  }

  .preview-shell{
    padding:8px;
    border-radius:18px;
  }

  canvas{
    width:100%;
    max-width:520px;
    margin:0 auto;
    display:block;
    height:auto;
    border-radius:14px;
  }

  .zoom-buttons,
  .actions,
  .compact-grid{
    grid-template-columns:1fr 1fr;
    gap:8px;
  }

  .zoom-buttons button,
  .actions button{
    width:100%;
    min-width:0;
    padding:11px 12px;
    font-size:14px;
  }

  .box ul{
    padding-left:18px;
  }

  .box li{
    line-height:1.5;
  }
}

@media (max-width: 560px){
  .header{
    padding:10px 0 6px;
  }

  .logo{
    height:50px;
  }

  .title-group h1{
    font-size:19px;
    line-height:1.12;
  }

  .page{
    padding:10px 8px 16px;
  }

  .card-title{
    font-size:17px;
  }

  .status-title,
  .box h3,
  .zoom-row{
    font-size:15px;
  }

  .step{
    font-size:13px;
    padding:9px 10px;
  }

  .picker{
    padding:14px 10px;
  }

  canvas{
    max-width:420px;
  }

  .zoom-buttons,
  .actions,
  .compact-grid{
  grid-template-columns:1fr 1fr;
  gap:8px;
  }

  .preview-controls{
    padding:12px;
    margin-top:10px;
  }

  .zoom-buttons button,
  .actions button{
    padding:10px 12px;
    font-size:14px;
  }

  .share-note{
    font-size:12px;
    padding:9px 10px;
  }
}

.side-panel{
  display:block;
}

@media (max-width: 768px){
  .layout{
    display:flex;
    flex-direction:column;
    gap:12px;
  }

  .side-panel{
    display:flex;
    flex-direction:column;
    gap:12px;
  }

  .preview-controls{
    order:-1;
    margin-top:0;
  }

  .status-box{
    order:2;
  }

  .side-panel > .box:first-of-type{
    order:3;
  }

  .side-panel > .box:last-of-type{
    order:4;
  }
}

