/* Mô phỏng 3D "Bên trong một nốt mụn" – trang toàn màn hình (sim-not-mun.php). Luôn nền tối. */
:root { --ink: #f6ece2; --ink2: rgba(246, 236, 226, .7); --accent: #ff8a6b; --glass: rgba(20, 6, 8, .5); --line: rgba(246, 236, 226, .16); color-scheme: dark; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #120405; }
body { color: var(--ink); font-family: 'Be Vietnam Pro', system-ui, sans-serif; font-weight: 400; overflow: hidden; -webkit-font-smoothing: antialiased; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
a { color: inherit; }
[hidden] { display: none !important; }

.ui { position: fixed; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 20px calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(18, 4, 5, .86) 0%, rgba(18, 4, 5, .4) 36%, transparent 58%), linear-gradient(to bottom, rgba(18, 4, 5, .55), transparent 18%); }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.brand { pointer-events: auto; display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 36px; height: 36px; border-radius: 50%; background: #fff; flex: none; }
.brand b { display: block; font-weight: 600; font-size: clamp(17px, 2.2vw, 24px); letter-spacing: -.01em; line-height: 1.2; }
.brand small { display: block; color: var(--ink2); font-size: 12.5px; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.btn { pointer-events: auto; display: inline-flex; align-items: center; justify-content: center; min-height: 40px; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 500; padding: 9px 16px; border-radius: 999px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: rgba(246, 236, 226, .4); }
.btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #2a0b06; }
.btn--accent { background: #E99931; border-color: #E99931; color: #1C2430; font-weight: 600; }
.btn--accent:hover { background: #f2a845; border-color: #f2a845; }
.btn:focus-visible, .card:focus-visible, .mode:focus-visible, .opt:focus-visible, .tx:focus-visible, .link:focus-visible, .brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.link { pointer-events: auto; background: none; border: 0; color: var(--ink); font: inherit; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px 4px; }

.bottom { display: flex; flex-direction: column; gap: 12px; }
.cap { max-width: 580px; transition: opacity .6s, transform .6s; }
.cap.hide { opacity: 0; transform: translateY(10px); }
.cap small { display: block; color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 4px; }
.cap h1 { font-weight: 600; font-size: clamp(22px, 3vw, 34px); letter-spacing: -.02em; line-height: 1.15; text-shadow: 0 2px 20px rgba(0, 0, 0, .6); }
.cap p { font-size: 15px; line-height: 1.6; margin-top: 8px; text-shadow: 0 1px 12px rgba(0, 0, 0, .7); }

.panel { pointer-events: auto; max-width: 560px; padding: 18px 20px; border-radius: 16px; background: rgba(20, 6, 8, .72); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); display: flex; flex-direction: column; gap: 10px; }
.panel h2 { font-size: clamp(20px, 2.4vw, 26px); font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
.panel p { font-size: 15px; line-height: 1.55; }
.panel .lvl { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; display: inline-flex; align-self: flex-start; padding: 4px 10px; border-radius: 999px; }
.lvl--1 { background: rgba(140, 200, 120, .18); color: #b9e3a8; }
.lvl--2 { background: rgba(233, 153, 49, .2); color: #f5c27c; }
.lvl--3 { background: rgba(255, 110, 90, .22); color: #ffab9b; }
.panel .todo { color: var(--ink); padding-left: 12px; border-left: 3px solid var(--accent); }
.panel .fine { font-size: 12px; color: var(--ink2); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row--center { justify-content: center; }
.txs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tx { text-align: left; padding: 10px 30px 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .05); color: var(--ink); font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 2px; position: relative; }
.tx b { font-size: 14px; font-weight: 600; }
.tx small { font-size: 12px; color: var(--ink2); }
.tx:hover { background: rgba(255, 255, 255, .1); }
.tx[aria-pressed="true"] { border-color: #6fd6ff; background: rgba(111, 214, 255, .14); }
.tx[aria-pressed="true"]::after { content: "✓"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #6fd6ff; font-weight: 700; }

.chain { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink2); min-height: 18px; }
.chain i { width: 8px; height: 8px; border-radius: 50%; background: rgba(246, 236, 226, .2); transition: background .4s; }
.chain i.on { background: var(--accent); }
.modes { pointer-events: auto; display: inline-flex; align-self: flex-start; gap: 4px; padding: 4px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.modes::-webkit-scrollbar { display: none; }
.mode { flex: none; border: 0; background: none; color: var(--ink2); font: inherit; font-size: 13.5px; font-weight: 500; padding: 8px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.mode:hover { color: var(--ink); }
.mode .s { display: none; }
.mode[aria-pressed="true"] { background: var(--ink); color: #2a0b06; }
.cards { display: flex; gap: 8px; overflow-x: auto; pointer-events: auto; padding-bottom: 2px; scrollbar-width: none; }
.cards::-webkit-scrollbar { display: none; }
.card { flex: 0 0 auto; min-width: 146px; text-align: left; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); color: var(--ink); font: inherit; padding: 10px 14px; border-radius: 12px; cursor: pointer; position: relative; overflow: hidden; }
.card small { display: block; color: var(--ink2); font-size: 11.5px; }
.card b { display: block; font-weight: 500; font-size: 14px; margin-top: 2px; }
.card.past { box-shadow: inset 3px 0 0 rgba(255, 138, 107, .55); }
.card.on { border-color: var(--accent); background: rgba(255, 138, 107, .16); }
.card .prog { position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: var(--accent); }
.hint { color: var(--ink2); font-size: 12px; }
body.m-stage .cards, body.m-chain .cards, body.m-stage .cap, body.m-chain .cap, body.m-stage .chain { display: none; }

.lbls { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.lbl { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 8px; opacity: 0; will-change: transform; }
.lbl i { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px rgba(255, 138, 107, .45), 0 0 14px rgba(255, 255, 255, .5); flex: 0 0 auto; margin-left: -4.5px; }
.lbl s { display: block; width: 26px; height: 1px; background: rgba(246, 236, 226, .7); text-decoration: none; }
.lbl span { background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid var(--line); font-size: 12.5px; font-weight: 500; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }

.sheet { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(10, 2, 3, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet__box { position: relative; width: min(640px, 100%); max-height: calc(100% - 20px); overflow: auto; padding: 26px 24px 20px; border-radius: 20px; background: #24100e; border: 1px solid var(--line); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7); display: flex; flex-direction: column; gap: 12px; }
.sheet__box--center { text-align: center; align-items: center; }
.sheet__box h2 { font-size: clamp(22px, 3vw, 28px); font-weight: 600; line-height: 1.2; padding-right: 28px; }
.sheet__box--center h2 { padding: 0 28px; }
.sheet__x { position: absolute; right: 12px; top: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .08); color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer; }
.muted { color: var(--ink2); font-size: 14.5px; line-height: 1.55; }
.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }
.opt { display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--ink); font: inherit; cursor: pointer; }
.opt svg { grid-row: 1 / span 2; width: 56px; height: 56px; }
.opt b { font-size: 15.5px; font-weight: 600; align-self: end; }
.opt small { font-size: 13px; color: var(--ink2); align-self: start; }
.opt:hover { border-color: var(--accent); background: rgba(255, 138, 107, .1); }
.ec-logo { width: 64px; height: 64px; border-radius: 50%; background: #fff; }

.fallback { position: fixed; inset: 0; z-index: 20; overflow: auto; background: #120405; display: grid; place-items: center; padding: 20px; }
.fallback__box { width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px; text-align: center; }
.fallback__title { font-size: 15px; line-height: 1.55; }
.fallback video { width: 100%; height: auto; aspect-ratio: 9 / 16; border-radius: 16px; background: #000; }
.toast { position: fixed; z-index: 15; left: 50%; top: calc(70px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); display: flex; gap: 10px; align-items: center; padding: 8px 8px 8px 16px; border-radius: 999px; background: rgba(20, 6, 8, .9); border: 1px solid var(--line); font-size: 13.5px; white-space: nowrap; }
.toast a { color: var(--accent); font-weight: 600; }
.toast button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .08); color: var(--ink); cursor: pointer; }

@media (max-width: 600px) {
  .ui { padding-left: 16px; padding-right: 16px; }
  .brand small { display: none; }
  .tools .btn { padding: 8px 12px; font-size: 12.5px; min-height: 36px; }
  .cap p { font-size: 13.5px; }
  .card { min-width: 124px; padding: 9px 12px; }
  .panel { padding: 14px 16px; }
  .panel p { font-size: 14px; }
  .txs { grid-template-columns: 1fr; }
  .modes { align-self: stretch; }
  .mode { flex: 1 1 0; padding: 8px 6px; font-size: 13px; }
  .mode .l { display: none; }
  .mode .s { display: inline; }
  .tx { flex-direction: row; justify-content: space-between; align-items: baseline; }
  .opts { grid-template-columns: 1fr; }
  .sheet { align-items: end; padding: 0; }
  .sheet__box { border-radius: 20px 20px 0 0; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) { .cap { transition: none; } }
