@font-face {
  font-family: "Yozai";
  src: url("assets/fonts/Yozai-Light.ttf") format("truetype");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans SC";
  src: url("assets/fonts/NotoSansSC-Light.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #222222;
  --muted: #9b9b9b;
  --line: #cfcfcf;
  --paper: #fffdf7;
  --paper-deep: #fff8e8;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { min-width: 320px; min-height: 100%; margin: 0; background: var(--paper); }
button, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.app {
  width: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 6%, rgba(255,255,255,.88), transparent 31%),
    var(--paper);
}

.screen {
  position: relative;
  width: min(100%, 430px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 24px max(26px, env(safe-area-inset-bottom));
}

.personality-text { margin: 0; font-family: "Yozai", cursive; font-weight: 400; color: var(--ink); }
.ui-text, input, button { font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif; font-weight: 300; color: var(--muted); }

.home-screen { display: flex; flex-direction: column; align-items: center; padding-top: clamp(34px, 7vh, 68px); }
.home-mascot { display: block; width: min(78vw, 320px); height: auto; object-fit: contain; margin: 0 auto clamp(10px, 3vh, 24px); }
.home-question { width: min(100%, 342px); font-size: clamp(26px, 7vw, 31px); line-height: 1.27; text-align: left; letter-spacing: .02em; }

.home-form { display: flex; width: min(100%, 344px); align-items: center; gap: 8px; margin-top: 26px; }
.keyword-field { display: flex; align-items: center; flex: 1; min-width: 0; height: 47px; border: 1px solid var(--line); border-radius: 999px; padding: 0 16px; background: rgba(255,255,255,.2); }
.keyword-field input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; letter-spacing: .04em; }
.keyword-field input::placeholder { color: var(--muted); opacity: .82; }
.mini-action { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); padding: 0 10px; height: 38px; font-size: 13px; white-space: nowrap; }
.mini-action.is-hidden { display: none; }

.outline-button { border: 1px solid var(--line); border-radius: 999px; background: var(--paper); min-height: 44px; padding: 8px 18px; font-size: 15px; line-height: 1.35; }
.outline-button:active, .mini-action:active, .new-keyword:active { transform: scale(.98); }
.random-home { width: min(100%, 260px); margin-top: 27px; background: #fff9e9; }

.result-screen { padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: 30px; }
.result-chrome { display: flex; align-items: center; justify-content: space-between; height: 30px; }
.result-chrome span { font-size: 16px; }
.page-close { width: 34px; height: 34px; margin: -4px -8px 0 0; padding: 0; border: 0; background: transparent; color: #d9d9d9; font-family: Arial, sans-serif; font-size: 30px; font-weight: 200; line-height: 1; }
.keyword-map { position: relative; width: min(100%, 350px); height: 223px; margin: 4px auto 0; font-size: 25px; line-height: 1; letter-spacing: .03em; }
.keyword-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.keyword-lines path { fill: none; stroke: #d9dfe8; stroke-width: 1.3; }
.keyword-lines .map-circle-svg { fill: none; stroke: #d9dfe8; stroke-width: 1.3; stroke-dasharray: 6 4; }
.keyword-lines .map-triangle-svg, .keyword-lines .map-drop-svg { fill: none; stroke: #d9dfe8; stroke-width: 1.3; }
.map-label, .map-node { position: absolute; z-index: 1; display: block; }
.map-label { top: 49px; left: 1px; font-size: 20px; }
.map-node b { position: relative; z-index: 2; display: block; font: inherit; font-weight: 300; white-space: nowrap; }
.map-input { top: 29px; left: 48%; transform: translateX(-50%); }
.map-mood { top: 112px; left: 29%; transform: translateX(-50%); }
.map-object { top: 166px; left: 81.2%; transform: translateX(-50%); text-align: center; }
.map-object.is-long b { font-size: 18px; }
.result-question { width: min(100%, 340px); margin: -1px auto 14px; font-size: clamp(24px, 6.8vw, 29px); line-height: 1.25; text-align: center; letter-spacing: .02em; }

.video-card { display: block; color: inherit; text-decoration: none; }
.diffusion-video-card { width: min(43vw, 156px); margin: 0 auto; }
.random-video-card { width: min(65vw, 238px); margin: 8px auto 0; }
.cover-wrap { position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 2px; background: rgba(255,255,255,.55); }
.cover-wrap img { width: 100%; height: 100%; display: block; object-fit: cover; }
.video-card p { min-height: 41px; margin: 9px 4px 16px; font-size: 14px; line-height: 1.46; letter-spacing: .02em; }
.diffusion-video-card .cover-wrap, .random-video-card .cover-wrap { aspect-ratio: 1; }
.diffusion-video-card p { width: min(78vw, 282px); margin: 8px 50% 14px; transform: translateX(-50%); }

.result-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; width: min(100%, 360px); margin: 0 auto; }
.result-actions .outline-button { min-height: 58px; padding: 6px 5px; border-radius: 16px; font-size: 13px; }
.toast { margin: 9px auto 0; font-size: 13px; text-align: center; }
.random-result-screen { padding-top: max(18px, env(safe-area-inset-top)); }
.random-result-screen .result-question { margin-top: 44px; margin-bottom: 10px; }
.random-actions { grid-template-columns: repeat(2, 1fr); width: min(64vw, 238px); margin-top: 2px; }
.random-actions .outline-button { min-height: 58px; }

.modal-mask { position: fixed; z-index: 5; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(255,249,233,.34); backdrop-filter: blur(1.5px); }
.keyword-modal { position: relative; width: min(100%, 330px); padding: 41px 25px 27px; border-radius: 30px; background: var(--paper-deep); box-shadow: 0 8px 24px rgba(84,72,51,.10); }
.keyword-modal h2 { margin: 0 0 20px; font-size: 18px; text-align: center; letter-spacing: .04em; }
.modal-close { position: absolute; top: 13px; right: 17px; width: 30px; height: 30px; border: 0; background: transparent; font-size: 29px; line-height: 1; }
.modal-field { width: 100%; }
.modal-submit { display: block; margin: 14px auto 0; min-width: 118px; }

@media (max-height: 690px) {
  .home-screen { padding-top: 24px; }
  .home-mascot { width: min(61vw, 270px); margin-bottom: 7px; }
  .home-question { font-size: 25px; }
  .home-form { margin-top: 17px; }
  .keyword-map { height: 168px; }
  .result-question { margin-bottom: 8px; }
  .cover-wrap { aspect-ratio: 1.55; }
  .diffusion-video-card .cover-wrap, .random-video-card .cover-wrap { aspect-ratio: 1; }
  .video-card p { margin-bottom: 8px; min-height: auto; }
}
