*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }

body {
  display: grid;
  place-items: center;
  background: var(--leaf-deep);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-m);
  font-weight: 700;
  line-height: 1.5;
}

/* Khung màn hình: điện thoại phủ kín; màn dọc trên máy tính nằm trong khung 9:16. */
#app { position: relative; width: 100vw; height: 100vh; height: 100dvh; overflow: hidden; background: var(--paper); }

@media (min-aspect-ratio: 4/5) and (min-width: 600px) and (min-height: 600px) {
  #app[data-orientation='portrait'] {
    width: calc(100dvh * 9 / 16);
    box-shadow: 0 0 0 6px var(--kraft), 0 0 40px rgb(0 0 0 / 0.45);
  }
}

.screen {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: calc(var(--space-4) + var(--safe-top)) calc(var(--space-4) + var(--safe-right))
    calc(var(--space-4) + var(--safe-bottom)) calc(var(--space-4) + var(--safe-left));
}

h1 { font-family: var(--font-display); font-weight: 800; line-height: 1.2; text-wrap: balance; }
h1:focus { outline: none; }
img { display: block; user-select: none; }
ul { list-style: none; }

a, button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--keyword); outline-offset: 3px; border-radius: var(--radius); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.back { display: block; flex: none; width: 3.5rem; height: 3.5rem; border-radius: 50%; transition: transform 120ms ease-out; }
.back img { width: 100%; height: 100%; }
.back:active { transform: scale(0.93); }

.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3rem; padding: var(--space-2) var(--space-6);
  border-radius: var(--radius); background: var(--leaf); color: var(--paper-light);
  font-family: var(--font-display); font-size: var(--text-l); font-weight: 700;
  box-shadow: var(--lift); transition: transform 120ms ease-out;
}
.button:active { transform: translateY(2px); }

/* Màn con */
.page { display: flex; flex-direction: column; gap: var(--space-4); }

.topbar { display: flex; align-items: center; gap: var(--space-3); width: 100%; max-width: 32rem; margin-inline: auto; }
.topbar h1 { font-size: var(--text-xl); }

.sheet {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-4);
  width: 100%; max-width: 32rem; margin-inline: auto; padding: var(--space-6) var(--space-4);
  border-radius: var(--radius); background: var(--paper-light); box-shadow: var(--lift); text-align: center;
}
.sheet img { width: 8rem; height: 8rem; }
.sheet p { max-width: 22rem; text-wrap: pretty; }
.note { font-size: var(--text-s); color: var(--mushroom); }

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