:root{
  --bg:#e6e6e6;
  --panel:#f2f2f2;
  --border:#bdbdbd;
  --text:#222;
  --placeholder:#777;
  --focus:#888;

  --pad:18px;
  --gap:14px;

  --r-panel:10px;
  --r:7px;

  --shadow:0 6px 14px var(--line);

  --ui:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
  --mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Courier New",monospace;
}

*{box-sizing:border-box}

html,body{
  height:100%;
  margin:0;
  padding:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--ui);
}

body{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:var(--pad);
  overflow:hidden;
}

.nav-home{
  position:fixed;
  top:12px;
  left:10px;
  color:var(--nav);
  opacity:.3;
}

.nav-home:hover{
  opacity:1;
  color:var(--nav);
}

.layout{
  width:100%;
  max-width:900px;
  max-height:calc(100vh - (2 * var(--pad)));
  display:flex;
  align-items:center;
  justify-content:center;
}

.panel{
  width:100%;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--r-panel);
  padding:28px 30px;
  box-shadow:var(--shadow);
  min-width:0;
  max-height:100%;
  overflow:hidden;
}

.top{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  gap:10px;
  margin-bottom:16px;
}

.title{
  font-size:24px;
  font-weight:650;
}

.expr{
  width:100%;
  font-family:var(--mono);
  font-size:24px;
  line-height:1.35;

  padding:16px 20px;
  border-radius:8px;
  border:1px solid var(--border);
  background:var(--surface);
  color:var(--text);
  outline:none;

  resize:none;
  overflow:auto;
  white-space:pre-wrap;
}

.expr::placeholder{
  color:var(--placeholder);
}

.expr:focus{
  border-color:var(--focus);
  background:var(--surface-hover);
}

.status{
  margin-top:12px;
  min-height:20px;
  font-family:var(--mono);
  font-size:15px;
  color:var(--placeholder);
  overflow-wrap:anywhere;
  word-break:break-word;
}

.status.err{
  color:var(--danger-text);
}

.qr-panel{
  margin-top:16px;
  width:100%;
  display:flex;
  justify-content:center;

  background:var(--surface-2);
  border:1px solid var(--border);
  border-radius:var(--r-panel);
  padding:18px;
}

.qr-panel[hidden]{
  display:none;
}

.qr-inner{
  padding:14px;
  background:#fff;
  border:1px solid #d0d0d0;
  border-radius:8px;
  display:flex;
  align-items:center;
  justify-content:center;
}

#qrcode{
  width:min(300px, 76vw, 42vh);
  height:min(300px, 76vw, 42vh);
  display:flex;
  align-items:center;
  justify-content:center;
}

#qrcode canvas,
#qrcode img{
  width:100% !important;
  height:100% !important;
  display:block;
  image-rendering:auto;
}

@media (max-height:720px){
  .panel{
    padding:22px 26px;
  }

  .title{
    font-size:22px;
  }

  .expr{
    font-size:22px;
    padding:14px 18px;
  }

  #qrcode{
    width:min(260px, 76vw, 38vh);
    height:min(260px, 76vw, 38vh);
  }
}

@media (max-width:640px){
  body{
    align-items:flex-start;
    overflow:auto;
  }

  .layout{
    max-height:none;
  }

  .panel{
    padding:22px 18px;
    overflow:visible;
  }

  .title{
    font-size:22px;
  }

  .expr{
    font-size:20px;
    padding:14px 16px;
  }

  #qrcode{
    width:min(280px, 76vw);
    height:min(280px, 76vw);
  }
}
