* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  background: #f5f0eb;
  color: #333;
  min-height: 100dvh;
  overflow-x: hidden;
}

.screen {
  display: none;
  min-height: 100dvh;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: 480px;
  padding: 24px 16px;
  text-align: center;
}

h1 {
  font-size: 1.6rem;
  margin-bottom: 24px;
  color: #e07b8b;
}

h2 {
  font-size: 1.2rem;
  margin-bottom: 20px;
  color: #555;
}

.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  text-align: left;
}

.screen-header h2 {
  margin-bottom: 0;
  flex: 1;
}

.btn-back {
  background: none;
  border: none;
  color: #e07b8b;
  font-size: 1rem;
  cursor: pointer;
  white-space: nowrap;
  padding: 4px 0;
  -webkit-tap-highlight-color: transparent;
}

.steps {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 28px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.steps p {
  font-size: 1.1rem;
  padding: 8px 0;
  color: #555;
}

.btn-primary {
  display: inline-block;
  width: 100%;
  max-width: 320px;
  padding: 18px 24px;
  font-size: 1.2rem;
  font-weight: bold;
  color: #fff;
  background: #e07b8b;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover { background: #c96878; }
.btn-primary:disabled { background: #ccc; cursor: default; }

.btn-secondary {
  display: inline-block;
  width: 100%;
  max-width: 320px;
  padding: 14px 24px;
  font-size: 1rem;
  color: #888;
  background: #fff;
  border: 2px solid #ddd;
  border-radius: 50px;
  cursor: pointer;
  margin-top: 12px;
  transition: border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn-secondary:hover { border-color: #bbb; }

.notice {
  margin-top: 24px;
  font-size: 0.85rem;
  color: #999;
  line-height: 1.6;
}

/* イベント選択 */
.event-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}

.event-item {
  background: #fff;
  border: 3px solid transparent;
  border-radius: 16px;
  padding: 20px 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.event-item:active { transform: scale(0.96); }

.event-item:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.event-emoji {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 8px;
}

.event-label {
  font-size: 1rem;
  font-weight: bold;
  color: #555;
}

/* デザイン選択 */
.frame-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.frame-item {
  background: #fff;
  border: 3px solid transparent;
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.frame-item:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.1); }

.frame-item.selected {
  border-color: #e07b8b;
  box-shadow: 0 2px 12px rgba(224,123,139,0.3);
}

.frame-item img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 50% / 16px 16px;
}

.frame-item .frame-label {
  display: block;
  margin-top: 6px;
  font-size: 0.85rem;
  color: #666;
  font-weight: bold;
}

/* 撮影画面 */
#screen-camera { background: #000; }
#screen-camera.active {
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.camera-wrapper {
  flex: 1;
  position: relative;
  width: 100%;
  background: #000;
  overflow: hidden;
}

.camera-container {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
}

.camera-container video {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

.frame-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  z-index: 2;
}

.zoom-controls {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 5;
}

.btn-zoom {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.6);
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.btn-zoom:active { transform: scale(0.92); }

.zoom-label {
  background: rgba(0,0,0,0.55);
  color: #fff;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
}

.countdown {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 8rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 30px rgba(0,0,0,0.9);
  z-index: 5;
  display: none;
  pointer-events: none;
}

.countdown.active { display: block; }

.camera-controls {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 14px;
  background: rgba(0,0,0,0.35);
  border-radius: 40px;
  z-index: 5;
}

.btn-capture {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #e07b8b;
  border: 3px solid #fff;
  color: #fff;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn-capture:active { transform: scale(0.92); }

.capture-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.btn-timer {
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 50px;
  padding: 5px 14px;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn-timer:active { transform: scale(0.95); }

.timer-hint {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.7);
  margin: 0;
}

.btn-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#btn-toggle-orientation { font-size: 0.75rem; font-weight: bold; }

.btn-icon:hover { background: rgba(255,255,255,0.3); }

/* 保存画面 */
.preview-wrapper { margin-bottom: 20px; }

.img-result {
  width: 100%;
  max-width: 400px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.burst-thumbs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
  flex-wrap: wrap;
}

.burst-thumb {
  width: 90px;
  height: auto;
  border-radius: 8px;
  border: 4px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.burst-thumb.selected {
  border-color: #e07b8b;
  transform: scale(1.04);
}

.burst-hint {
  font-size: 0.85rem;
  color: #888;
  margin-top: 10px;
}

/* フラッシュ */
.flash {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: #fff;
  z-index: 100;
  animation: flash-anim 0.3s ease-out forwards;
  pointer-events: none;
}

@keyframes flash-anim {
  0%   { opacity: 0.9; }
  100% { opacity: 0; }
}
