/* Hyro Star Cards */
@font-face { font-family: "Lemon"; src: url("fonts/Lemon-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "PerfectlyNineties"; src: url("fonts/PerfectlyNineties-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "PerfectlyNineties"; src: url("fonts/PerfectlyNineties-Semibold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "PerfectlyNineties"; src: url("fonts/PerfectlyNineties-RegularItalic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --red: #FB0D1B;
  --cream: #FFF4EC;
  --black: #050404;
  --card-r: 20px;
  --accent: var(--red);
  --accent2: #FFC53D;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  font-family: "PerfectlyNineties", Georgia, serif;
  background: var(--cream);
  color: var(--black);
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
h1,h2,h3,.lemon { font-family: "Lemon", "PerfectlyNineties", serif; letter-spacing: 0; font-weight: 700; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ===== Gate ===== */
.gate[hidden] { display: none; }
#app[hidden] { display: none; }
.gate { position: fixed; inset: 0; background: var(--cream); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 24px; }
.gate-inner { width: 100%; max-width: 340px; text-align: center; }
.gate-logo { width: 110px; margin: 0 auto 18px; }
.gate-title { font-size: 44px; color: var(--black); line-height: 1; }
.gate-sub { margin: 10px 0 22px; font-size: 17px; opacity: .75; }
.gate input { width: 100%; padding: 15px 18px; font-size: 18px; border: 2px solid var(--black); border-radius: 14px; background: #fff; font-family: inherit; text-align: center; }
.gate input:focus { outline: 3px solid var(--red); outline-offset: 2px; }
.gate button { width: 100%; margin-top: 12px; padding: 15px 18px; font-size: 17px; border: none; border-radius: 14px; background: var(--red); color: #fff; font-family: "Lemon", serif; }
.gate button:active { transform: scale(.98); }
.gate-error { margin-top: 14px; color: var(--red); font-weight: 600; }

/* ===== Chrome ===== */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 18px 10px; background: rgba(255,244,236,.92); backdrop-filter: blur(10px); border-bottom: 1.5px solid rgba(5,4,4,.08); }
.topbar-logo { height: 22px; }
.topbar-title { font-family: "Lemon", serif; font-size: 18px; letter-spacing: 0; }
.view { padding: 18px 16px calc(86px + env(safe-area-inset-bottom)); max-width: 1100px; margin: 0 auto; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; justify-content: space-around; background: rgba(255,255,255,.95); backdrop-filter: blur(12px); border-top: 1.5px solid rgba(5,4,4,.08); padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; opacity: .55; min-width: 56px; padding: 4px 6px; border-radius: 10px; }
.tabbar a.active { opacity: 1; color: var(--red); }
.tab-ico { font-size: 19px; line-height: 1; font-style: normal; }

/* ===== Deck ===== */
.deck-hero { text-align: center; margin: 8px 0 20px; }
.deck-hero h1 { font-size: 34px; color: var(--red); }
.deck-hero p { margin-top: 6px; font-size: 15px; opacity: .7; font-style: italic; }
.deck-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.deck-grid > * { min-width: 0; }
@media (min-width: 700px) { .deck-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; } }
@media (min-width: 1040px) { .deck-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ===== Card ===== */
.card-wrap { perspective: 1200px; }
.card { position: relative; width: 100%; min-width: 0; aspect-ratio: 0.68; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.2,.7,.3,1); cursor: pointer; }
.card.flipped { transform: rotateY(180deg); }
.card-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: var(--card-r); overflow: hidden; box-shadow: 0 10px 28px rgba(5,4,4,.16); }
.card-front { background: linear-gradient(160deg, var(--accent) 0%, var(--accent2) 120%); color: #fff; display: flex; flex-direction: column; }
.card-back { transform: rotateY(180deg); background: #fff; color: var(--black); display: flex; flex-direction: column; }

.cf-top { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 6px; font-family: "Lemon", serif; font-size: 11px; }
.cf-no { background: rgba(5,4,4,.3); border-radius: 999px; padding: 3px 8px; }
.cf-glyph { font-size: 16px; font-family: "PerfectlyNineties", serif; }
.cf-photo { position: relative; margin: 0 12px; border-radius: 14px; overflow: hidden; flex: 1 1 auto; min-height: 0; background: rgba(255,255,255,.25); border: 2px solid rgba(255,255,255,.65); }
.cf-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.cf-initials { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-family: "Lemon", serif; font-size: clamp(30px, 10vw, 52px); color: #fff; text-shadow: 0 2px 10px rgba(5,4,4,.25); background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.35), transparent 60%); }
.cf-holo { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: color-dodge; background: linear-gradient(115deg, transparent 20%, rgba(255,255,255,.55) 36%, rgba(130,255,213,.35) 46%, rgba(255,120,220,.35) 54%, rgba(255,255,255,.5) 64%, transparent 80%); background-size: 260% 260%; background-position: var(--holo-x, 50%) var(--holo-y, 50%); opacity: .75; transition: background-position .15s linear; }
.cf-name { padding: 9px 12px 0; font-family: "Lemon", serif; font-size: clamp(13px, 3.9vw, 18px); line-height: 1.05; text-shadow: 0 1px 6px rgba(5,4,4,.25); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
@media (min-width: 700px) { .cf-name { font-size: 18px; } }
.cf-nick { padding: 2px 12px 0; font-style: italic; font-size: 12px; opacity: .95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.cf-role { padding: 3px 12px 0; font-size: 10px; line-height: 1.25; opacity: .85; text-transform: uppercase; letter-spacing: .05em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; flex-shrink: 0; min-height: 25px; }
.cf-bottom { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; padding: 8px 12px 11px; font-size: 11px; font-family: "Lemon", serif; }
.cf-rarity { background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.5); border-radius: 999px; padding: 3px 9px; }
.cf-bday { opacity: .95; font-family: "PerfectlyNineties", serif; font-weight: 600; }

.cb-head { padding: 12px 14px 8px; border-bottom: 1.5px solid rgba(5,4,4,.08); }
.cb-head .lemon { font-size: 15px; color: var(--accent); }
.cb-sign { font-size: 12px; opacity: .7; margin-top: 2px; }
.cb-stats { padding: 10px 14px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.stat { display: grid; grid-template-columns: 86px 1fr 26px; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; }
.stat-track { height: 8px; border-radius: 999px; background: rgba(5,4,4,.08); overflow: hidden; }
.stat-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent2)); width: 0; transition: width .8s cubic-bezier(.2,.7,.3,1); }
.stat-num { text-align: right; font-variant-numeric: tabular-nums; }
.cb-cta { margin: 0 14px 14px; padding: 12px; text-align: center; background: var(--accent); color: #fff; font-family: "Lemon", serif; font-size: 13px; border-radius: 12px; }

/* ===== Profile ===== */
.profile { max-width: 680px; margin: 0 auto; }
.p-back { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 15px; margin-bottom: 14px; color: var(--red); background: none; border: none; padding: 8px 10px 8px 0; }
.p-hero { border-radius: 24px; overflow: hidden; background: linear-gradient(160deg, var(--accent), var(--accent2) 130%); color: #fff; padding: 22px 20px; position: relative; }
.p-hero-row { display: flex; gap: 16px; align-items: center; }
.p-photo { width: 92px; height: 92px; border-radius: 18px; overflow: hidden; border: 2.5px solid rgba(255,255,255,.7); flex-shrink: 0; background: rgba(255,255,255,.25); }
.p-photo img { width: 100%; height: 100%; object-fit: cover; }
.p-photo .cf-initials { font-size: 34px; }
.p-hero h1 { font-size: clamp(22px, 6vw, 30px); line-height: 1.02; }
.p-nick { font-style: italic; font-size: 15px; margin-top: 4px; opacity: .95; }
.p-role { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; margin-top: 6px; opacity: .9; }
.p-badges { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.badge { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.45); backdrop-filter: blur(4px); padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.p-tabs { display: flex; gap: 8px; margin: 18px 0 14px; }
.p-tab { flex: 1; padding: 11px; border-radius: 12px; border: 2px solid var(--black); background: #fff; font-family: "Lemon", serif; font-size: 13px; }
.p-tab.active { background: var(--black); color: #fff; }
.p-section { background: #fff; border-radius: 18px; padding: 18px; margin-bottom: 14px; box-shadow: 0 4px 16px rgba(5,4,4,.07); }
.p-section h2 { font-size: 17px; color: var(--accent); margin-bottom: 10px; }
.p-section p { font-size: 15.5px; line-height: 1.55; margin-bottom: 10px; }
.p-section p:last-child { margin-bottom: 0; }
.p-section ul { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.p-section li { font-size: 15px; line-height: 1.45; padding-left: 24px; position: relative; }
.p-section li::before { content: "\2605"; position: absolute; left: 0; color: var(--accent); font-size: 13px; top: 2px; }
.p-cusp { background: #fff8f0; border: 1.5px dashed var(--accent); border-radius: 14px; padding: 12px 14px; font-size: 14px; font-style: italic; margin-bottom: 14px; }
.fun-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-bottom: 1px solid rgba(5,4,4,.07); }
.fun-item:last-child { border-bottom: none; }
.fun-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; color: var(--accent); }
.fun-text { font-size: 15px; line-height: 1.45; }
.compat-row { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.compat-chip { display: flex; align-items: center; gap: 8px; background: var(--cream); border-radius: 999px; padding: 6px 12px 6px 6px; font-size: 13.5px; font-weight: 600; }
.compat-chip .mini { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-family: "Lemon", serif; }
.compat-chip .mini img { width: 100%; height: 100%; object-fit: cover; }
.p-motto { text-align: center; font-style: italic; font-size: 17px; padding: 18px 10px 6px; }
.p-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.p-nav button { flex: 1; padding: 13px; border-radius: 12px; border: 2px solid var(--black); background: #fff; font-family: "Lemon", serif; font-size: 13px; }

/* ===== Chemistry ===== */
.chem h1, .bd h1, .match h1, .about h1 { font-size: 28px; color: var(--red); margin-bottom: 6px; }
.chem .sub, .bd .sub, .match .sub, .about .sub { font-size: 14.5px; opacity: .7; margin-bottom: 18px; font-style: italic; }
.elem-bars { display: flex; flex-direction: column; gap: 10px; }
.elem-row { display: grid; grid-template-columns: 70px 1fr 34px; gap: 10px; align-items: center; font-weight: 600; font-size: 14px; }
.elem-track { height: 14px; border-radius: 999px; background: rgba(5,4,4,.07); overflow: hidden; }
.elem-fill { height: 100%; border-radius: 999px; }
.matrix-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
.matrix { border-collapse: collapse; min-width: 560px; }
.matrix th, .matrix td { padding: 6px; text-align: center; font-size: 12px; }
.matrix th .mini, .matrix td .mini { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; margin: 0 auto; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-family: "Lemon", serif; font-size: 12px; }
.matrix .mini img { width: 100%; height: 100%; object-fit: cover; }
.chem-cell { width: 40px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; margin: 0 auto; font-size: 12.5px; }
.pair-card { background: #fff; border-radius: 16px; padding: 14px 16px; margin-bottom: 10px; box-shadow: 0 3px 12px rgba(5,4,4,.06); }
.pair-names { font-family: "Lemon", serif; font-size: 14px; }
.pair-note { font-size: 14px; margin-top: 4px; opacity: .85; }
.stars { color: var(--red); letter-spacing: 2px; font-size: 13px; }

/* ===== Birthdays ===== */
.bd-item { display: flex; align-items: center; gap: 14px; background: #fff; border-radius: 16px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 3px 12px rgba(5,4,4,.06); }
.bd-item .mini { width: 46px; height: 46px; border-radius: 12px; overflow: hidden; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-family: "Lemon", serif; flex-shrink: 0; }
.bd-item .mini img { width: 100%; height: 100%; object-fit: cover; }
.bd-name { font-weight: 600; font-size: 15.5px; }
.bd-date { font-size: 13px; opacity: .7; }
.bd-days { margin-left: auto; text-align: right; font-family: "Lemon", serif; font-size: 13px; color: var(--red); white-space: nowrap; }
.bd-next { outline: 2.5px solid var(--red); outline-offset: -2.5px; }
.bd-next .bd-days::after { content: " 🎉"; }

/* ===== Match ===== */
.match-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.match-pick button { display: flex; flex-direction: column; align-items: center; gap: 6px; background: #fff; border: 2px solid transparent; border-radius: 14px; padding: 10px 4px; font-size: 11.5px; font-weight: 600; }
.match-pick button.sel { border-color: var(--red); }
.match-pick .mini { width: 48px; height: 48px; border-radius: 50%; overflow: hidden; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-family: "Lemon", serif; }
.match-pick .mini img { width: 100%; height: 100%; object-fit: cover; }
.match-result { background: #fff; border-radius: 18px; padding: 20px; text-align: center; box-shadow: 0 4px 16px rgba(5,4,4,.07); }
.match-result h2 { color: var(--red); font-size: 19px; margin-bottom: 6px; }
.match-faces { display: flex; justify-content: center; gap: 14px; align-items: center; margin: 14px 0; }
.match-faces .mini { width: 72px; height: 72px; border-radius: 50%; overflow: hidden; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-family: "Lemon", serif; font-size: 22px; }
.match-faces .mini img { width: 100%; height: 100%; object-fit: cover; }
.match-heart { font-size: 26px; }

/* ===== About ===== */
.about .p-section p { font-size: 15px; }

/* ===== Desktop polish ===== */
@media (min-width: 900px) {
  .view { padding-top: 28px; }
  .deck-hero h1 { font-size: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .cf-holo { display: none; }
}
