* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: sans-serif;
  background: #f5f7fb;
  color: #222;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #1f3c88;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-title {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.4;
}

.option-btn,
.main-btn,
.reset-btn,
.save-btn,
.close-btn {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
}

.option-btn {
  padding: 10px 14px;
  background: #ffffff;
  color: #1f3c88;
  font-weight: bold;
  white-space: nowrap;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

.card {
  margin-bottom: 16px;
  padding: 16px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.card h2 {
  margin-top: 0;
  font-size: 1.05rem;
}

.map-wrap {
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
}

.map-wrap iframe {
  display: block;
  width: 100%;
  height: 280px;
  border: 0;
}

.main-btn,
.reset-btn,
.save-btn {
  width: 100%;
  padding: 14px;
  font-weight: bold;
}

.main-btn {
  background: #2f80ed;
  color: #fff;
}

.reset-btn {
  background: #e74c3c;
  color: #fff;
}

.stamp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stamp-card {
  aspect-ratio: 1 / 1;
  border: 1px solid #d9dfe8;
  border-radius: 14px;
  background: #fafbfc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.stamp-card.active {
  background: #fff;
}

.stamp-card.acquired {
  border-color: #27ae60;
  box-shadow: inset 0 0 0 2px rgba(39, 174, 96, 0.15);
}

.stamp-card.inactive {
  opacity: 0.5;
}

.stamp-number {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.75rem;
  color: #666;
}

.stamp-image-wrap {
  /*width: 64px;
  height: 64px;*/
  width:clamp(90px, 22vw, 140px);
  height:clamp(90px, 22vw, 140px);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stamp-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

.stamp-card.acquired .stamp-image {
  display: block;
}

.stamp-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: #e7ebf2;
  color: #7a8798;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: bold;
}

.stamp-card.acquired .stamp-placeholder {
  display: none;
}

.stamp-name {
  font-size: 0.85rem;
  font-weight: bold;
  line-height: 1.3;
  margin-bottom: 4px;
  word-break: break-word;
}

.stamp-time {
  font-size: 0.7rem;
  color: #555;
  line-height: 1.3;
}

.history-list {
  margin: 0;
  padding-left: 20px;
}

.history-list li {
  margin-bottom: 10px;
  line-height: 1.6;
}

.history-wrap {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #d9dfe8;
  border-radius: 10px;
  padding: 10px;
  background: #fafbfc;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.modal-content {
  position: relative;
  z-index: 1001;
  width: calc(100% - 32px);
  max-width: 420px;
  margin: 80px auto 0;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.modal-header,
.modal-footer {
  padding: 16px;
  border-bottom: 1px solid #eee;
}

.modal-footer {
  border-bottom: none;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.close-btn {
  width: 40px;
  height: 40px;
  background: #f1f3f5;
  color: #333;
  font-size: 1.2rem;
}

.modal-body {
  padding: 16px;
}

.modal-body label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
}

.modal-body select {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid #cfd6e0;
  border-radius: 10px;
  background: #fff;
}

.setting-note {
  margin-top: 12px;
  color: #555;
}

.save-btn {
  background: #27ae60;
  color: #fff;
}

@media (max-width: 480px) {
  .header-inner {
    padding: 12px;
  }

  .app-title {
    font-size: 1.05rem;
  }

  .option-btn {
    padding: 9px 12px;
    font-size: 0.9rem;
  }

  .stamp-image-wrap,
  .stamp-placeholder {
    width: 52px;
    height: 52px;
  }

  .stamp-name {
    font-size: 0.78rem;
  }

  .stamp-time {
    font-size: 0.64rem;
  }
}

@media (min-width: 768px) {
  .map-wrap iframe {
    height: 360px;
  }
}