
:root {
  --paper: #F4F0E8;
  --ink: #292622;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: #F4F0E8;
  color: var(--ink);
  font-family: "Shippori Mincho", serif;
  display: flex;
  justify-content: center;
  align-items: center;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.app {
  width: min(100vw, 440px);
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 10px max(90px, calc(env(safe-area-inset-bottom) + 80px));
}

.poster {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: linear-gradient(180deg, #fcf9f4 0%, #f4efe6 100%);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 20px 20px;
  touch-action: pan-y;
}
.poster:before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .12;
  background: repeating-linear-gradient(0deg, rgba(70,56,43,.03) 0 1px, transparent 1px 4px),
              repeating-linear-gradient(90deg, rgba(70,56,43,.015) 0 1px, transparent 1px 7px);
}

.sheet-nav {
  position: fixed;
  right: max(16px, calc((100vw - 440px) / 2 + 16px));
  top: max(16px, env(safe-area-inset-top));
  z-index: 100;
  display: flex;
  gap: 6px;
  align-items: center;
  background: rgba(43, 40, 38, 0.75);
  padding: 4px 8px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.pill {
  height: 30px;
  min-width: 30px;
  padding: 0 8px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 999px;
  background: rgba(250,248,245,.95);
  display: grid;
  place-items: center;
  font: 700 9px "Space Mono", monospace;
  letter-spacing: .05em;
  color: #292622;
  transition: all 0.15s;
}
.pill.active { background: #2d2a26; color: #fff; border-color: #2d2a26; }
.pill-gear {
  font-size: 19px;
  padding: 0;
  width: 30px;
  height: 30px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pill-add { font-weight: 700; font-size: 14px; width: 30px; height: 30px; padding: 0; }
.pill-album { font-size: 14px; width: 30px; height: 30px; padding: 0; }

.vol-dropdown-wrap { position: relative; }
.vol-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #FAF8F5;
  border: 1px solid #c8beb0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  padding: 4px;
  display: none;
  flex-direction: column;
  min-width: 140px;
  z-index: 110;
}
.vol-menu.show { display: flex; }
.vol-menu-item {
  padding: 6px 10px;
  border: 0;
  background: transparent;
  font: 700 9px "Space Mono", monospace;
  text-align: left;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  color: #333;
}
.vol-menu-item:hover, .vol-menu-item.active { background: #2d2a26; color: #fff; }

.header { position: relative; z-index: 4; text-align: center; margin-top: 4px; }
.vol-header-row {
  display: grid;
  grid-template-columns: 80px 1fr 80px;
  align-items: baseline;
  width: 100%;
}
.vol-header-spacer {
  width: 80px;
  pointer-events: none;
  visibility: hidden;
}
.vol-title-input {
  border: 0;
  background: transparent;
  outline: 0;
  font: 800 clamp(13px, 4vw, 17px) "Cinzel", "Shippori Mincho", serif;
  letter-spacing: .04em;
  color: var(--ink);
  text-align: center;
  width: 100%;
  min-width: 0;
  border-bottom: 1px dotted transparent;
}
.vol-title-input:focus { border-bottom-color: #8c8275; }

.vol-period-dropdown-wrap {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 1px;
  width: 80px;
  flex-shrink: 0;
}
.vol-period-select {
  border: 0;
  background: transparent;
  outline: 0;
  font: 700 11px "Space Mono", monospace;
  letter-spacing: .02em;
  color: #6a6155;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
  text-align-last: right;
  border-bottom: 1px dotted transparent;
}
.vol-period-select:focus { border-bottom-color: #8c8275; }
.vol-period-dot {
  font: 700 11px "Space Mono", monospace;
  color: #6a6155;
  user-select: none;
}

.subtitle {
  border: 0;
  background: transparent;
  padding: .25rem 0 0;
  font: 700 10px "Cinzel", "Shippori Mincho", serif;
  letter-spacing: .25em;
  color: #776e63;
  cursor: pointer;
  border-bottom: 1px dotted #bcb1a3;
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 6px;
  width: 100%;
  margin: 10px 0 auto;
  position: relative;
  z-index: 5;
}

.slot {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}
.poster.is-edit-locked .slot { pointer-events: none; cursor: default; }

.stamp-empty {
  position: absolute;
  inset: 0;
  border: 1px dashed rgba(119, 110, 99, 0.4);
  border-radius: 4px;
  background: rgba(247, 241, 232, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stamp-empty span {
  font: 600 12px "Playfair Display", serif;
  color: #b5aca0;
}

.stamp-shell-svg {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  overflow: visible;
  filter: drop-shadow(0 2px 3.5px rgba(45, 38, 30, 0.3));
}

.footer-text {
  text-align: center;
  font: 700 8px "Cinzel", serif;
  letter-spacing: .2em;
  color: #b5ad9e;
  padding-top: 6px;
  position: relative;
  z-index: 4;
}
.footer-credit {
  text-align: center;
  font: 600 6.5px "Cinzel", serif;
  letter-spacing: .15em;
  color: #9a9284;
  margin-top: 2px;
}

.deco-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
.poster.is-edit-locked .deco-layer { pointer-events: auto; }
.deco-item {
  position: absolute;
  cursor: move;
  touch-action: none;
  user-select: none;
  transform-origin: center center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform, left, top;
}
.deco-item.selected {
  outline: 2px dashed #8f2929;
  outline-offset: 4px;
}
.deco-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.15));
  image-rendering: -webkit-optimize-contrast;
  image-rendering: smooth;
  transform: translateZ(0);
}
.deco-item .deco-txt {
  font-family: "Cinzel", "Shippori Mincho", "Noto Serif JP", serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  pointer-events: none;
  transform: translateZ(0);
}

.bottom {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100vw - 24px), 390px);
  z-index: 60;
  display: flex;
  gap: 8px;
}
.bottom button {
  flex: 1;
  border: 1px solid #2d2a26;
  border-radius: 999px;
  padding: .7rem;
  background: #2d2a26;
  color: #F4F0E8;
  box-shadow: 0 8px 20px rgba(0,0,0,.2);
  font: 700 10px "Cinzel", serif;
  letter-spacing: .15em;
  transition: all 0.2s;
}
.bottom button.active { background: #8f2929; border-color: #8f2929; color: #fff; }

.edit-bar {
  position: fixed;
  left: 50%;
  bottom: calc(max(12px, env(safe-area-inset-bottom)) + 50px);
  transform: translateX(-50%);
  width: min(calc(100vw - 24px), 390px);
  background: #FAF8F5;
  border: 1px solid #c8beb0;
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  z-index: 65;
  display: none;
  flex-direction: column;
  gap: 6px;
}
.edit-bar.show { display: flex; }
.edit-bar-btns { display: flex; gap: 6px; }
.edit-bar-btns .btn { flex: 1; padding: .35rem 0; font-size: 8px; text-align: center; }

dialog {
  width: min(92vw, 390px);
  max-height: 92svh;
  border: 0;
  border-radius: 16px;
  padding: 0;
  background: #FAF8F5;
  box-shadow: 0 20px 60px rgba(35,29,24,.3);
  overflow: hidden;
}
dialog::backdrop { background: rgba(35,30,26,.55); backdrop-filter: blur(4px); }
.modal {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  max-height: 92svh;
  box-sizing: border-box;
  overflow-x: hidden;
  max-width: 100%;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #c8beb0; padding-bottom: .4rem; margin-bottom: .6rem; flex-shrink: 0; }
.modal-title { font: 700 12px "Cinzel", serif; letter-spacing: .12em; }
.modal-sub { font-size: 9px; color: #81786d; }
.modal-x { border: 0; background: transparent; font-size: 20px; }

.builder-sticky-top {
  position: sticky;
  top: 0;
  background: #FAF8F5;
  z-index: 20;
  border-bottom: 1px solid #d5cdbc;
  padding-bottom: 8px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100%;
}
.builder-scroll-body {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  padding-top: 6px;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.choose-album-trigger {
  border: 1.5px dashed #c0b6a7;
  border-radius: 10px;
  background: #fffdf9;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  margin: 6px 0 8px;
  transition: all 0.15s;
}
.choose-album-trigger:active { background: #f2ece0; border-color: #2d2a26; }
.thumb-stack {
  display: flex;
  align-items: center;
  position: relative;
  width: 50px;
  height: 36px;
  flex-shrink: 0;
}
.thumb-stack img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  background: #ded7cb;
  border: 1px solid #FAF8F5;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  position: absolute;
}
.thumb-stack img:nth-child(1) { left: 0; z-index: 2; }
.thumb-stack img:nth-child(2) { left: 16px; z-index: 1; transform: scale(0.9); opacity: 0.9; }
.trigger-texts { flex: 1; }
.trigger-title { font: 800 10px "Cinzel", serif; color: #2d2a26; letter-spacing: .08em; }
.trigger-desc { font: 600 7.5px "Space Mono", monospace; color: #776e63; margin-top: 2px; }

.trigger-btn-pill {
  padding: 5px 10px;
  border-radius: 999px;
  background: #2d2a26;
  color: #fff;
  border: 1px solid #2d2a26;
  font: 700 8px "Cinzel", serif;
  letter-spacing: .08em;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.album-card-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0;
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  -webkit-overflow-scrolling: touch;
}
.album-card {
  border: 1px solid #c8beb0;
  border-radius: 8px;
  background: #fffdf9;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.album-card:active { background: #f2ece0; }
.album-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  background: #ded7cb;
  border: 1px solid #c0b6a7;
  flex-shrink: 0;
}
.album-thumb img { width: 100%; height: 100%; object-fit: cover; }
.album-info { flex: 1; }
.album-title { font: 800 10px "Cinzel", serif; color: #333; letter-spacing: .06em; }
.album-count { font: 600 8px "Space Mono", monospace; color: #8c8275; margin-top: 3px; }
.album-arrow { font: 700 12px "Space Mono", monospace; color: #776e63; }

.picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px 2px;
  max-height: 48vh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.picker-item {
  aspect-ratio: 1;
  border: 1px solid #c8beb0;
  border-radius: 6px;
  background: #ded7cb;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  position: relative;
  transition: transform 0.1s;
}
.picker-item:active { transform: scale(0.96); }
.picker-item.selected {
  border-color: #c8beb0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.picker-item.is-used {
  background: #c5bcaf;
  border-color: #aba193;
}
.picker-item.is-used img {
  opacity: 0.85;
}
.picker-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }

.new-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #8f2929;
  color: #fff;
  font: 700 6.5px "Space Mono", monospace;
  padding: 1px 4px;
  border-radius: 999px;
  letter-spacing: 0.05em;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  pointer-events: none;
  z-index: 3;
}

.used-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(45, 42, 38, 0.75);
  color: #F4F0E8;
  font: 700 6px "Space Mono", monospace;
  padding: 1px 4px;
  border-radius: 999px;
  letter-spacing: 0.05em;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  pointer-events: none;
  z-index: 3;
}

.picker-preview-large-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #ede6da;
  border: 1px solid #d5cdbc;
  border-radius: 12px;
  padding: 12px 10px 10px;
  margin-top: 8px;
  gap: 8px;
}
.picker-stepper-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}
.picker-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid #c8beb0;
  background: #FAF8F5;
  color: #2d2a26;
  font: 700 12px "Space Mono", monospace;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s;
}
.picker-nav-btn:active:not(:disabled) {
  background: #2d2a26;
  color: #fff;
}
.picker-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.picker-preview-big-frame {
  width: 175px;
  height: 175px;
  border-radius: 8px;
  background: #ded7cb;
  border: 1.5px solid #FAF8F5;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.picker-preview-big-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.picker-preview-details {
  text-align: center;
}
.picker-preview-title { font: 800 11px "Cinzel", serif; color: #2d2a26; letter-spacing: .08em; }
.picker-preview-sub { font: 600 7.5px "Space Mono", monospace; color: #776e63; margin-top: 2px; }

.palette-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 8px;
  background: #fffdf9;
  border: 1px solid #d5cdbc;
  border-radius: 10px;
  padding: 6px 8px;
}
.palette-swatches-row {
  display: flex;
  flex: 1;
  gap: 5px;
  align-items: center;
  justify-content: space-between;
}
.swatch-item-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px #a49c90;
  cursor: pointer;
  box-sizing: border-box;
  padding: 0;
  transition: transform 0.1s, box-shadow 0.1s;
}
.swatch-item-btn.selected {
  box-shadow: 0 0 0 2.5px #2d2a26;
  transform: scale(1.08);
}
.palette-change-pill {
  padding: 5px 10px;
  border-radius: 999px;
  background: #2d2a26;
  color: #fff;
  border: 1px solid #2d2a26;
  font: 700 8px "Cinzel", serif;
  letter-spacing: .08em;
  flex-shrink: 0;
}

.palette-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0;
  max-height: 65vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.palette-card {
  border: 1.5px solid #c8beb0;
  border-radius: 10px;
  background: #fffdfa;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.15s;
}
.palette-card:active { background: #f3ede2; }
.palette-card.active {
  border-color: #776e63;
  box-shadow: inset 0 0 0 1px #8c8275;
}
.palette-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.palette-card-name-ja {
  font: 700 14px "Shippori Mincho", serif;
  color: #292622;
  letter-spacing: 0.05em;
}
.palette-card-name-en {
  font: 800 9px "Cinzel", serif;
  color: #776e63;
  letter-spacing: 0.12em;
}
.palette-card-desc {
  font: 600 7.5px "Space Mono", monospace;
  color: #8c8275;
  margin-top: -4px;
}
.palette-color-strip {
  display: flex;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #c8beb0;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}
.palette-color-block {
  flex: 1;
  height: 100%;
}

.stage2-container {
  background: #ede6da;
  border: 1px solid #d5cdbc;
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 6px;
}
.stage2-title {
  font: 700 8px "Cinzel", serif;
  letter-spacing: .12em;
  color: #5a5247;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.canvas-preview-area {
  width: 100%;
  height: 220px;
  background: #fbf8f2;
  border: 1px dashed #c0b6a7;
  border-radius: 6px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: crosshair;
}
.canvas-stamp-base {
  width: 200px;
  height: 200px;
  position: relative;
  pointer-events: none;
}

.mode-toggle-bar {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  width: 100%;
}
.mode-btn {
  flex: 1 1 0;
  width: 50%;
  padding: 4px 0;
  font: 700 7.5px "Cinzel", serif;
  border: 1px solid #c0b6a7;
  border-radius: 4px;
  background: #FAF8F5;
  text-align: center;
}
.mode-btn.active {
  background: #2d2a26;
  color: #fff;
  border-color: #2d2a26;
}

.pm-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
  width: 100%;
}
.pm-control-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.pm-control-item label {
  font: 700 7px "Cinzel", serif;
  color: #776e63;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pm-control-item input[type=range] {
  width: 100%;
  accent-color: #2d2a26;
  height: 4px;
  margin: 0;
}
.snap-btns {
  display: flex;
  gap: 4px;
  margin-top: 5px;
  justify-content: space-between;
}
.snap-btn {
  flex: 1;
  padding: 3px 0;
  font: 700 7px "Cinzel", serif;
  background: #f4eee3;
  border: 1px solid #c0b6a7;
  border-radius: 4px;
  text-align: center;
}
.snap-btn:active { background: #2d2a26; color: #fff; }

.palette {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  margin: 4px 0 6px;
  padding: 2px 4px;
  width: 100%;
  box-sizing: border-box;
}
.swatch {
  height: 16px;
  border-radius: 999px;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px #a49c90;
  cursor: pointer;
  box-sizing: border-box;
}
.swatch.selected { box-shadow: 0 0 0 2.5px #2d2a26; transform: scale(1.05); }

.mapping-card {
  background: #f8f4ed;
  border: 1px solid #d5cdbc;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 6px 0;
  width: 100%;
  box-sizing: border-box;
}
.mapping-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 3px;
  gap: 4px;
}

.mapping-checkboxes {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  gap: 2px;
  font-size: 8px;
  color: #6a6256;
  justify-content: end;
}
.mapping-checkboxes label {
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.mapping-checkboxes input[type=checkbox] {
  accent-color: #2d2a26;
  width: 12px;
  height: 12px;
  cursor: pointer;
  margin: 0;
}

.field { display: grid; gap: 3px; margin: 6px 0; width: 100%; box-sizing: border-box; }
.field label { font: 700 8.5px "Cinzel", serif; letter-spacing: .12em; color: #776e63; }
.field input {
  width: 100%;
  max-width: 100%;
  border: 1px solid #bcb1a3;
  border-radius: 6px;
  background: #fffdf8;
  padding: .45rem .6rem;
  font-size: 11px;
  font-family: inherit;
  box-sizing: border-box;
}
.field input[type="date"] {
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  font-size: 11px;
  display: block;
}
.field input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  justify-content: flex-start;
  margin: 0;
  padding: 0;
}

.actions { display: flex; justify-content: flex-end; gap: 5px; margin-top: 8px; flex-shrink: 0; }
.btn {
  border: 1px solid #8b8175;
  border-radius: 999px;
  background: #fbf7f1;
  padding: .4rem .75rem;
  font: 700 8.5px "Cinzel", serif;
  letter-spacing: .08em;
}
.btn.primary { background: #2d2a26; color: #fff; border-color: #2d2a26; }

.card-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  border-bottom: 1px dotted #c8beb0;
  padding-bottom: 6px;
  flex-shrink: 0;
}
.card-tab {
  flex: 1;
  padding: 4px 0;
  font: 700 8px "Cinzel", serif;
  border: 1px solid #c0b6a7;
  border-radius: 4px;
  background: #fffaf3;
  text-align: center;
}
.card-tab.active { background: #2d2a26; color: #fff; border-color: #2d2a26; }

.card-stepper-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}
.card-nav-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #c8beb0;
  background: #FAF8F5;
  color: #2d2a26;
  font: 700 11px "Space Mono", monospace;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.card-nav-btn:active:not(:disabled) {
  background: #2d2a26;
  color: #fff;
}
.card-nav-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

.mini-card-container {
  background: #FAF8F5;
  border: 1px solid #d5cdbc;
  border-radius: 22px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(40,30,20,.15);
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 260px;
  margin: 0 auto 8px;
  corner-smoothing: 100%;
}
.std-card-main-visual {
  width: 100%;
  aspect-ratio: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.std-card-info-area {
  width: 100%;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}
.std-card-title {
  font: 800 13px "Cinzel", "Shippori Mincho", "Noto Serif JP", serif;
  letter-spacing: .08em;
  color: #292622;
}
.std-card-meta {
  font: 600 8.5px "Space Mono", monospace;
  color: #6a6155;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 2px;
}
.std-card-credit {
  position: absolute;
  right: 0;
  bottom: 0;
  font: 700 6.5px "Cinzel", serif;
  letter-spacing: .15em;
  color: #a9a193;
}

.polaroid-container {
  width: 260px;
  aspect-ratio: 4 / 5;
  background: transparent !important;
  position: relative;
  display: flex;
  flex-direction: column;
  margin: 0 auto 8px;
}
.polaroid-top-border {
  height: 16px;
  width: 100%;
  background: #FAF8F5;
  border-top: 1px solid #d5cdbc;
  border-left: 1px solid #d5cdbc;
  border-right: 1px solid #d5cdbc;
}
.polaroid-mid-row { flex: 1; display: flex; width: 100%; }
.polaroid-side-border { width: 16px; background: #FAF8F5; height: 100%; }
.polaroid-side-border.left { border-left: 1px solid #d5cdbc; }
.polaroid-side-border.right { border-right: 1px solid #d5cdbc; }

.polaroid-cutout-hole {
  flex: 1;
  background: transparent;
  border-radius: 0px;
  border: 1px dashed rgba(119,110,99,0.4);
  box-shadow: inset 0 0 0 1px rgba(70,56,43,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}
.polaroid-cutout-hole:active { cursor: grabbing; }

.polaroid-rendered-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  pointer-events: none;
}

.polaroid-cutout-guide {
  font: 700 8px "Cinzel", serif;
  letter-spacing: .12em;
  color: #a89f92;
  pointer-events: none;
}

/* 写真枠全体を相似拡大キャンバスとして覆う消印レイヤー */
.polaroid-photo-postmark-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: none;
  z-index: 5;
  overflow: visible;
}

.polaroid-chin-area {
  height: 82px;
  background: #FAF8F5;
  width: 100%;
  border-left: 1px solid #d5cdbc;
  border-right: 1px solid #d5cdbc;
  border-bottom: 1px solid #d5cdbc;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 10px;
}
.polaroid-stamp-preview {
  width: 62px;
  height: 62px;
  position: relative;
  flex-shrink: 0;
}
.polaroid-text-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.polaroid-title {
  font: 700 9.5px "Cinzel", "Shippori Mincho", "Noto Serif JP", serif;
  color: #292622;
}
.polaroid-sub { font: 600 8px "Space Mono", monospace; color: #6a6155; }
.polaroid-credit {
  font: 700 6px "Cinzel", serif;
  letter-spacing: .15em;
  color: #a9a193;
  margin-top: 2px;
}
