:root{
  --bg:#f3f3f3;
  --surface:#fff;
  --surface2:#fafafa;
  --text:#1a1a1a;
  --muted:#707070;
  --line:#e5e5e5;
  --primary:#0067c0;
  --primary2:#005a9e;
  --danger:#c42b1c;
  --dangerbg:#fff3f1;
  --hover:#f6f6f6;
  --radius:8px;
}
*{box-sizing:border-box}
html,body{
  margin:0;
  min-height:100%;
  background:var(--bg);
  color:var(--text);
  font-family:"Segoe UI",system-ui,-apple-system,"Yu Gothic UI","Yu Gothic","Meiryo",sans-serif
}
body{font-size:14px}
button,input,textarea,select{font:inherit}
button{
  min-height:36px;
  border:1px solid transparent;
  border-radius:6px;
  padding:0 13px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  background:#fff;
  color:var(--text);
  cursor:pointer;
  transition:.12s
}
button:hover{background:var(--hover)}
button:active{background:#ededed}
button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{
  outline:2px solid var(--primary);
  outline-offset:1px
}
button.primary{background:var(--primary);color:#fff;border-color:var(--primary)}
button.primary:hover{background:var(--primary2);border-color:var(--primary2)}
button.secondary{border-color:#d5d5d5}
button.small{min-height:32px;padding:0 10px;font-size:13px}
.ico{
  width:16px;height:16px;display:inline-flex;align-items:center;
  justify-content:center;flex:0 0 16px
}
.ico svg{
  width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.65;
  stroke-linecap:round;stroke-linejoin:round;pointer-events:none
}
[hidden]{display:none!important}

.app{max-width:1220px;margin:auto;padding:22px 18px 76px}
.topbar{
  display:flex;align-items:center;justify-content:space-between;
  gap:12px;margin-bottom:18px
}
.brand{display:flex;align-items:center;gap:11px;min-width:0}
.brand-mark{
  width:42px;height:42px;border-radius:8px;background:#eaf3fc;color:var(--primary);
  border:1px solid #d8e7f5;display:flex;align-items:center;justify-content:center;flex:none
}
.brand-mark svg{
  width:25px;height:25px;fill:none;stroke:currentColor;stroke-width:1.55;
  stroke-linecap:round;stroke-linejoin:round
}
.title h1{margin:0;font-size:22px;font-weight:600;letter-spacing:-.2px}
.title p{
  margin:2px 0 0;color:var(--muted);font-size:13px;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis
}
.card{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  box-shadow:0 2px 8px rgba(0,0,0,.06);padding:18px;margin:12px 0
}
.card-head{
  display:flex;align-items:center;justify-content:space-between;
  gap:10px;margin-bottom:12px
}
.card-title{margin:0;font-size:16px;font-weight:600}
.hint,.small-note{color:var(--muted);font-size:13px;line-height:1.6}
.row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.grow{flex:1;min-width:220px}

.form-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr) 260px;
  gap:12px
}
.field label{
  display:block;margin:0 0 7px;font-size:13px;font-weight:600
}
textarea,input[type="text"],select,input[type="color"]{
  width:100%;background:#fff;color:var(--text);
  border:1px solid #c8c8c8;border-radius:6px
}
textarea{
  min-height:190px;padding:11px 12px;resize:vertical;
  line-height:1.55
}
input[type="text"],select{height:40px;padding:0 12px}
input[type="color"]{height:40px;padding:4px;cursor:pointer}
.settings{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  margin-top:12px
}
.field.full{grid-column:1/-1}

.actions{
  border-top:1px solid var(--line);
  margin-top:14px;
  padding-top:13px
}
.actions .row button{min-width:132px}
.status{
  min-height:20px;margin-top:8px;font-size:13px;color:#107c10
}
.status.error{color:var(--danger)}

.preview-layout{
  display:grid;
  grid-template-columns:minmax(0,1fr) 300px;
  gap:18px;
  align-items:start
}
.preview-box{
  min-height:430px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  background:#fafafa;
  border:1px solid var(--line);
  border-radius:8px;
  overflow:hidden
}
#qrcode{
  display:grid;
  place-items:center;
  min-width:256px;
  min-height:256px;
  max-width:100%;
  padding:14px;
  background:#fff;
  border:1px solid #e5e5e5;
  border-radius:6px
}
#qrcode img,#qrcode canvas{
  display:block;
  max-width:100%;
  height:auto!important
}
.preview-info{
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface2);
  padding:15px
}
.preview-info h3{margin:0 0 10px;font-size:14px}
.preview-info p{margin:7px 0;color:var(--muted);font-size:13px;line-height:1.6}
.info-row{
  display:flex;justify-content:space-between;gap:12px;
  padding:8px 0;border-bottom:1px solid var(--line)
}
.info-row:last-child{border-bottom:0}
.info-label{color:var(--muted)}
.info-value{font-weight:600;text-align:right;word-break:break-word}

.local-badge{
  display:inline-flex;align-items:center;gap:6px;
  padding:5px 9px;border:1px solid #d5d5d5;border-radius:6px;
  background:#fff;color:var(--muted);font-size:12px
}
.local-dot{width:7px;height:7px;border-radius:50%;background:#107c10}

body.busy{cursor:wait}
body.busy::after{
  content:'';position:fixed;inset:0;
  background:rgba(255,255,255,.18);z-index:9998;pointer-events:auto
}
body.busy::before{
  content:'';position:fixed;left:50%;top:50%;
  width:30px;height:30px;margin:-15px 0 0 -15px;
  border:3px solid currentColor;border-right-color:transparent;
  border-radius:50%;animation:spin .75s linear infinite;
  z-index:9999;pointer-events:none
}
@keyframes spin{to{transform:rotate(360deg)}}

@media(max-width:820px){
  .form-grid,.preview-layout{grid-template-columns:1fr}
  .preview-box{min-height:360px}
}
@media(max-width:700px){
  .app{padding:14px 10px 70px}
  .topbar{align-items:flex-start}
  .settings{grid-template-columns:1fr}
  .field.full{grid-column:auto}
  .actions .row button{flex:1;min-width:0}
  #qrcode{min-width:0;width:100%;max-width:320px}
}
