:root {
  --card-number-top: 8%;
  --card-number-left: 34%;
  --card-name-top: 22%;
  --card-name-left: 30%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue",
    "Segoe UI", sans-serif;
  background: #f4f7f6;
  color: #333;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 12px 32px;
  display: flex;
  flex-direction: column;
}

.page-header {
  text-align: center;
  margin-bottom: 12px;
}

.page-header h1 {
  font-size: 18px;
  margin: 0;
  color: #0b6b4a;
}

.member-section {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 10px;
}

.member-label {
  white-space: nowrap;
}

.member-select {
  flex: 1;
  min-width: 140px;
  padding: 4px 8px;
}

.inline-link {
  border: none;
  background: none;
  color: #0b6b4a;
  text-decoration: underline;
  padding: 0;
  cursor: pointer;
  font-size: 13px;
}

.card-section {
  text-align: center;
  margin-bottom: 8px;
}

.card-wrapper {
  position: relative;
  margin: 0 auto;
  width: 280px;
  max-width: 80vw;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  background: #fff;
}

.card-image {
  display: block;
  width: 100%;
  height: auto;
}

.card-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.card-number {
  position: absolute;
  top: var(--card-number-top);
  left: var(--card-number-left);
  font-size: 14px;
  font-weight: 600;
  color: #0b6b4a;
  letter-spacing: 0.08em;
  text-shadow: 0 0 3px rgba(255, 255, 255, 0.9);
}

.card-name {
  position: absolute;
  top: var(--card-name-top);
  left: var(--card-name-left);
  font-size: 14px;
  font-weight: 500;
  color: #0b6b4a;
  letter-spacing: 0.05em;
  text-shadow: 0 0 3px rgba(255, 255, 255, 0.9);
}

.card-toggle {
  margin-top: 6px;
}

/* 位置微調整 */
.tuner-section {
  margin-top: 4px;
  font-size: 12px;
  color: #555;
}

#posTuner > summary {
  cursor: pointer;
  color: #0b6b4a;
}

.tuner-inner {
  margin-top: 6px;
  padding: 8px;
  border-radius: 8px;
  background: #f3f7f5;
  border: 1px dashed #cbd9d2;
}

.tuner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.tuner-label {
  min-width: 48px;
}

.tuner-buttons {
  display: flex;
  gap: 4px;
}

.tuner-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #c3d5d0;
  background: #ffffff;
  font-size: 14px;
  cursor: pointer;
}

.tuner-btn:active {
  background: #e3f0ea;
}

.tuner-note {
  margin-top: 4px;
  font-size: 11px;
  color: #777;
}

/* ボタン */
.buttons-section {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.main-btn {
  width: 100%;
  padding: 12px;
  border-radius: 999px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.05s ease, opacity 0.2s ease;
}

.main-btn:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
}

.main-btn:not(:disabled):active {
  transform: translateY(1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.12) inset;
}

/* ①〜③ 色違い */
.main-1 {
  background: #7bcfa6;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.main-2 {
  background: #f6b375;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.main-3 {
  background: #9bc9f5;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

/* ④ 電話ボタン */
.main-4 {
  background: #ffffff;
  color: #0b6b4a;
  border-radius: 18px;
  border: 1px solid #c4d9d0;
  text-align: center;
}

.main-4-sub {
  font-size: 12px;
  margin-top: 4px;
}

/* フッター */
.page-footer {
  margin-top: 18px;
  font-size: 11px;
  color: #666;
  text-align: center;
}

/* モーダル */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: 90%;
  max-width: 360px;
  background: #ffffff;
  border-radius: 14px;
  padding: 14px 16px 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
}

.modal-content h2 {
  font-size: 16px;
  margin: 0 0 10px;
  color: #0b6b4a;
}

.modal-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.modal-row label {
  font-size: 13px;
}

.modal-row input {
  padding: 6px 8px;
  font-size: 14px;
}

.modal-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-primary,
.modal-secondary {
  border-radius: 999px;
  padding: 6px 14px;
  border: none;
  font-size: 13px;
  cursor: pointer;
}

.modal-primary {
  background: #0b6b4a;
  color: #ffffff;
}

.modal-secondary {
  background: #e5ece8;
  color: #333;
}

/* QRモーダル */
.qr-modal {
  text-align: center;
}

.qr-modal p {
  font-size: 13px;
  margin: 4px 0 8px;
}

.qr-box {
  margin: 0 auto 10px;
  width: 220px;
  height: 220px;
}

/* 小さい画面向け */
@media (max-width: 360px) {
  .card-wrapper {
    width: 240px;
  }
}
