
* { box-sizing: border-box; }
:root {
  --primary: #0f766e;
  --primary-dark: #115e59;
  --bg: #ecfdf5;
  --card: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #cde9df;
  --success: #16803d;
  --danger: #b42318;
  --shadow: 0 10px 32px rgba(20, 83, 45, .13);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(145deg, #ecfdf5, #d1fae5);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left));
  background: var(--primary);
  color: white;
  box-shadow: 0 5px 18px rgba(15, 118, 110, .22);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: white;
  color: var(--primary);
  font-weight: 900;
  letter-spacing: -.05em;
}
.topbar h1 {
  margin: 0;
  font-size: 1.22rem;
}
.sub {
  margin: 0;
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: .1em;
  opacity: .78;
}
.page {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 18px 14px 40px;
}
.card {
  padding: 20px;
  margin-bottom: 16px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.hero h2 {
  margin: 0 0 6px;
  font-size: clamp(1.35rem, 3vw, 2rem);
}
.hero p {
  margin: 0;
  color: var(--muted);
}
.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .12em;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, .82fr);
  gap: 16px;
  align-items: start;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
}
.heading h2 {
  margin: 0;
  font-size: 1.15rem;
}
label {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  font-weight: 800;
  color: #344054;
}
input, select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #bdd9d0;
  border-radius: 12px;
  color: var(--text);
  background: white;
}
input:focus, select:focus {
  outline: 3px solid rgba(15, 118, 110, .18);
  border-color: var(--primary);
}
.options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.btnrow {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.btn, .mini {
  border: 0;
  border-radius: 12px;
  font-weight: 900;
}
.btn {
  min-height: 46px;
  padding: 10px 15px;
  flex: 1;
}
.btn.primary {
  background: var(--primary);
  color: white;
}
.btn.primary:hover {
  background: var(--primary-dark);
}
.btn.secondary {
  background: #ccfbf1;
  color: var(--primary);
}
.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.mini {
  min-height: 36px;
  padding: 7px 10px;
  background: #ccfbf1;
  color: var(--primary);
}
.mini.danger {
  background: #fee2e2;
  color: var(--danger);
}
.note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: .88rem;
}
.error {
  display: none;
  margin: 10px 0 0;
  padding: 11px 12px;
  border-radius: 12px;
  background: #fff1f1;
  color: var(--danger);
  font-weight: 800;
}
.error.show {
  display: block;
}
.qrstage {
  display: grid;
  place-items: center;
  min-height: 350px;
  border: 1px dashed #9fc9bc;
  border-radius: 18px;
  background: #f8fffc;
  overflow: hidden;
}
#qrCanvas {
  width: min(100%, 320px);
  height: auto;
  border-radius: 12px;
  background: white;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.placeholder {
  display: grid;
  place-items: center;
  gap: 6px;
  color: #8aa2a0;
  text-align: center;
}
.placeholder strong {
  display: grid;
  place-items: center;
  width: 90px;
  height: 90px;
  border-radius: 24px;
  color: white;
  background: #94a3b8;
  font-size: 2rem;
  font-weight: 900;
}
.status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f2f4f7;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 900;
}
.status.ok {
  background: #dcfce7;
  color: var(--success);
}
.info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.info div {
  padding: 11px;
  border-radius: 13px;
  background: #f7faf9;
}
.info span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
}
.info strong {
  display: block;
  margin-top: 2px;
}
.preview {
  margin-top: 13px;
  padding: 12px;
  border-radius: 13px;
  background: #f7faf9;
}
.preview p {
  margin: 0 0 7px;
  font-weight: 900;
}
pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  color: #344054;
  font-size: .86rem;
}
.historyList {
  display: grid;
  gap: 9px;
}
.historyItem {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid #d6eee7;
  border-radius: 13px;
  background: white;
}
.historyItem strong {
  display: block;
  font-size: .84rem;
}
.historyItem span {
  display: block;
  color: var(--muted);
  font-size: .82rem;
  word-break: break-all;
}
.historyItem button {
  min-height: 36px;
  padding: 7px 10px;
  border: 0;
  border-radius: 10px;
  background: #ccfbf1;
  color: var(--primary);
  font-weight: 900;
}
.empty {
  padding: 16px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed #bad7cf;
  border-radius: 13px;
}
.help-card h2 {
  margin-top: 0;
}
.help-card li {
  margin: 6px 0;
}
.help-card p {
  color: var(--muted);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 50;
  transform: translate(-50%, 20px);
  max-width: min(90vw, 520px);
  padding: 11px 16px;
  border-radius: 999px;
  color: white;
  background: #172033;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  opacity: 0;
  pointer-events: none;
  transition: .22s;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 580px) {
  .topbar {
    padding-top: calc(12px + env(safe-area-inset-top));
  }
  .topbar h1 {
    font-size: 1.02rem;
  }
  .page {
    padding: 12px 10px 30px;
  }
  .card {
    padding: 16px;
    border-radius: 17px;
  }
  .options {
    grid-template-columns: 1fr 1fr;
  }
  .btnrow {
    display: grid;
  }
  .qrstage {
    min-height: 310px;
  }
  #qrCanvas {
    width: min(100%, 280px);
  }
  .info {
    grid-template-columns: 1fr;
  }
}
