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

body {
  font-family: 'Segoe UI', 'Hiragino Sans', 'Meiryo', sans-serif;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
  overflow-x: hidden;
}

/* === Header === */
.header {
  background: #1a1a2e;
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  position: relative;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header h1 {
  font-size: 18px;
  font-weight: 600;
}

.privacy-badge {
  font-size: 10px;
  background: rgba(46,204,113,0.2);
  color: #2ecc71;
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 500;
  border: 1px solid rgba(46,204,113,0.3);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.session-counter {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
}

.session-counter strong {
  color: #fff;
  font-size: 16px;
  margin: 0 2px;
}

.shortcut-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  background: transparent;
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  position: relative;
}

.shortcut-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.shortcut-popup {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: #1a1a2e;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 200;
}

.shortcut-btn:hover .shortcut-popup,
.shortcut-btn:focus .shortcut-popup {
  display: block;
}

.shortcut-popup div {
  padding: 3px 0;
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.shortcut-popup kbd {
  background: rgba(255,255,255,0.1);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: inherit;
  font-size: 11px;
}

/* === Step Indicator === */
.steps {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 24px 8px;
  gap: 0;
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.3s;
}

.steps.visible {
  opacity: 1;
  transform: translateY(0);
}

.step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #aaa;
  font-weight: 500;
  transition: color 0.3s;
}

.step-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ddd;
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.3s;
}

.step.active .step-circle {
  background: #2563eb;
  color: #fff;
}

.step.active {
  color: #2563eb;
}

.step.done .step-circle {
  background: #2ecc71;
  color: #fff;
}

.step.done {
  color: #666;
}

.step-line {
  width: 40px;
  height: 2px;
  background: #ddd;
  margin: 0 8px;
  transition: background 0.3s;
}

.step-line.done {
  background: #2ecc71;
}

/* === Main Content Area === */
.main-area {
  display: flex;
  justify-content: center;
  padding: 16px 24px;
  padding-bottom: 100px;
  min-height: calc(100vh - 60px);
}

/* === Drop Zone (EMPTY state) === */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 700px;
  min-height: 350px;
  border: 3px dashed #c5c5d0;
  border-radius: 16px;
  background: #fafafa;
  color: #888;
  font-size: 17px;
  transition: all 0.2s;
  cursor: pointer;
  align-self: center;
}

.drop-zone:hover {
  border-color: #999;
  background: #f5f5ff;
}

.drop-zone.drag-over {
  border-color: #2563eb;
  background: #eff3ff;
  color: #2563eb;
}

.drop-zone .icon {
  font-size: 56px;
  margin-bottom: 16px;
  filter: grayscale(0.3);
}

.drop-zone .main-text {
  font-weight: 500;
}

.drop-zone .sub-text {
  font-size: 13px;
  color: #aaa;
  margin-top: 8px;
}

.drop-zone .paste-hint {
  font-size: 12px;
  color: #bbb;
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.drop-zone .paste-hint kbd {
  background: #eee;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: inherit;
  font-size: 11px;
  border: 1px solid #ddd;
}

/* === Canvas (EDITING state) === */
.canvas-container {
  display: none;
  max-width: 900px;
  width: 100%;
}

.canvas-wrapper {
  position: relative;
  display: inline-block;
  line-height: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0,0,0,0.1);
}

#mainCanvas {
  max-width: 100%;
  height: auto;
  cursor: crosshair;
}

.overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  cursor: crosshair;
  pointer-events: auto;
}

/* Canvas hint overlay */
.canvas-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
  padding: 24px 16px 12px;
  font-size: 13px;
  text-align: center;
  pointer-events: none;
  transition: opacity 0.5s;
}

.canvas-hint.hidden {
  opacity: 0;
}

/* === Floating Action Bar === */
.floating-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.05);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 50;
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.floating-bar.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.floating-bar .rect-count {
  font-size: 12px;
  color: #666;
  padding: 6px 12px;
  background: #f5f5f5;
  border-radius: 8px;
  font-weight: 500;
  min-width: 80px;
  text-align: center;
  white-space: nowrap;
}

.floating-bar .rect-count strong {
  color: #2563eb;
  font-size: 15px;
}

.bar-separator {
  width: 1px;
  height: 28px;
  background: #eee;
  margin: 0 2px;
}

.floating-bar button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
  color: #555;
  min-height: 40px;
}

.floating-bar button:hover {
  background: #f5f5f5;
}

.floating-bar button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.floating-bar button:disabled:hover {
  background: transparent;
}

.floating-bar .btn-undo { color: #555; }
.floating-bar .btn-reset { color: #e74c3c; }

.floating-bar .btn-download {
  background: #2563eb;
  color: #fff;
  padding: 8px 20px;
}

.floating-bar .btn-download:hover {
  background: #1d4ed8;
}

.floating-bar .btn-next {
  color: #666;
  font-size: 12px;
}

.floating-bar .btn-next:hover {
  color: #333;
}

/* Reset confirmation inline */
.reset-confirm {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #e74c3c;
  animation: fadeIn 0.15s;
}

.reset-confirm button {
  font-size: 12px;
  padding: 4px 10px;
  min-height: 28px;
}

.reset-confirm .btn-yes {
  color: #e74c3c;
  font-weight: 600;
}

.reset-confirm .btn-no {
  color: #999;
}

/* === Done Screen === */
.done-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  width: 100%;
  max-width: 500px;
  align-self: center;
  animation: fadeIn 0.3s;
}

.done-icon {
  font-size: 56px;
  animation: popIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.done-screen h2 {
  font-size: 22px;
  color: #333;
  font-weight: 600;
}

.done-screen p {
  color: #888;
  font-size: 14px;
}

.done-screen .btn-next-image {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 14px 32px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.done-screen .btn-next-image:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.done-screen .btn-reedit {
  background: none;
  border: none;
  color: #999;
  font-size: 13px;
  cursor: pointer;
  padding: 8px;
  text-decoration: underline;
}

.done-screen .btn-reedit:hover {
  color: #666;
}

/* === Toast === */
.toast-container {
  position: fixed;
  top: 60px;
  right: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #1a1a2e;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  animation: toastIn 0.25s, toastOut 0.3s 2.5s forwards;
  white-space: nowrap;
}

/* === Animations === */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

@keyframes rectFlash {
  0% { box-shadow: 0 2px 16px rgba(0,0,0,0.1); }
  50% { box-shadow: 0 2px 16px rgba(37,99,235,0.4); }
  100% { box-shadow: 0 2px 16px rgba(0,0,0,0.1); }
}

.canvas-wrapper.flash {
  animation: rectFlash 0.3s;
}

/* === Hidden utility === */
.hidden { display: none !important; }

#fileInput { display: none; }

/* === SEO Footer === */
.seo-footer {
  max-width: 700px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  font-size: 12px;
  line-height: 1.8;
  color: #aaa;
}

.seo-footer h2 {
  font-size: 13px;
  color: #999;
  font-weight: 600;
  margin-bottom: 8px;
}

.seo-footer p {
  margin-bottom: 12px;
}

.seo-footer .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.seo-footer .tag {
  background: #e8e8ec;
  color: #888;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
}

.seo-footer a {
  color: #7a8aaa;
  text-decoration: none;
  border-bottom: 1px solid #ccc;
  transition: color 0.15s;
}

.seo-footer a:hover {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

/* === Ad Slots === */
.ad-slot {
  max-width: 728px;
  margin: 0 auto;
  text-align: center;
  padding: 8px;
}

.ad-slot a {
  display: block;
  text-decoration: none;
  transition: opacity 0.15s;
}

.ad-slot a:hover {
  opacity: 0.85;
}

.ad-slot-top {
  padding-top: 0;
}

.ad-slot-done {
  margin-top: 24px;
  max-width: 400px;
}

.ad-slot-footer {
  padding-bottom: 16px;
  border-bottom: 1px solid #eee;
  margin-bottom: 24px;
}

.ad-placeholder {
  background: #f5f5f8;
  border: 1px dashed #d0d0d8;
  border-radius: 8px;
  color: #bbb;
  font-size: 11px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
}

.ad-placeholder.leaderboard {
  min-height: 90px;
}

.ad-placeholder.rectangle {
  min-height: 120px;
}

.ad-slot img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

/* === Responsive === */
@media (max-width: 600px) {
  .header { padding: 10px 16px; }
  .header h1 { font-size: 16px; }
  .main-area { padding: 12px 12px 100px; }
  .floating-bar {
    bottom: 12px;
    padding: 6px 8px;
    gap: 4px;
    max-width: calc(100% - 24px);
  }
  .floating-bar button {
    padding: 8px 10px;
    font-size: 12px;
    min-height: 44px;
  }
  .floating-bar .btn-download {
    padding: 8px 16px;
  }
  .drop-zone {
    min-height: 280px;
    font-size: 15px;
  }
  .session-counter { display: none; }
  .steps { padding: 12px 16px 4px; }
  .step { font-size: 11px; }
  .step-line { width: 24px; }
  .ad-slot { padding: 6px; }
  .ad-placeholder.leaderboard { min-height: 60px; }
}
