/* CYD de poche : coquille web des applis de la Cheap Yellow Display */
:root {
  --bg: #16171c;
  --bg2: #1d1f26;
  --panel: #23252e;
  --line: #333643;
  --text: #ecebe6;
  --muted: #a3a29b;
  --yellow: #f4c20d;
  --yellow-dk: #c99a00;
  --accent: #ff8fae;
  --radius: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 700px at 50% -10%, #2a2c36 0%, transparent 70%),
    radial-gradient(circle at 1px 1px, #ffffff0d 1px, transparent 1.2px) 0 0 / 22px 22px,
    var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }

/* ------------------------------------------------------------------ bandeau */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  height: 56px; padding: 0 max(16px, env(safe-area-inset-left));
  background: #16171ccc; backdrop-filter: blur(10px);
  border-bottom: 1px solid #ffffff10;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-chip { width: 22px; height: 30px; flex: none; }
.brand-name { font-weight: 800; letter-spacing: .02em; font-size: 18px; white-space: nowrap; }
.brand-name em { font-style: normal; font-weight: 500; color: var(--yellow); }
.back {
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px;
  padding: 4px 14px 4px 10px; cursor: pointer; font-weight: 600; font-size: 15px;
}
.back:hover { border-color: var(--yellow); }
.app-title { margin: 0; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-link { margin-left: auto; flex: none; color: var(--muted); font-size: 14px; text-decoration: none; border-bottom: 1px solid #ffffff22; }
.site-link:hover { color: var(--yellow); border-color: var(--yellow); }
.sl-short { display: none; }
@media (max-width: 520px) { .sl-long { display: none; } .sl-short { display: inline; } }

/* ------------------------------------------------------------------ accueil */
.home { max-width: 1100px; margin: 0 auto; padding: 40px 16px 64px; }
.hero { max-width: 720px; margin-bottom: 36px; }
.hero h2 { font-size: clamp(28px, 5vw, 44px); line-height: 1.1; margin: 0 0 14px; letter-spacing: -.02em; }
.hero p { color: var(--muted); margin: 0; font-size: 17px; }
.hero strong { color: var(--yellow); font-weight: 650; }
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px;
}
.card {
  display: flex; gap: 14px; align-items: flex-start; width: 100%; height: 100%;
  padding: 16px; border-radius: var(--radius); text-align: left; cursor: pointer;
  background: linear-gradient(180deg, #ffffff08, #ffffff02), var(--panel);
  border: 1px solid #ffffff12;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.card:hover, .card:focus-visible { transform: translateY(-2px); border-color: #f4c20d88; box-shadow: 0 10px 30px #0006; outline: none; }
.card img, .card .glyph {
  width: 76px; height: 76px; flex: none; border-radius: 22%;
  box-shadow: 0 6px 16px #0007, inset 0 0 0 1px #ffffff18;
}
.card .glyph { display: grid; place-items: center; font-weight: 800; font-size: 30px; }
.card > div { display: flex; flex-direction: column; min-height: 100%; }
.card h3 { margin: 2px 0 4px; font-size: 17px; line-height: 1.25; }
.card p {
  margin: 0; color: var(--muted); font-size: 14px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card .tags { margin-top: auto; padding-top: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 11.5px; font-weight: 650; padding: 1px 8px; border-radius: 999px; background: #ffffff10; color: #d8d6cc; }
.tag.l { background: #3b7dd833; color: #9cc3ff; }
.note { color: var(--muted); font-size: 14px; margin-top: 36px; max-width: 720px; }

/* ------------------------------------------------------------------ lecteur */
.player { display: flex; gap: 28px; align-items: flex-start; justify-content: center; padding: 20px 16px 40px; }
.player[hidden], .home[hidden] { display: none; }
.stage { position: relative; flex: none; display: grid; place-items: center; }
.board { position: relative; touch-action: none; }
.pcb { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#screen {
  position: absolute; display: block; image-rendering: pixelated; image-rendering: crisp-edges;
  touch-action: none; cursor: pointer; outline: none; background: #000;
}
.halo {
  position: absolute; inset: 8%; border-radius: 30%; filter: blur(40px);
  opacity: 0; transition: opacity .25s, background-color .25s; pointer-events: none;
}
.hw {
  position: absolute; border: 0; padding: 0; border-radius: 50%; cursor: pointer;
  background: transparent; -webkit-tap-highlight-color: transparent;
}
.hw:hover, .hw:focus-visible { box-shadow: 0 0 0 2px #fff8; outline: none; }
.hw:active { box-shadow: inset 0 0 0 40px #0005; }
.loading {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px;
  color: #fff; font-weight: 600; text-shadow: 0 1px 3px #000;
}
.loading[hidden] { display: none; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 4px solid #ffffff33; border-top-color: var(--yellow); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.side { width: 300px; flex: none; padding-top: 6px; }
.side h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 8px; }
.desc { margin: 0; font-size: 15.5px; color: #d9d7cf; }
.keys { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
.keys dt { font-weight: 650; color: var(--yellow); white-space: nowrap; }
.keys dd { margin: 0; color: #d9d7cf; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 0 5px; border-radius: 5px; text-align: center;
  font: 600 12.5px/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace;
  background: #2e313c; border: 1px solid #454958; border-bottom-width: 2px; color: #f1efe8;
}
.pad { font-size: 13.5px; color: var(--muted); margin: 14px 0 0; }
.pad.on { color: #9be3a5; }
.actions { display: flex; gap: 8px; margin-top: 22px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); border-radius: 10px;
  padding: 7px 14px; font-weight: 600; font-size: 14px;
}
.btn:hover { border-color: var(--yellow); }
.btn[hidden] { display: none; }
.btn.off { color: var(--muted); text-decoration: line-through; }
.hint { font-size: 13.5px; color: var(--muted); margin: 0 0 10px; }
.hint a { color: var(--yellow); }
.hint.rotate { color: #9cc3ff; margin-bottom: 14px; }
.hint[hidden] { display: none; }
.filelist { list-style: none; padding: 0; margin: 10px 0 0; font-size: 13.5px; max-height: 220px; overflow: auto; }
.filelist li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px solid #ffffff0c; }
.filelist button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 4px; }
.filelist button:hover { color: var(--accent); }
.fps { font: 12px ui-monospace, Consolas, monospace; color: #6f6e69; margin-top: 18px; }

/* plein ecran : la carte seule, centree */
.stage:fullscreen { background: radial-gradient(circle at 50% 40%, #262832, #0e0f12); width: 100vw; height: 100vh; }

@media (max-width: 900px) {
  .player { flex-direction: column; align-items: center; padding-top: 12px; gap: 12px; }
  .side { width: 100%; max-width: 480px; }
  .home { padding-top: 26px; }
  .hero p { font-size: 16px; }
}
@media (max-width: 599px) {
  .player { padding-left: 0; padding-right: 0; }
  .side { padding: 0 16px; }
}
@media (max-width: 520px) {
  .brand-name em { display: none; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .card img, .card .glyph { width: 64px; height: 64px; }
}
