/* 社畜度診断
   方向: 「社内の書類」。紙(クリーム)・こげ茶のインク・朱肉の赤。
   プレイ中だけは架空の社内チャットアプリ(紺のバー)になる。 */

:root {
  --paper: #FFF6E9;
  --paper-deep: #F3E4CC;
  --card: #FFFDF8;
  --ink: #3A2E2A;
  --ink-soft: #6E625B;
  --line: #E2D3BB;
  --stamp: #D23F27;
  --ok: #3F8A5B;
  --warn: #E2A33A;
  --chat-bar: #24415E;
  --chat-bg: #E9EDF1;
  --bubble-mine: #FFE29A;

  --font-body: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', sans-serif;
  --font-dot: 'DotGothic16', 'Osaka-Mono', monospace;

  --text-s: 0.8125rem;
  --text-m: 1rem;
  --text-l: 1.25rem;
  --text-hero: clamp(3.4rem, 2rem + 9vw, 5.2rem);

  --gap: 16px;
  --radius-s: 10px;
  --radius-l: 22px;
  --tap: 56px;
  --shadow-paper: 0 1px 0 var(--line), 0 10px 24px -14px rgb(58 46 42 / 0.45);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 320ms;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
/* はんこが押される動き(拡大)で横にはみ出しても、横スクロールが出ないようにする */
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--text-m);
  line-height: 1.7;
  color: var(--ink);
  word-break: auto-phrase;
  background-color: var(--paper);
  background-image: radial-gradient(rgb(58 46 42 / 0.05) 1px, transparent 1px);
  background-size: 6px 6px;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--stamp); outline-offset: 3px; }
[hidden] { display: none !important; }

#app { max-width: 480px; margin: 0 auto; padding: 0 var(--gap); }

/* ---------- ボタン ---------- */
.btn {
  display: flex; align-items: center; justify-content: center;
  min-height: var(--tap); width: 100%;
  padding: 12px 20px;
  border: 3px solid var(--ink); border-radius: 999px;
  font: inherit; font-weight: 900; font-size: var(--text-l);
  text-decoration: none; cursor: pointer;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn--start { background: var(--stamp); color: #fff; box-shadow: 0 5px 0 var(--ink); }
.btn--start:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.btn--x { background: var(--ink); color: #fff; box-shadow: 0 5px 0 #000; }
.btn--ghost { background: var(--card); color: var(--ink); font-size: var(--text-m); min-height: 48px; border-width: 2px; }

/* ---------- スタート画面 ---------- */
.start { padding: 20px 0 32px; display: grid; gap: 20px; }
.notice {
  justify-self: center; width: min(100%, 340px);
  padding: 10px 14px; border-radius: 16px;
  background: rgb(255 255 255 / 0.75); box-shadow: var(--shadow-paper);
  backdrop-filter: blur(6px);
  animation: drop 700ms var(--ease-out) both 200ms;
}
.notice__app { display: flex; justify-content: space-between; font-size: var(--text-s); color: var(--ink-soft); }
.notice__app span { font-family: var(--font-dot); }
.notice__text b { margin-right: 0.6em; }
@keyframes drop { from { opacity: 0; transform: translateY(-16px); } }

.start__title {
  position: relative;
  font-size: var(--text-hero); font-weight: 900; line-height: 1.02; letter-spacing: 0.02em;
  padding-top: 8px;
}
.start__kicker { display: block; font-size: var(--text-l); letter-spacing: 0.1em; color: var(--ink-soft); margin-bottom: 6px; }
.start__stamp {
  position: absolute; right: 4px; bottom: 6px;
  font-size: 1.15rem; letter-spacing: 0.1em; color: var(--stamp);
  border: 3px solid var(--stamp); border-radius: 8px; padding: 2px 10px;
  transform: rotate(-12deg); opacity: 0.9;
  animation: stamp 420ms var(--ease-out) both 600ms;
}
@keyframes stamp { from { opacity: 0; transform: rotate(-12deg) scale(2.2); } }
.start__lead { color: var(--ink-soft); }
.start__facts { display: flex; gap: 10px; }
.start__facts li {
  flex: 1; text-align: center; padding: 6px 0;
  border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
  font-size: var(--text-s);
}
.start__facts b { font-family: var(--font-dot); font-size: 1.6rem; font-weight: 400; margin: 0 2px; }
.lineup { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 4px; }
.lineup li { text-align: center; font-size: 0.6875rem; color: var(--ink-soft); }
.lineup img { width: 100%; }

/* ---------- チャット(プレイ中) ---------- */
body[data-screen='chat'] { background: var(--chat-bg); }
body[data-screen='chat'] .site-footer { display: none; }
/* チャットは画面の高さに固定し、メッセージ欄(.chat__log)だけをスクロールさせる。
   選択肢は下に並ぶ別の段なので、メッセージの上に重ならない。 */
.chat {
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; overflow: hidden;
  margin: 0 calc(var(--gap) * -1);
}
.chat__bar {
  flex: none;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px var(--gap); background: var(--chat-bar); color: #fff;
}
.chat__app { font-weight: 900; letter-spacing: 0.06em; }
.chat__progress { font-family: var(--font-dot); font-size: var(--text-s); opacity: 0.85; }
.chat__clock {
  flex: none;
  text-align: center; font-family: var(--font-dot); font-size: 1.5rem;
  padding: 4px 0; background: rgb(233 237 241 / 0.92); color: var(--chat-bar);
}
.chat__log {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 12px; padding: 12px var(--gap) 20px;
}
.msg { display: flex; gap: 8px; align-items: flex-start; animation: pop var(--dur) var(--ease-out) both; }
.msg--mine { justify-content: flex-end; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.avatar {
  flex: none; width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--avatar); color: #fff; font-weight: 900;
}
.msg__name { font-size: 0.75rem; color: var(--ink-soft); }
.bubble {
  max-width: 78vw; padding: 9px 13px;
  background: #fff; border-radius: 4px 16px 16px 16px;
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.08);
}
.bubble--mine { background: var(--bubble-mine); border-radius: 16px 4px 16px 16px; font-weight: 700; }
.typing { display: flex; gap: 4px; padding: 14px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-soft); animation: blink 900ms infinite; }
.typing i:nth-child(2) { animation-delay: 150ms; }
.typing i:nth-child(3) { animation-delay: 300ms; }
@keyframes blink { 50% { opacity: 0.25; transform: translateY(-2px); } }
.msg-day { text-align: center; font-size: var(--text-s); color: var(--ink-soft); }
.msg-day span { background: rgb(36 65 94 / 0.1); padding: 2px 12px; border-radius: 999px; }
.msg-system { text-align: center; font-size: var(--text-s); color: var(--ink-soft); padding: 8px 0; }

.chat__choices {
  flex: none;
  display: grid; gap: 10px;
  padding: 12px var(--gap) calc(16px + var(--safe-bottom));
  background: #fff; border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 24px -12px rgb(0 0 0 / 0.25);
}
.chat__choices.is-open { animation: slide-up var(--dur) var(--ease-out) both; }
@keyframes slide-up { from { transform: translateY(100%); } }
.chat__choices:empty { display: none; }
.chat__prompt { font-size: var(--text-s); color: var(--ink-soft); text-align: center; }
.choice {
  min-height: var(--tap); padding: 10px 16px;
  font: inherit; font-weight: 700; text-align: left;
  color: var(--ink); background: var(--paper);
  border: 2px solid var(--chat-bar); border-radius: 14px;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform 160ms var(--ease-out), background-color 160ms;
}
.choice:hover { background: var(--bubble-mine); }
.choice:active { transform: scale(0.98); }

/* ---------- 結果 ---------- */
.result { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; padding: 20px 0 40px; }
.visitor {
  display: grid; gap: 10px; padding: 14px; text-align: center;
  background: var(--card); border: 2px dashed var(--ink); border-radius: var(--radius-l);
  font-weight: 700;
}

.badge {
  position: relative; text-align: center;
  padding: 34px 20px 20px;
  background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius-l);
  box-shadow: 0 8px 0 var(--ink);
  animation: badge-in 600ms var(--ease-out) both;
}
@keyframes badge-in { from { opacity: 0; transform: translateY(-24px) rotate(-2deg); } }
.badge__hole {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: 56px; height: 10px; border-radius: 999px; background: var(--paper-deep); border: 2px solid var(--ink);
}
.badge__company {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin-bottom: 14px;
  font-size: var(--text-s); font-weight: 700;
}
.badge__company span { font-family: var(--font-dot); font-size: var(--text-m); letter-spacing: 0.2em; }
.badge__catch { font-weight: 700; color: var(--ink-soft); }
.badge__name {
  /* 文字数(--len)で割って、カードの幅に収まる大きさにする */
  font-size: min(3.4rem, calc((min(100vw, 480px) - 96px) / var(--len, 6)));
  white-space: nowrap; font-weight: 900; line-height: 1.1; }
.badge__name span { font-size: 0.55em; margin-left: 0.1em; }
.badge__photo {
  position: relative; margin: 16px auto 10px; width: min(78%, 280px); aspect-ratio: 1;
  background: color-mix(in srgb, var(--body) 22%, var(--card));
  border: 2px solid var(--ink); border-radius: 18px;
}
.badge__photo img { width: 100%; height: 100%; }
.stamp {
  position: absolute; right: -22px; bottom: -18px;
  width: 104px; height: 104px; border-radius: 50%;
  display: grid; place-content: center; line-height: 1;
  border: 4px solid var(--stamp); color: var(--stamp); background: rgb(255 253 248 / 0.82);
  font-family: var(--font-dot); font-size: 2rem;
  transform: rotate(-14deg);
  animation: stamp 420ms var(--ease-out) both 500ms;
}
.stamp small { font-family: var(--font-body); font-weight: 900; font-size: 0.8rem; margin-bottom: 4px; }
.badge__no { font-family: var(--font-dot); font-size: var(--text-s); color: var(--ink-soft); margin-top: 8px; }

.card { padding: 18px; background: var(--card); border-radius: var(--radius-s); box-shadow: var(--shadow-paper); }
.card h2 { font-size: var(--text-l); font-weight: 900; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }

.memo li { position: relative; padding: 8px 0 8px 1.6em; line-height: 1.6; font-weight: 700; border-bottom: 2px dashed var(--line); }
.memo li:last-child { border-bottom: 0; }
.memo li::before { content: '✓'; position: absolute; left: 0; top: 8px; color: var(--stamp); font-weight: 900; }

.meter__gauge { width: min(100%, 280px); margin: 0 auto 16px; }
.gauge { width: 100%; overflow: visible; }
.gauge__band { fill: none; stroke-width: 22; }
.gauge__band.is-low { stroke: var(--ok); }
.gauge__band.is-mid { stroke: var(--warn); }
.gauge__band.is-high { stroke: var(--stamp); }
.gauge__needle { transform-origin: 100px 100px; transform: rotate(-90deg); animation: needle 1.2s var(--ease-out) forwards 300ms; }
.gauge__needle path { stroke: var(--ink); stroke-width: 6; stroke-linecap: round; }
.gauge__needle circle { fill: var(--ink); }
@keyframes needle { to { transform: rotate(var(--deg)); } }
.meter__value { text-align: center; margin-top: 4px; font-family: var(--font-dot); font-size: 2.6rem; line-height: 1; }
.meter__value small { font-size: 1.2rem; }
.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: 5.5em 1fr 3em; align-items: center; gap: 8px; font-weight: 700; }
.bar__track { height: 14px; border-radius: 999px; background: var(--paper-deep); overflow: hidden; }
.bar__fill {
  display: block; height: 100%; background: var(--ink); border-radius: inherit;
  transform-origin: left; transform: scaleX(var(--v));
  animation: grow 900ms var(--ease-out) both 400ms;
}
@keyframes grow { from { transform: scaleX(0); } }
.bar__value { font-family: var(--font-dot); text-align: right; }

.mates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mate {
  display: grid; justify-items: center; gap: 2px; padding: 12px 8px; text-align: center;
  text-decoration: none; border: 2px solid var(--ink); border-radius: var(--radius-s); background: var(--paper);
  transition: transform var(--dur) var(--ease-out);
}
.mate:hover { transform: translateY(-3px) rotate(-1deg); }
.mate__label { font-weight: 900; font-size: var(--text-s); padding: 0 10px; border-radius: 999px; color: #fff; }
.mate--good .mate__label { background: var(--ok); }
.mate--bad .mate__label { background: var(--stamp); }
.mate__name { font-weight: 900; }
.mate__note { font-size: 0.75rem; color: var(--ink-soft); line-height: 1.5; }

.share { display: grid; gap: 10px; }
.share__status { font-size: var(--text-s); text-align: center; min-height: 1.5em; word-break: break-all; }

.affs { display: grid; gap: 12px; }
.affs__note { font-size: 0.75rem; color: var(--ink-soft); }
.tag-pr, .aff__pr {
  font-size: 0.6875rem; font-weight: 900; padding: 1px 8px; border-radius: 4px;
  border: 1.5px solid var(--ink-soft); color: var(--ink-soft);
}
.aff {
  position: relative; display: grid; gap: 4px; padding: 14px; text-decoration: none;
  border: 2px solid var(--ink); border-radius: var(--radius-s); background: var(--paper);
}
.aff__pr { position: absolute; top: 10px; right: 10px; }
.aff__kind { font-size: var(--text-s); color: var(--ink-soft); }
.aff__title { font-size: var(--text-l); }
.aff__text { font-size: var(--text-s); }
.aff__btn { margin-top: 6px; text-align: center; padding: 10px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 700; }
.aff__pixel { position: absolute; width: 1px; height: 1px; opacity: 0; }

.ad { margin-top: 24px; }
.ad__label { font-size: 0.6875rem; color: var(--ink-soft); margin-bottom: 4px; }
.slot-placeholder {
  display: grid; place-items: center; min-height: 100px; padding: 12px; text-align: center;
  border: 2px dashed var(--ink-soft); border-radius: var(--radius-s); color: var(--ink-soft); font-size: var(--text-s);
}

.error { padding: 24px var(--gap); text-align: center; font-weight: 700; }

.site-footer {
  max-width: 480px; margin: 0 auto; padding: 24px var(--gap) calc(32px + var(--safe-bottom));
  font-size: 0.75rem; color: var(--ink-soft); display: grid; gap: 4px; text-align: center;
}

/* 文書ページ(プライバシーポリシーなど) */
.doc { padding: 24px 0 40px; display: grid; gap: 16px; }
.doc h1 { font-size: 1.6rem; font-weight: 900; }
.doc h2 { font-size: var(--text-l); font-weight: 900; margin-top: 8px; }
.doc ul { list-style: disc; padding-left: 1.4em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
}
