:root {
  color-scheme: light;
  --ink: #1e2421;
  --muted: #66736e;
  --line: #dbe1dc;
  --paper: #f7f5ee;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-soft: #e6f3f0;
  --accent-dark: #0b5f59;
  --blue: #315f8c;
  --amber: #a76f22;
  --rose: #a95261;
  --shadow: 0 14px 40px rgba(30, 36, 33, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-version {
  font-size: 11px;
  font-weight: 750;
  color: var(--muted);
  vertical-align: middle;
}

.data-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.data-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.data-import-label {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  cursor: pointer;
  text-align: center;
}
.data-import-label input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}
.data-status {
  margin: 10px 0 0;
  font-size: 12px;
  font-weight: 750;
  color: var(--muted);
  min-height: 16px;
}

.app-shell {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.workspace {
  min-height: calc(100vh - 40px);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 0 18px;
}

.topbar-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 21px;
  font-weight: 950;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.22);
}

.brand-name {
  margin: 0 0 2px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 950;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 860px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.status-pill {
  flex: 0 0 auto;
  min-width: 112px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: #fff;
  color: var(--accent-dark);
  text-align: center;
  font-size: 13px;
  font-weight: 850;
  box-shadow: 0 10px 24px rgba(30, 36, 33, 0.07);
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summary-band div,
.progress-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.summary-band div {
  min-height: 64px;
  display: grid;
  gap: 4px;
  align-content: center;
  padding: 12px 14px;
}

.summary-band span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.summary-band strong {
  font-size: 16px;
}

.progress-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.progress-step {
  min-height: 42px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.progress-step.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

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

.mobile-tabbar {
  display: none;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.material-picker-panel,
.draft-panel {
  grid-column: span 2;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.camera-preview {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.capture-sheet {
  display: grid;
  gap: 12px;
}

.sheet-handle {
  display: none;
}

.capture-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
}

.capture-actions .primary-button,
.capture-actions .ghost-button {
  grid-column: 1 / -1;
}

.capture-memo {
  margin-top: 14px;
}

.capture-memo-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 850;
  color: var(--ink);
}

.memo-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.memo-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  padding: 8px 13px;
  min-height: 40px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.memo-chip:hover {
  border-color: var(--accent);
}

.memo-chip.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.capture-save-actions {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.draft-memory {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f8f5;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.draft-memory-title {
  margin: 0 0 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 850;
  color: var(--accent-dark);
}

.draft-memory-note {
  font-size: 11px;
  font-weight: 750;
  color: var(--muted);
}

.draft-memory-body {
  margin: 0;
  font-size: 14px;
  white-space: pre-wrap;
  color: var(--ink);
}

.draft-memory-place {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-dark);
}

.draft-memory-media {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.draft-memory-media:empty {
  display: none;
}

.draft-memory-thumb {
  inline-size: 56px;
  block-size: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  margin-top: 8px;
}

.draft-memory-audio {
  inline-size: 100%;
  height: 38px;
  margin-top: 8px;
}

/* 記憶カード：場所トグル・思い出写真・音声 */
.cd-checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 750;
  color: var(--ink);
  margin-bottom: 4px;
}

.cd-checkline input {
  inline-size: 20px;
  block-size: 20px;
  flex: 0 0 auto;
}

.cd-memory-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.cd-memory-empty {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.cd-memory-cell {
  position: relative;
  inline-size: 76px;
  block-size: 76px;
  border-radius: 8px;
  background: #f1f3f1;
  border: 1px solid var(--line);
  overflow: hidden;
}

.cd-memory-img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  display: block;
}

.cd-memory-del {
  position: absolute;
  inset-block-start: 2px;
  inset-inline-end: 2px;
  inline-size: 24px;
  block-size: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(20, 28, 24, 0.72);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}

.cd-add-photo {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  cursor: pointer;
}

.cd-add-photo input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.cd-voice {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.cd-voice-audio {
  inline-size: 100%;
  height: 40px;
}

.cd-voice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cd-voice-actions .ghost-button {
  flex: 1 1 auto;
  min-height: 42px;
}

.cd-voice-delbtn {
  color: var(--danger, #a3331f);
}

.cd-voice-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.cd-voice-rec {
  font-size: 13px;
  font-weight: 850;
  color: #a3331f;
  align-self: center;
}

.upload-drop {
  min-height: 52px;
  border: 1px dashed #8fa09a;
  border-radius: 8px;
  display: grid;
  place-items: center;
  padding: 10px;
  background: #f5f8f5;
  color: var(--accent-dark);
  cursor: pointer;
}

.upload-drop input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-drop span {
  font-size: 14px;
  font-weight: 850;
}

.ocr-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.scan-frame {
  min-height: 224px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #edf2ee;
  overflow: hidden;
}

.scan-frame img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 8px;
}

.business-card {
  width: min(370px, 100%);
  aspect-ratio: 1.72;
  border-radius: 8px;
  padding: 22px;
  background: #fffdf8;
  box-shadow: 0 12px 30px rgba(30, 36, 33, 0.16);
}

.business-card p {
  margin: 0;
}

.card-company {
  color: var(--muted);
  font-size: 13px;
}

.card-name {
  margin-top: 22px !important;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0;
}

.card-role {
  margin-top: 4px !important;
  color: var(--blue);
  font-size: 14px;
  font-weight: 850;
}

.card-email {
  margin-top: 28px !important;
  color: var(--muted);
  font-size: 14px;
}

.ocr-box {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfb;
}

.ocr-box summary {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.ocr-box textarea {
  margin: 12px 0 10px;
}

.contact-form,
.material-form,
.draft-box,
.question-stack {
  display: grid;
  gap: 12px;
}

.contact-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.material-form {
  grid-template-columns: 0.75fr 1fr 1.5fr auto;
  align-items: end;
  margin-bottom: 14px;
}

.contact-form label:last-child,
.wide-label {
  grid-column: span 2;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
}

select {
  min-height: 44px;
  appearance: none;
}

textarea {
  resize: vertical;
  line-height: 1.7;
}

.question-block {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.question-title {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
}

.choice-grid,
.tag-grid,
.answer-row,
.line-options,
.material-list,
.send-grid,
.status-controls,
.tone-tabs {
  display: grid;
  gap: 8px;
}

.choice-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tag-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.answer-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.purpose-stack {
  display: grid;
  gap: 12px;
}

.purpose-group {
  display: grid;
  gap: 8px;
}

.purpose-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.choice-button,
.answer-button,
.tag-button,
.line-option,
.tone-button,
.status-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font-weight: 850;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.choice-button,
.answer-button,
.tag-button {
  min-height: 48px;
  padding: 10px;
  font-size: 13px;
}

.choice-button:hover,
.answer-button:not(:disabled):hover,
.tag-button:hover,
.line-option:hover,
.tone-button:hover,
.status-button:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.choice-button.is-selected,
.answer-button.is-selected,
.tag-button.is-selected,
.line-option.is-selected,
.tone-button.is-selected,
.status-button.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.answer-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.draft-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.draft-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

/* hidden属性は常に最優先で隠す（.ghost-button等の display 指定に負けないように） */
[hidden] {
  display: none !important;
}

.primary-button,
.secondary-button,
.ghost-button,
.ai-link {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 14px;
  display: inline-grid;
  place-items: center;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-button:disabled {
  border-color: #bfc9c4;
  background: #d8dfdb;
  color: #7d8984;
  cursor: not-allowed;
}

.secondary-button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
}

.ghost-button,
.ai-link {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.tone-tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.tone-button,
.status-button {
  min-height: 42px;
  padding: 9px 10px;
  text-align: center;
  font-size: 13px;
}

.draft-builder {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.line-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfb;
}

.line-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.line-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.line-option {
  min-height: 64px;
  padding: 10px;
  font-size: 13px;
  line-height: 1.45;
}

.material-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.material-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #fff;
}

.material-item.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.material-item.is-disabled {
  opacity: 0.58;
}

.material-check {
  min-width: 0;
  display: flex;
  grid-template-columns: none;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink);
  cursor: pointer;
}

.material-check input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.material-check span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.material-check strong,
.material-check small {
  overflow-wrap: anywhere;
}

.material-check small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.icon-text-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--rose);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.send-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.send-flow {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.send-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #fbfcfb;
}

.send-step-title {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.ai-link-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.ai-link-row .ai-link {
  min-height: 44px;
  padding: 0 8px;
  font-size: 13px;
}

.status-controls {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.contact-log {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.contact-log-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.contact-log-item:not(:has(.log-card-image)) {
  grid-template-columns: 1fr;
}

.log-card-image {
  width: 58px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: #fff;
}

.log-copy {
  min-width: 0;
}

.virtual-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  min-width: 0;
  padding: 14px;
  background: #fbfcfb;
}

.compact-heading {
  margin-bottom: 0;
}

.virtual-card-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.1), transparent 48%),
    #fff;
  aspect-ratio: 1.72;
  touch-action: pan-y;
  min-width: 0;
}

.virtual-name {
  margin-bottom: 4px;
  font-size: 22px;
  font-weight: 950;
}

.virtual-role {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.virtual-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.virtual-links span {
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

.qr-box {
  width: 116px;
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fff;
}

.qr-side {
  display: grid;
  gap: 6px;
  justify-items: center;
}

.qr-label {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.qr-box svg {
  width: 104px;
  height: 104px;
}

.qr-box p {
  margin: 0;
  padding: 8px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  font-weight: 800;
}

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

.virtual-actions {
  display: grid;
}

.show-card-main-button {
  min-height: 54px;
  font-size: 16px;
}

.qr-switcher {
  display: flex;
  overflow-x: auto;
  gap: 6px;
  scrollbar-width: none;
}

.qr-switcher::-webkit-scrollbar {
  display: none;
}

.qr-switch-button {
  flex: 0 0 auto;
  max-width: 148px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
  padding: 0 12px;
  cursor: pointer;
}

.qr-switch-button.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.qr-switch-button.is-empty {
  color: #a8b2ad;
}

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

.contact-log ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.contact-log li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.contact-log li strong,
.contact-log li span {
  display: block;
}

.contact-log li span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.empty-log {
  color: var(--muted);
  font-size: 13px;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(30, 36, 33, 0.34);
}

.settings-overlay[hidden] {
  display: none;
}

.settings-panel {
  width: min(900px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(30, 36, 33, 0.2);
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.settings-material-list {
  grid-template-columns: 1fr;
}

.virtual-show-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  /* 上寄せ＋水平中央。大きいカードでも「戻る」に被らず、あふれは下だけ（＝矢野拓実版の挙動） */
  place-items: start center;
  padding: calc(env(safe-area-inset-top) + 58px) 14px calc(env(safe-area-inset-bottom) + 18px);
  background: #0f1815;
}

.virtual-show-overlay[hidden] {
  display: none;
}

.virtual-show-back {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 14px);
  left: 14px;
  z-index: 2;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 900;
}

.virtual-show-stage {
  width: min(420px, 100%);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center; /* カードを縦中央に＝余白を上下対称にして「浮いた名刺」に */
  gap: 14px;
}

.virtual-show-card {
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 34px 30px 24px;
  color: #fff;
  background: linear-gradient(150deg, #14857c, #103b38);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
  position: relative;
  touch-action: pan-y pan-x;
}

.virtual-show-overlay[data-qr-theme="instagram"] .virtual-show-card {
  background: linear-gradient(135deg, #d62976, #8134af 52%, #f58529);
}

.virtual-show-overlay[data-qr-theme="x"] .virtual-show-card {
  background: linear-gradient(135deg, #111, #3b4652);
}

.virtual-show-overlay[data-qr-theme="youtube"] .virtual-show-card {
  background: linear-gradient(135deg, #ff0033, #6d111d);
}

.virtual-show-overlay[data-qr-theme^="material"] .virtual-show-card {
  background: linear-gradient(135deg, #315f8c, #0f766e);
}

.virtual-show-profile .eyebrow {
  color: rgba(255, 255, 255, 0.76);
}

.virtual-show-profile h2 {
  margin: 0 0 10px;
  color: #fff;
  font-size: clamp(38px, 13vw, 58px);
  line-height: 0.98;
}

.virtual-show-profile > p {
  margin-bottom: 18px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
  font-weight: 800;
}

.virtual-show-profile .virtual-links span {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.virtual-show-qr {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  /* QRを白パネルに載せて主役に＝スキャンされる前提の"見せ場" */
  background: #fff;
  border-radius: 20px;
  padding: 18px 18px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.virtual-show-qr .qr-box {
  width: min(200px, 58vw);
  min-height: min(200px, 58vw);
  border: 0;
  background: transparent;
}

.virtual-show-qr .qr-box svg {
  width: min(188px, 54vw);
  height: min(188px, 54vw);
}

.qr-caption {
  margin: 2px 0 0;
  color: var(--ink, #1e2421);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.virtual-show-qr .qr-label {
  color: var(--muted, #66736e);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* カード下の控えめなブランド＝共有されるたびに名前が広がる"装置"（端末ロケールで CardCue/FollowCue） */
.vshow-brand {
  margin: 2px 0 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.show-qr-switcher {
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding-inline: 0;
  overflow: visible;
}

.show-qr-switcher .qr-switch-button {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.show-qr-switcher .qr-switch-button.is-selected {
  background: #fff;
  color: var(--ink);
}

@media (orientation: landscape) and (max-height: 620px) {
  .virtual-show-overlay {
    padding: 14px 18px;
  }

  .virtual-show-back {
    top: 12px;
    left: 12px;
  }

  .virtual-show-stage {
    width: min(920px, calc(100vw - 96px));
    gap: 10px;
  }

  .virtual-show-card {
    grid-template-columns: minmax(0, 1fr) 150px;
    grid-template-rows: auto;
    max-height: min(72vh, 420px);
    min-height: auto;
    padding: 24px;
  }

  .virtual-show-profile h2 {
    font-size: clamp(36px, 6vw, 58px);
  }

  .virtual-show-profile > p {
    margin-bottom: 12px;
    font-size: 15px;
  }

  .virtual-show-qr .qr-box {
    width: 150px;
    min-height: 150px;
  }

  .virtual-show-qr .qr-box svg {
    width: 138px;
    height: 138px;
  }
}

/* CardCueはスマホ前提。PCでもこのスマホ幅レイアウトで統一する（min-width:0=常時適用） */
@media (min-width: 0px) {
  body {
    background: #f4f6f2;
  }

  .app-shell {
    width: min(430px, 100%);
    min-height: 100vh;
    padding: 0;
  }

  .workspace {
    min-height: 100vh;
    padding: 0 12px 92px;
  }

  .topbar,
  .content-grid,
  .summary-band,
  .progress-band,
  .contact-form,
  .material-form,
  .virtual-form,
  .choice-grid,
  .choice-grid.compact,
  .tag-grid,
  .answer-row,
  .tone-tabs,
  .line-options,
  .material-list,
  .send-grid,
  .ai-link-row,
  .status-controls {
    grid-template-columns: 1fr;
  }

  .topbar,
  .content-grid {
    display: grid;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    margin: 0 -12px 12px;
    padding: calc(env(safe-area-inset-top) + 12px) 12px 12px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    /* 不透明に＋backdrop-filter廃止：iOS WKWebViewでstickyヘッダーのblurがスクロール中カクつく(ビョンビョン)主因のため */
    background: #f4f6f2;
    border-bottom: 1px solid rgba(219, 225, 220, 0.8);
  }

  .topbar h1 {
    max-width: none;
    font-size: 12px;
    line-height: 1.25;
  }

  .brand-lockup {
    gap: 9px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 18px;
  }

  .brand-name {
    font-size: 18px;
  }

  .topbar-actions {
    display: flex;
    gap: 8px;
  }

  .topbar-actions .ghost-button {
    min-height: 38px;
    padding: 0 12px;
  }

  .status-pill {
    min-width: auto;
    min-height: 38px;
    display: grid;
    place-items: center;
    padding: 0 12px;
    font-size: 12px;
  }

  .summary-band {
    display: none;
  }

  .progress-band {
    position: sticky;
    top: 82px;
    z-index: 8;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin: 0 -2px 12px;
    padding: 0 2px 8px;
    background: #f4f6f2;
  }

  .progress-step {
    min-height: 6px;
    border-radius: 999px;
    border: 0;
    overflow: hidden;
    color: transparent;
    font-size: 0;
  }

  .progress-step.is-active {
    background: var(--accent);
  }

  .content-grid {
    gap: 12px;
  }

  .material-picker-panel,
  .draft-panel,
  .contact-form label:last-child,
  .wide-label {
    grid-column: span 1;
  }

  .panel {
    display: none;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 10px 28px rgba(30, 36, 33, 0.08);
  }

  .panel.is-current-screen {
    display: block;
  }

  .context-panel.is-current-screen,
  .material-picker-panel.is-current-screen {
    display: grid;
  }

  .self-card-panel.is-current-screen {
    display: block;
  }

  .section-heading {
    align-items: stretch;
    display: grid;
  }

  .draft-actions {
    justify-content: stretch;
  }

  .draft-actions button,
  .send-grid > * {
    width: 100%;
  }

  h2 {
    font-size: 18px;
  }

  .scan-frame {
    min-height: 190px;
    padding: 12px;
  }

  .capture-panel.is-current-screen {
    padding: 0;
    background: transparent;
    box-shadow: none;
  }

  .capture-panel .section-heading {
    padding: 12px 2px 10px;
    margin-bottom: 0;
  }

  .capture-panel .camera-preview {
    /* 名刺プレビューをtopバーの下に固定＝OCR結果と見比べられる。背後のフォームは不透明背景＋パネル幅いっぱいで完全に隠す（すり抜けて見えないように） */
    position: sticky;
    top: calc(env(safe-area-inset-top) + 64px);
    z-index: 5;
    margin: 0 -14px;
    padding: 8px 14px 10px;
    background: #f4f6f2;
  }

  .capture-panel .scan-frame {
    min-height: 210px;
    max-height: 30vh;
  }

  .capture-panel .scan-frame img {
    max-height: 28vh;
  }

  .capture-sheet {
    margin: 0 -2px;
    padding: 12px 12px 24px;
    border: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -12px 30px rgba(30, 36, 33, 0.08);
  }

  .capture-sheet::-webkit-scrollbar {
    display: none;
  }

  .sheet-handle {
    width: 42px;
    height: 5px;
    border-radius: 999px;
    display: block;
    justify-self: center;
    background: #cfd7d1;
  }

  .capture-actions {
    grid-template-columns: 1fr;
  }

  .business-card {
    padding: 18px;
  }

  .card-name {
    font-size: 25px;
  }

  .contact-form,
  .material-form,
  .choice-grid,
  .choice-grid.compact,
  .answer-row,
  .line-options,
  .send-grid,
  .status-controls {
    gap: 10px;
  }

  .choice-button,
  .answer-button,
  .line-option,
  .material-item {
    min-height: 54px;
  }

  .tone-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tone-tabs::-webkit-scrollbar {
    display: none;
  }

  .tone-button {
    min-width: 78px;
  }

  .draft-builder {
    gap: 10px;
  }

  .line-block {
    padding: 10px;
  }

  #bodyOutput {
    min-height: 360px;
  }

  .mobile-tabbar {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 12;
    width: min(430px, 100%);
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 8px 8px calc(env(safe-area-inset-bottom) + 8px);
    border-top: 1px solid rgba(219, 225, 220, 0.9);
    background: #ffffff;
    box-shadow: 0 -10px 30px rgba(30, 36, 33, 0.08);
  }

  .tabbar-button {
    min-height: 52px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    cursor: pointer;
  }

  .tabbar-button.is-selected {
    background: var(--accent-soft);
    color: var(--accent-dark);
  }

  .settings-overlay {
    align-items: end;
    padding: 0;
  }

  .settings-panel {
    width: 100%;
    max-height: 86vh;
    border-radius: 18px 18px 0 0;
    padding: 16px;
  }

  .virtual-show-overlay {
    padding: 58px 12px 18px;
  }

  .virtual-show-stage {
    width: 100%;
  }

  .virtual-show-card {
    gap: 22px;
    padding: 32px 26px 22px;
    border-radius: 26px;
  }

  .virtual-show-profile h2 {
    font-size: clamp(34px, 11vw, 50px);
  }

  .virtual-show-profile > p {
    margin-bottom: 12px;
    font-size: 15px;
  }

  .virtual-show-qr .qr-box {
    width: min(220px, 62vw);
    min-height: min(220px, 62vw);
  }

  .virtual-show-qr .qr-box svg {
    width: min(200px, 56vw);
    height: min(200px, 56vw);
  }

  .virtual-card {
    border-radius: 14px;
    padding: 12px;
  }

  .virtual-card-preview {
    grid-template-columns: minmax(0, 1fr) 92px;
    padding: 12px;
  }

  .virtual-name {
    font-size: 20px;
  }

  .qr-box {
    width: 92px;
    min-height: 92px;
  }

  .qr-box svg {
    width: 84px;
    height: 84px;
  }

}

/* ===== Claude改良版の追加スタイル ===== */
/* 連絡先一覧：名刺サムネ（IndexedDB復元）＋ボタン群（C2） */
.contact-log li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.log-thumb {
  width: 56px;
  height: 38px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  flex: 0 0 auto;
  background: #f0efe9;
}

.log-text {
  min-width: 0;
}

.log-actions {
  display: flex;
  gap: 8px;
}

/* 一時トースト通知（ステータスピルとは分離）: C8 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%) translateY(8px);
  z-index: 60;
  max-width: min(92vw, 520px);
  padding: 10px 16px;
  border-radius: 999px;
  background: #1f2937;
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* リンクエディタ（自分タブ：統合リンク一覧） */
.link-editor-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}
.link-editor-hint {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}
.link-editor {
  display: grid;
  gap: 10px;
}
.link-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  display: grid;
  gap: 8px;
}
.link-row.just-added {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  animation: link-pop 0.3s ease;
}
@keyframes link-pop {
  0% {
    transform: scale(0.98);
  }
  60% {
    transform: scale(1.012);
  }
  100% {
    transform: scale(1);
  }
}
.link-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.link-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--accent);
}
.capture-back-button { align-self: flex-start; margin-bottom: 10px; }

/* US(en)=連絡先保存ファースト。jaは一切影響なし（body.is-enはen時のみ付与）。 */
.card-scan-toggle { display: none; }
body.is-en .card-scan-toggle { display: inline-flex; align-self: flex-start; margin-bottom: 12px; }
/* enの連絡先入力画面：名刺カメラ/OCRは既定で隠し、トグル(.reveal-card)で開く＝フォーム主役 */
body.is-en .capture-panel:not(.reveal-card) .camera-preview,
body.is-en .capture-panel:not(.reveal-card) .capture-actions,
body.is-en .capture-panel:not(.reveal-card) .ocr-box,
body.is-en .capture-panel:not(.reveal-card) #ocrStatusText { display: none !important; }
/* LinkedIn/Social欄をフォーム先頭へ */
body.is-en .contact-form label:has(#contactSnsInput) { order: -1; }
/* 連絡先入力の上部クラッター削減：名刺時代の「New card/Sample scan」はenでは隠す（フォームに集中） */
body.is-en .capture-panel .log-actions { display: none; }
/* 「← Exchange」は浮いた箱をやめ控えめなテキストリンクに（戻る＝ナビと分かる） */
body.is-en .capture-back-button { background: transparent; border: none; box-shadow: none; padding: 2px 2px; font-size: 14px; opacity: .72; align-self: flex-start; }
/* 「Scan a business card」は全幅・中央のアウトラインボタン（"+ Adjust context"と同じ作法＝意図的に見せる） */
body.is-en .card-scan-toggle { width: 100%; justify-content: center; text-align: center; }
/* トーンタブ：4等分だと長語(Professional)が崩れる → enは2×2グリッドで全部見える・崩れない */
body.is-en .tone-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* === US(en) 削りパス：静かに上質へ。jaは不変（body.is-enはen時のみ） === */
/* 上部の説明バンド（プロト説明）は製品の顔に不要 → 撤去 */
body.is-en .summary-band { display: none; }
/* 4ステップ進行バーは連絡先ファースト導線と噛み合わない＋ノイズ → 撤去 */
body.is-en .progress-band { display: none; }
/* 各画面トップの小見出し(eyebrow)はh2と重複 → 消す（Links/Design/Backup等のサブ見出しは残す） */
body.is-en .panel > .section-heading .eyebrow { display: none; }
/* 版数スタンプは検証用に残すが控えめに */
body.is-en .app-version { opacity: .4; font-weight: 600; }

/* スキャン結果「Add to People」追加済みの色変化（その場で追加が分かる・画面遷移しない） */
#scanSaveButton.is-added { background: #14524c; color: #bfe3dd; }

/* 設定内：表示言語の切替 */
.lang-switch { margin: 6px 0 16px; }
.lang-switch-label { font-size: 12px; font-weight: 800; opacity: .7; margin: 0 0 8px; }
.lang-switch-buttons { display: flex; gap: 8px; }
.lang-btn { flex: 1; min-height: 44px; border-radius: 10px; border: 1px solid rgba(0,0,0,.15); background: #fff; font-weight: 800; font-size: 14px; cursor: pointer; }
.lang-btn.is-active { background: #0f766e; color: #fff; border-color: transparent; }
/* Exchangeチューザー：Add a contact を先頭、次に Scan their QR */
body.is-en #exCaptureButton { order: -2; }
body.is-en #exScanButton { order: -1; }
.link-row[data-link-theme="linkedin"] .link-dot { background: #0a66c2; }
.link-row[data-link-theme="instagram"] .link-dot { background: #d62976; }
.link-row[data-link-theme="x"] .link-dot { background: #111; }
.link-row[data-link-theme="youtube"] .link-dot { background: #ff0033; }
.link-row[data-link-theme="material"] .link-dot { background: var(--blue); }
.link-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 850;
  color: var(--ink);
}
.link-title-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 8px;
  font-size: 14px;
  font-weight: 800;
}
.link-toggle {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  background: #f3f5f3;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
.link-toggle.is-on {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.link-del {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}
.link-url {
  font-size: 13px;
}

/* カードのデザイン（背景写真）＝作品をカードに */
.virtual-show-overlay .virtual-show-card.has-photo {
  background-image:
    linear-gradient(
      180deg,
      rgba(8, 12, 10, 0.6) 0%,
      rgba(8, 12, 10, 0.15) 34%,
      rgba(8, 12, 10, 0.2) 58%,
      rgba(8, 12, 10, 0.72) 100%
    ),
    var(--card-photo);
  background-size: cover;
  background-position: center;
}

.design-modes {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.design-mode {
  flex: 1 1 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}
.design-mode.is-selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.design-pick-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.design-set {
  flex: 1 1 auto;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}
.design-percard {
  display: grid;
  gap: 8px;
}
.design-card-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  background: #fff;
}
.design-card-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 800;
}
.design-card-row .link-dot[data-link-theme="instagram"] {
  background: #d62976;
}
.design-card-row .link-dot[data-link-theme="x"] {
  background: #111;
}
.design-card-row .link-dot[data-link-theme="youtube"] {
  background: #ff0033;
}
.design-card-row .link-dot[data-link-theme="material"] {
  background: var(--blue);
}

/* QR切替時のカードめくり演出（トレカ/マッチングアプリ風）: 次のカードが回り込んで現れる */
@keyframes card-flip {
  0% {
    transform: perspective(1200px) rotateY(90deg);
    opacity: 0;
  }
  100% {
    transform: perspective(1200px) rotateY(0deg);
    opacity: 1;
  }
}

.virtual-show-card.is-switching {
  animation: card-flip 0.3s ease-out;
  transform-origin: center center;
  backface-visibility: hidden;
}

/* 自分カードの任意項目：会社名・屋号／自由記述 */
.virtual-form-wide {
  grid-column: 1 / -1;
}
.virtual-show-profile .virtual-show-company {
  margin-bottom: 10px;
  font-size: 17px;
  font-weight: 850;
  color: rgba(255, 255, 255, 0.88);
}
.virtual-show-profile .virtual-show-bio {
  margin-bottom: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.82);
  white-space: pre-wrap;
}
.virtual-company {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
}
.virtual-bio {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
  white-space: pre-wrap;
}

/* QR表示画面の「交換した相手を保存」ボタン */
.virtual-show-save {
  align-self: center;
  margin-top: 2px;
  min-height: 46px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  font-size: 15px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* ===== 相手のQRを読む（スキャナ）===== */
.scan-entry-button {
  width: 100%;
  margin-top: 8px;
}

.scan-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  background: #0c1411;
  color: #fff;
}
.scan-overlay[hidden] {
  display: none;
}
.scan-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
}
.scan-head .ghost-button {
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  min-height: 40px;
  border-radius: 999px;
  padding: 0 16px;
  font-weight: 900;
}
.scan-title {
  margin: 0;
  font-weight: 900;
  font-size: 17px;
}
.scan-viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #000;
}
.scan-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.scan-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(68vw, 280px);
  height: min(68vw, 280px);
  transform: translate(-50%, -50%);
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 22px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45);
}
.scan-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  margin: 0;
  text-align: center;
  font-weight: 800;
  font-size: 14px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}
.scan-result {
  padding: 18px 18px calc(env(safe-area-inset-bottom) + 20px);
  background: #11201b;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.scan-result-eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 800;
}
.scan-result-name {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 900;
}
.scan-result-url {
  margin: 0 0 14px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
  word-break: break-all;
}
.scan-result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.scan-result-actions .primary-button {
  grid-column: 1 / -1;
}

/* ===== 連絡先：種別バッジ＋「この人に書く」（連絡先→下書きの逆引き）===== */
.log-item { flex-wrap: wrap; }
.log-item .log-text { flex: 1 1 0; min-width: 0; }
.contact-log li .log-badge {
  display: inline-block;
  width: auto;
  margin-left: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
}
.log-badge.is-mail { background: var(--accent-soft); color: var(--accent-dark); }
.log-badge.is-sns { background: #ede9fe; color: #5b21b6; }
.log-write-button {
  flex: 1 1 100%;
  margin-top: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.log-write-button:active { opacity: 0.85; }

/* ===== 連絡先タブの見出し ===== */
.log-handle {
  color: #5b21b6;
  font-size: 12px;
  font-weight: 800;
}
.log-item .log-text { cursor: pointer; }

/* ===== 連絡先カード（名刺＋SNS共存・編集）===== */
/* 連絡先カードは普通の画面（パネル）＝ドキュメントスクロール。position:fixedオーバーレイを廃止（iOSの背景透け/スクロール不能/二重の根治） */
.contact-detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.contact-detail-title { margin: 0; font-weight: 900; font-size: 17px; }
.contact-detail-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 背景スクロールは overlayScrollGuard(JS) が touch/wheel を止める。bodyは一切いじらない＝iOSの二重表示・スクロール不能を回避 (#10) */

/* 連絡先カード：上部の「誰か」ヘッダー */
.cd-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 2px 2px;
}
.cd-identity-avatar {
  inline-size: 44px;
  block-size: 44px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 900;
  flex: 0 0 auto;
}
.cd-identity-text { flex: 1; min-width: 0; }
.cd-identity-name {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.25;
}
.cd-identity-sub {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.cd-identity-status {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 850;
  padding: 5px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.cd-identity-status.todo  { background: #fdecea; color: #a32d2d; }
.cd-identity-status.later { background: #fff3e0; color: #8a5a00; }
.cd-identity-status.done  { background: #eef4ec; color: #3b6d11; }

/* 連絡先カード：折りたたみセクション (#9) */
.cd-section {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

/* 折りたたみは <details> をやめてJSトグル（基本のdisplay:noneのみ）＝iOS WKWebViewでも確実に隠れる */
.cd-summary {
  width: 100%;
  border: none;
  background: #fff;
  cursor: pointer;
  padding: 13px 14px;
  font-size: 14px;
  font-weight: 850;
  color: var(--ink);
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cd-summary::after {
  content: "▸";
  color: var(--muted);
  font-size: 13px;
  transition: transform 160ms ease;
}

.cd-section.is-open > .cd-summary::after {
  transform: rotate(90deg);
}

.cd-section.is-open > .cd-summary {
  border-bottom: 1px solid var(--line);
}

.cd-section-body {
  padding: 12px 14px 14px;
  display: grid;
  gap: 12px;
}

/* 閉じたら本文を隠す（class制御＝全webviewで同一挙動・空箱が残らない） */
.cd-section:not(.is-open) > .cd-section-body {
  display: none;
}

/* 音声メモ：複数（追加式） (#7) */
.cd-voice-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9f7;
}

.cd-voice-label {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.cd-voice-add {
  align-self: stretch;
}

.cd-voice-trans {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.cd-voice-transcript {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
}

.cd-voice-transstatus {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.contact-detail-photo {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #11201b;
}
.contact-detail-nophoto {
  margin: 0;
  padding: 18px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}
.cd-field {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}
.cd-field input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
}
.cd-open-sns { width: 100%; }
.contact-detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* ===== 連絡先カード：SNS/リンク複数編集 ===== */
.cd-links { display: grid; gap: 8px; }
.cd-links-empty { margin: 2px 0; color: var(--muted); font-size: 13px; font-weight: 750; }
.cd-link-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 8px;
}
.cd-link-type {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.cd-link-row .cd-link-url {
  padding: 9px 10px;
  font-size: 14px;
  font-weight: 600;
}
.cd-link-open {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.cd-link-del {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}
.cd-add-link { width: 100%; margin-top: 2px; }

/* ===== 3タブ構成：交換パネル／ステップ帯ナビ／保存行 ===== */
.exchange-actions { display: grid; gap: 12px; }
.exchange-big {
  width: 100%;
  min-height: 60px;
  font-size: 17px;
  font-weight: 900;
  border-radius: 12px;
}
.send-save-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.send-save-row .primary-button,
.send-save-row .ghost-button { width: 100%; min-height: 48px; }

/* 上部ステップ帯＝作業フローのナビ（タップで移動） */
.progress-band[hidden],
.summary-band[hidden] { display: none; }
.progress-step { cursor: pointer; }
.progress-step.is-current {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

/* ===== 連絡先：交換日ごとに「箱」でグループ化（#2/#3）===== */
.contact-log li.log-group {
  list-style: none;
  display: block;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #f3f1ea;
  box-shadow: none;
}
.contact-log li.log-group.is-today {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.log-group-head {
  margin: 2px 4px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}
.log-group.is-today .log-group-head {
  color: var(--accent-dark);
  font-size: 15px;
}
.log-group-body { display: grid; gap: 8px; }
/* グループ内の各人＝白いカード（箱の中に並ぶ） */
.contact-log .log-item {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}
.contact-log li .log-when {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #fff3e0;
  color: #9a5b00;
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
}

/* ===== 工程バー一本化（DaVinci式）：上の帯を撤去し下バーを工程に ===== */
.summary-band, .progress-band { display: none !important; }
.draft-context-button { width: 100%; margin-bottom: 12px; }

/* ===== 送信画面＝この人に送る最終確認（#6）===== */
.send-recipient {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
  margin-bottom: 14px;
}
.send-recipient-name { margin: 0; font-size: 19px; font-weight: 900; }
.send-recipient-sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; font-weight: 700; }
.send-recipient-meta { margin: 8px 0 0; color: var(--accent-dark); font-size: 12px; font-weight: 800; }

.send-draft {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fbfcfb;
  margin-bottom: 14px;
}
.send-draft > summary { color: var(--accent-dark); font-size: 13px; font-weight: 850; cursor: pointer; }
.send-draft-subject { margin: 10px 0 6px; font-weight: 900; font-size: 14px; }
.send-draft-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
  max-height: 260px;
  overflow: auto;
}

.send-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
  margin-bottom: 14px;
  display: grid;
  gap: 10px;
}
.send-block[hidden] { display: none; }
.send-block-title { margin: 0; font-size: 14px; font-weight: 900; }
.send-block-hint { margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.5; }
.send-ai { display: grid; gap: 8px; padding-top: 4px; border-top: 1px dashed var(--line); }
.send-ai-title { margin: 4px 0 0; color: var(--muted); font-size: 12px; font-weight: 800; }
.send-sns-list { display: grid; gap: 8px; }
.send-sns-button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.send-sns-button .link-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--accent); flex: 0 0 auto; }
.send-after {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
.send-after .primary-button, .send-after .ghost-button { width: 100%; min-height: 50px; }

/* ===== 送信：AIで整える1ボタン化＋空状態（Codexレビュー）===== */
.send-ai-buttons { display: grid; gap: 8px; }
.ai-open-button {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.ai-open-button:active { background: #f3f1ea; }
.send-empty {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 28px 18px;
  text-align: center;
  background: #fff;
}
.send-empty[hidden] { display: none; }
.send-empty-title { margin: 0 0 6px; font-size: 16px; font-weight: 900; }
.send-empty-sub { margin: 0 0 16px; color: var(--muted); font-size: 13px; font-weight: 700; line-height: 1.6; }
.send-empty .primary-button { min-height: 48px; padding: 0 22px; }

/* ===== 名刺OCR後の「連絡先に追加」 ===== */
.add-card-button { width: 100%; margin-top: 14px; min-height: 50px; }

/* プライバシー/規約リンク（自分タブ末尾） */
.legal-links { margin: 18px 0 4px; text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; }
.legal-links a { color: var(--accent-dark); text-decoration: underline; }

/* ===== 連絡先：送信ステータスの目立つバッジ（フォローの核） ===== */
.contact-log li .log-status {
  display: inline-block;
  width: auto;
  margin-left: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  vertical-align: middle;
}
.log-status.todo  { background: #fdecea; color: #a32d2d; }   /* 未整理＝要対応 */
.log-status.draft { background: #e8f0fb; color: #1f5aa6; }   /* 下書き済み＝進行中 */
.log-status.later { background: #fff3e0; color: #8a5a00; }   /* 後日フォロー＝保留 */
.log-status.done  { background: #eef4ec; color: #3b6d11; }   /* 送信済み＝完了 */

/* 下書きあり＝送信ステータスとは別軸の小マーク */
.contact-log li .log-draft-mark { display:inline-block; width:auto; margin-left:4px; color: var(--accent-dark); font-weight:900; font-size:13px; vertical-align:middle; }
