/* SAKE FACE — styles.css
   藍（前掛け）地、生成りの文字、朱印はお気に入り（気になる）の印にだけ使う。 */

:root {
  --indigo: #1C2740;
  --indigo-deep: #141C30;
  --indigo-raise: #243352;
  --indigo-line: #33405F;
  --kinari: #F2ECDF;
  --kinari-dim: #B9B4A7;
  --muted: #8F9AB3;
  --shu: #C8412B;
  --shu-deep: #A33323;
  --paper: #F4EFE4;
  --paper-2: #EAE3D3;
  --paper-ink: #1F1E1C;
  --paper-sub: #6E6558;
  --paper-line: #D8D0BF;
  --sans: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Noto Sans CJK JP', 'Yu Gothic', 'Meiryo', system-ui, sans-serif;
  --serif: 'Hiragino Mincho ProN', 'Yu Mincho', 'YuMincho', 'Noto Serif JP', 'Noto Serif CJK JP', 'BIZ UDPMincho', Georgia, serif;
  --top-h: 56px;
  --tab-h: 62px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--kinari);
  background-color: var(--indigo);
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.03) 0 1px, transparent 1px 7px);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--kinari); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: .02em; }
h1 { font-size: 26px; line-height: 1.35; }
h2 { font-size: 20px; line-height: 1.4; }
h3 { font-size: 16px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.serif { font-family: var(--serif); }

/* ---------- shell ---------- */
.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 20;
  height: calc(var(--top-h) + var(--sat)); padding: var(--sat) 16px 0;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(to bottom, rgba(28,39,64,.96), rgba(28,39,64,.75));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-seal {
  width: 26px; height: 40px; border-radius: 4px; background: var(--shu); color: var(--kinari);
  font-family: var(--serif); font-weight: 700; font-size: 14px; line-height: 1;
  display: grid; place-items: center; writing-mode: vertical-rl; text-orientation: upright; letter-spacing: .1em;
}
.logo-word { font-size: 13px; font-weight: 600; letter-spacing: .18em; }
.topbar-actions { display: flex; gap: 4px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--kinari-dim); }
.icon-btn:hover, .icon-btn.active { color: var(--kinari); background: rgba(255,255,255,.06); }
.icon-btn svg { width: 22px; height: 22px; }

.screen {
  flex: 1; display: flex; flex-direction: column;
  padding: calc(var(--top-h) + var(--sat) + 8px) 20px calc(var(--tab-h) + var(--sab) + 16px);
}
.screen.no-tabs { padding-bottom: calc(var(--sab) + 24px); }
.screen-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.screen-head .count { font-family: var(--serif); font-size: 22px; color: var(--kinari-dim); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.divider { height: 1px; background: var(--indigo-line); margin: 6px 0; }

.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 20;
  height: calc(var(--tab-h) + var(--sab)); padding-bottom: var(--sab);
  display: flex; background: rgba(20,28,48,.94);
  border-top: 1px solid var(--indigo-line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 10px; letter-spacing: .14em; }
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--kinari); }
.tab .badge { position: absolute; }

/* ---------- buttons / inputs ---------- */
.btn {
  border-radius: 999px; padding: 13px 22px; font-size: 15px; font-weight: 600;
  border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s var(--ease), opacity .12s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--kinari); color: var(--indigo); }
.btn.ghost { border-color: var(--kinari-dim); color: var(--kinari); }
.btn.quiet { color: var(--kinari-dim); padding: 8px 12px; font-weight: 500; }
.btn.danger { border-color: var(--shu); color: #F0A090; }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--indigo-line);
  background: var(--indigo-raise); color: var(--kinari); font-size: 14px; line-height: 1.2;
}
.chip.on { background: var(--kinari); color: var(--indigo); border-color: var(--kinari); font-weight: 600; }
.chip.warn.on { background: var(--shu); border-color: var(--shu); color: var(--kinari); }

.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 13px; color: var(--kinari-dim); }
.input, select.input {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--indigo-line);
  background: var(--indigo-deep); color: var(--kinari); font-size: 15px; -webkit-appearance: none; appearance: none;
}
.input::placeholder { color: #5f6a83; }
.switch { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--indigo-line); transition: background .15s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--kinari-dim); transition: transform .15s var(--ease), background .15s; }
.switch.on { background: var(--kinari); }
.switch.on::after { transform: translateX(18px); background: var(--indigo); }
.seg { display: inline-flex; border: 1px solid var(--indigo-line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { padding: 6px 12px; border-radius: 999px; font-size: 13px; color: var(--kinari-dim); }
.seg button.on { background: var(--kinari); color: var(--indigo); font-weight: 600; }

.note { font-size: 13px; color: var(--muted); line-height: 1.7; }
.callout { border-left: 2px solid var(--kinari-dim); padding: 4px 0 4px 14px; color: var(--kinari-dim); font-size: 13px; line-height: 1.7; }

/* ---------- onboarding ---------- */
.onb { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 26px; }
.onb-fan { position: relative; height: 210px; margin: 0; }
.onb-fan .mini { position: absolute; left: 50%; top: 6px; width: 136px; aspect-ratio: 3/4; border-radius: 8px; overflow: hidden; box-shadow: 0 16px 30px rgba(0,0,0,.45); transform-origin: 50% 120%; }
.onb-fan .mini svg { width: 100%; height: 100%; display: block; }
.onb-fan .mini:nth-child(1) { transform: translateX(-50%) rotate(-14deg) translateX(-60px); }
.onb-fan .mini:nth-child(2) { transform: translateX(-50%) rotate(0deg) translateY(-8px); z-index: 2; }
.onb-fan .mini:nth-child(3) { transform: translateX(-50%) rotate(14deg) translateX(60px); }
.onb h1 { font-size: 30px; }
.onb .flow { font-size: 14px; color: var(--kinari-dim); letter-spacing: .04em; }
.onb .flow b { color: var(--kinari); font-weight: 600; }
.block-msg { border: 1px solid var(--shu); border-radius: 12px; padding: 12px 14px; color: #F0A090; font-size: 14px; }

/* ---------- FACE / deck ---------- */
.face-screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.deck {
  position: relative;
  width: min(100%, calc((100dvh - 320px) * 0.75));
  min-width: 220px;
  aspect-ratio: 3 / 4;
}
.face-card {
  position: absolute; inset: 0; border-radius: 10px; overflow: hidden; background: var(--paper);
  box-shadow: 0 22px 44px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.35);
  touch-action: none; user-select: none; -webkit-user-select: none; will-change: transform;
  transition: transform .28s var(--ease), opacity .28s var(--ease);
}
.face-card.dragging { transition: none; }
.face-card.top { cursor: grab; }
.face-card.top:active { cursor: grabbing; }
.face-card svg { width: 100%; height: 100%; display: block; pointer-events: none; }
.face-card.behind { transform: scale(.94) translateY(16px); opacity: .6; }
.face-card.behind2 { transform: scale(.88) translateY(30px); opacity: .28; }
.face-card.fly-right { transform: translate(120vw, -10vh) rotate(24deg) !important; opacity: 0; }
.face-card.fly-left { transform: translate(-120vw, -10vh) rotate(-24deg) !important; opacity: 0; }
.stamp {
  position: absolute; top: 24px; padding: 6px 14px; border: 3px solid; border-radius: 6px;
  font-family: var(--serif); font-weight: 700; font-size: 28px; line-height: 1.2; letter-spacing: .08em;
  opacity: 0; pointer-events: none; background: rgba(255,255,255,.28);
}
.stamp.like { left: 18px; color: var(--shu); border-color: var(--shu); transform: rotate(-12deg); }
.stamp.pass { right: 18px; color: #4B5468; border-color: #4B5468; transform: rotate(12deg); }
.face-card.liked .stamp.like { animation: stamp .46s var(--ease) forwards; }
@keyframes stamp {
  0%   { opacity: 0; transform: rotate(-12deg) scale(1.9); }
  45%  { opacity: 1; transform: rotate(-12deg) scale(.96); }
  62%  { transform: rotate(-12deg) scale(1.04); }
  100% { opacity: 1; transform: rotate(-12deg) scale(1); }
}
.tap-hint { font-size: 11px; letter-spacing: .14em; color: var(--muted); }
.actions { display: flex; align-items: center; gap: 30px; }
.btn-round {
  width: 60px; height: 60px; border-radius: 50%; border: 1.5px solid var(--kinari-dim); color: var(--kinari);
  display: grid; place-items: center; transition: transform .12s var(--ease), background .12s;
}
.btn-round svg { width: 26px; height: 26px; }
.btn-round:active { transform: scale(.92); }
.btn-round.like { width: 72px; height: 72px; background: var(--shu); border-color: var(--shu); box-shadow: 0 10px 24px rgba(200,65,43,.35); }
.btn-round.like svg { width: 32px; height: 32px; }
.deck-empty {
  position: absolute; inset: 0; border-radius: 10px; border: 1px dashed var(--indigo-line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px;
}
.deck-empty .serif { font-size: 20px; }
.turn-banner { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--kinari-dim); }
.turn-banner + .face-screen .deck { width: min(100%, calc((100dvh - 372px) * 0.75)); }
.turn-banner b { color: var(--kinari); font-family: var(--serif); font-size: 17px; font-weight: 600; }
.progress { display: flex; gap: 4px; }
.progress i { width: 6px; height: 6px; border-radius: 50%; background: var(--indigo-line); }
.progress i.done { background: var(--kinari-dim); }

/* ---------- favorites ---------- */
.fav-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fav { position: relative; aspect-ratio: 3/4; border-radius: 6px; overflow: hidden; box-shadow: 0 8px 18px rgba(0,0,0,.4); background: var(--paper); padding: 0; }
.fav svg { width: 100%; height: 100%; display: block; }
.fav .seal { position: absolute; right: 6px; bottom: 6px; width: 16px; height: 16px; border-radius: 3px; background: var(--shu); }
.fav .rm { position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; border-radius: 50%; background: rgba(20,28,48,.85); color: var(--kinari); display: grid; place-items: center; font-size: 14px; }
.empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; color: var(--kinari-dim);
}
.empty .serif { font-size: 20px; color: var(--kinari); }

/* ---------- TABLE ---------- */
.card { background: var(--indigo-raise); border: 1px solid var(--indigo-line); border-radius: 16px; padding: 16px; }
.card.action { display: flex; gap: 14px; align-items: center; text-align: left; width: 100%; }
.card.action .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--indigo-deep); display: grid; place-items: center; flex: none; }
.card.action .ico svg { width: 24px; height: 24px; }
.card.action h3 { font-family: var(--sans); font-weight: 600; font-size: 15px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--kinari); display: grid; place-items: center; font-size: 19px; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 14px; }
.avatar-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-pick button { width: 44px; height: 44px; border-radius: 50%; background: var(--indigo-deep); border: 1px solid var(--indigo-line); font-size: 22px; }
.avatar-pick button.on { background: var(--kinari); border-color: var(--kinari); }
.people { display: flex; flex-wrap: wrap; gap: 8px; }
.person { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--indigo-raise); border: 1px solid var(--indigo-line); font-size: 13px; }
.person.now { border-color: var(--kinari); }
.person.done { opacity: .55; }
.menu-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.menu-strip::-webkit-scrollbar { display: none; }
.menu-strip .thumb { flex: none; width: 54px; aspect-ratio: 3/4; border-radius: 4px; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,.35); }
.menu-strip .thumb svg { width: 100%; height: 100%; display: block; }
.code { font-family: var(--serif); font-size: 22px; letter-spacing: .3em; color: var(--kinari); }

.handoff { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; }
.handoff .avatar { width: 72px; height: 72px; font-size: 36px; }
.handoff h1 { font-size: 26px; }

.winner { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.winner .face-card { position: relative; width: min(220px, 60%); aspect-ratio: 3/4; }
.winner .face-card svg { pointer-events: auto; }
.reveal { background: var(--paper); color: var(--paper-ink); border-radius: 10px; padding: 16px 18px; width: 100%; text-align: left; }
.reveal .brand { font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1.3; }
.reveal .meta { color: var(--paper-sub); font-size: 13px; margin-top: 2px; }
.reveal .price { font-family: var(--serif); font-size: 18px; }
.reveal a { color: var(--paper-ink); font-size: 13px; }
.likers { display: flex; align-items: center; gap: 4px; }
.likers .avatar.sm { border: 2px solid var(--paper); margin-left: -8px; }
.likers .avatar.sm:first-child { margin-left: 0; }
.rank-list { display: flex; flex-direction: column; }
.rank-row { display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--indigo-line); }
.rank-row .thumb { width: 46px; aspect-ratio: 3/4; border-radius: 4px; overflow: hidden; }
.rank-row .thumb svg { width: 100%; height: 100%; display: block; }
.rank-row .name { font-family: var(--serif); font-size: 16px; }
.rank-row .sub { font-size: 12px; color: var(--muted); }
.rank-row .n { font-family: var(--serif); font-size: 20px; }
.rank-row.dim { opacity: .5; }
.rank-row.hidden-name .name { color: var(--kinari-dim); }
.order-card { background: var(--paper); color: var(--paper-ink); border-radius: 12px; padding: 22px 20px; }
.order-card h2 { font-size: 22px; }
.order-card .line { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0; border-bottom: 1px dashed var(--paper-line); }
.order-card .line .b { font-family: var(--serif); font-size: 20px; }
.order-card .line .g { font-size: 12px; color: var(--paper-sub); }
.order-card .foot { font-size: 12px; color: var(--paper-sub); margin-top: 12px; }

/* ---------- business (paper ledger) ---------- */
.subnav { display: flex; gap: 6px; margin-bottom: 14px; }
.subnav button { padding: 8px 14px; border-radius: 999px; font-size: 14px; color: var(--kinari-dim); border: 1px solid transparent; }
.subnav button.on { color: var(--kinari); border-color: var(--indigo-line); background: var(--indigo-raise); }
.paper-panel { background: var(--paper); color: var(--paper-ink); border-radius: 10px; padding: 16px; }
.paper-panel h2, .paper-panel h3 { color: var(--paper-ink); }
.paper-panel .muted, .paper-panel .note { color: var(--paper-sub); }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi { padding: 12px 14px; border: 1px solid var(--paper-line); border-radius: 8px; }
.kpi .v { font-family: var(--serif); font-size: 28px; line-height: 1.1; }
.kpi .l { font-size: 12px; color: var(--paper-sub); margin-top: 4px; }
.ledger { display: flex; flex-direction: column; }
.ledger-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--paper-line); }
.ledger-row:last-child { border-bottom: 0; }
.ledger-row .thumb { width: 40px; aspect-ratio: 3/4; border-radius: 3px; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.ledger-row .thumb svg, .ledger-row .thumb img { width: 100%; height: 100%; display: block; object-fit: cover; }
.ledger-row .name { font-family: var(--serif); font-size: 15px; line-height: 1.3; }
.ledger-row .sub { font-size: 12px; color: var(--paper-sub); }
.ledger-row .stat { text-align: right; font-size: 12px; color: var(--paper-sub); line-height: 1.4; }
.ledger-row .stat b { font-family: var(--serif); font-size: 17px; color: var(--paper-ink); font-weight: 600; display: block; }
.bar { height: 6px; background: var(--paper-2); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--indigo); }
.heat { display: grid; grid-template-columns: 68px repeat(7, 1fr); gap: 3px; font-size: 10px; }
.heat .h { color: var(--paper-sub); text-align: center; padding: 2px 0; }
.heat .r { color: var(--paper-sub); display: flex; align-items: center; }
.heat .c { aspect-ratio: 1; border-radius: 3px; display: grid; place-items: center; color: var(--kinari); font-size: 10px; }
.menu-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--indigo-line); }
.menu-row .thumb { width: 40px; aspect-ratio: 3/4; border-radius: 3px; overflow: hidden; }
.menu-row .thumb svg { width: 100%; height: 100%; display: block; }
.menu-row .name { font-family: var(--serif); font-size: 15px; }
.menu-row .sub { font-size: 12px; color: var(--muted); }

/* ---------- sheet / toast ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(8,12,24,.62); display: flex; align-items: flex-end; justify-content: center; }
.sheet-body {
  width: 100%; max-width: 480px; background: var(--indigo-raise); border-radius: 18px 18px 0 0;
  padding: 18px 20px calc(20px + var(--sab)); max-height: 90dvh; overflow: auto;
  animation: up .28s var(--ease);
}
@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-body h2 { margin-bottom: 12px; }
.upload {
  border: 1px dashed var(--indigo-line); border-radius: 12px; padding: 14px; display: flex; gap: 12px; align-items: center; cursor: pointer;
}
.upload .prev { width: 54px; aspect-ratio: 3/4; border-radius: 4px; background: var(--indigo-deep); overflow: hidden; flex: none; }
.upload .prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upload input { display: none; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--sab) + 18px); transform: translate(-50%, 12px);
  background: var(--kinari); color: var(--indigo); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 500;
  max-width: calc(100% - 40px); opacity: 0; pointer-events: none; z-index: 60; transition: opacity .2s, transform .2s var(--ease);
  box-shadow: 0 10px 24px rgba(0,0,0,.4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- settings ---------- */
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--indigo-line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .t { font-size: 15px; }
.setting-row .d { font-size: 12px; color: var(--muted); }

@media (min-width: 720px) {
  body { background-color: #111827; }
  .app { border-left: 1px solid var(--indigo-line); border-right: 1px solid var(--indigo-line); background-color: var(--indigo); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
