@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
  color-scheme: dark;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  color: #f4f4f0;
  background: #080909;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  --ink: #f4f4f0;
  --lime: #c7ff32;
  --void: #080909;
  --frame-gap: clamp(10px, 1.9vw, 28px);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--void);
}

button {
  font: inherit;
}

.landing {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: var(--frame-gap) var(--frame-gap) 0;
}

.home-frame {
  flex: 1;
  min-height: 540px;
  position: relative;
  display: grid;
  place-items: center;
  border: clamp(3px, .35vw, 6px) solid var(--ink);
  box-shadow: 0 10px 0 #353535;
}

.home-content {
  width: min(100% - 28px, 1500px);
  display: flex;
  align-items: center;
  flex-direction: column;
  text-align: center;
  padding: 38px 0 54px;
}

.pixel-mark {
  width: clamp(88px, 17vw, 220px);
  height: clamp(88px, 17vw, 220px);
  display: grid;
  place-items: center;
  margin-bottom: clamp(26px, 4vw, 56px);
  border: clamp(5px, .65vw, 10px) solid var(--ink);
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.pixel-mark svg {
  display: block;
  width: 42%;
  height: 42%;
  fill: var(--lime);
  filter: drop-shadow(5px 5px 0 #769b1e);
}

.pixel-mark.unlocked svg { fill: var(--ink); filter: drop-shadow(5px 5px 0 #777); }
.pixel-mark:focus-visible { outline: 2px dashed var(--lime); outline-offset: 7px; }

h1 {
  max-width: 100%;
  margin: 0;
  color: var(--ink);
  font-size: clamp(27px, 6.1vw, 154px);
  line-height: 1.3;
  letter-spacing: -.09em;
  white-space: nowrap;
  text-shadow: 5px 5px 0 #333;
}

.tagline {
  max-width: 820px;
  margin: clamp(30px, 4vw, 65px) 0 clamp(36px, 4vw, 65px);
  color: var(--ink);
  font-size: clamp(9px, 1.12vw, 17px);
  line-height: 2.3;
  letter-spacing: .04em;
}

.heart-dialogue { min-height: 20px; margin: -24px 0 20px; color: var(--lime); font-size: 9px; }
.currently { max-width: 560px; margin: 20px 0 0; color: #c5c5bf; font-size: clamp(8px, .9vw, 11px); line-height: 2; }

.cta {
  min-height: 72px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 17px;
  padding: 18px 27px;
  border: 5px solid var(--lime);
  background: transparent;
  color: var(--lime);
  font-size: clamp(10px, 1.2vw, 16px);
  cursor: pointer;
  transition: color .12s steps(2), background-color .12s steps(2), transform .12s steps(2);
}

.cta:hover,
.cta:focus-visible {
  color: var(--void);
  background: var(--lime);
  outline: none;
}

.cta:active {
  transform: translate(3px, 3px);
}

.cta-arrow {
  font-family: Arial, sans-serif;
  font-size: .8em;
}

.footer {
  flex: 0 0 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: #d8d8d4;
  font-size: clamp(9px, 1vw, 15px);
  text-align: center;
}

.contact-line { color: #969691; }

/* Journal de sauvegarde */
.journal-page {
  min-height: 100svh;
  padding: var(--frame-gap);
}

.journal-frame {
  width: min(100%, 1120px);
  min-height: calc(100svh - 2 * var(--frame-gap));
  margin: 0 auto;
  padding: clamp(22px, 4.4vw, 54px);
  border: clamp(2px, .3vw, 4px) solid var(--ink);
  box-shadow: 6px 8px 0 #353535;
}

.journal-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: clamp(44px, 7vw, 78px);
  font-size: clamp(8px, .85vw, 11px);
}

.journal-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  color: var(--lime);
  font-size: 16px;
}

.save-index {
  color: #a3a3a0;
}

.journal-content {
  max-width: 850px;
  margin: 0 auto;
}

.journal-content h1 {
  max-width: none;
  margin: 0 0 18px;
  font-size: clamp(19px, 3vw, 34px);
  line-height: 1.55;
  letter-spacing: -.08em;
  white-space: normal;
  text-shadow: 3px 3px 0 #333;
}

.journal-intro {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 30px;
  color: #deded9;
  font-size: clamp(8px, .9vw, 11px);
  line-height: 2.2;
}

.cursor {
  display: inline-block;
  width: 8px;
  height: 16px;
  background: var(--lime);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 30px;
}

.stat-card {
  min-height: 62px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 12px 15px;
  border: 1px solid #454545;
}

.stat-label {
  color: #999;
  font-size: 8px;
}

.stat-card strong {
  color: var(--ink);
  font-size: clamp(15px, 1.6vw, 20px);
  font-weight: 400;
}

.stat-card small {
  margin-left: 6px;
  font-size: .7em;
}

.stat-project strong,
.project-kind {
  color: var(--lime) !important;
}

.filters {
  display: flex;
  gap: 8px;
  margin: 24px 0 13px;
}

.filter {
  min-height: 29px;
  padding: 7px 10px;
  border: 1px solid #aaa;
  background: transparent;
  color: var(--ink);
  font-size: 8px;
  cursor: pointer;
}

.filter:hover,
.filter:focus-visible {
  border-color: var(--ink);
  outline: none;
}

.filter.active {
  background: var(--ink);
  color: var(--void);
}

.filter.project-filter,
.filter.project-active {
  border-color: var(--lime);
  color: var(--lime);
}

.filter.project-active {
  background: var(--lime);
  color: var(--void);
}

.journal-rows {
  display: flex;
  flex-direction: column;
}

.journal-row {
  display: grid;
  grid-template-columns: 106px 48px minmax(0, 1fr);
  align-items: baseline;
  gap: 13px;
  padding: 13px 0;
  border-bottom: 1px dashed #454545;
  color: var(--ink);
  font-size: clamp(8px, .8vw, 10px);
  line-height: 1.9;
  text-decoration: none;
}

.journal-row:hover .entry-copy strong {
  color: var(--lime);
}

.journal-row .entry-date {
  color: #999;
  white-space: nowrap;
}

.entry-kind {
  color: #d9d9d4;
}

.entry-copy {
  min-width: 0;
}

.entry-copy strong {
  font-weight: 400;
}

.entry-detail {
  color: #8f8f8b;
}

.journal-message {
  margin: 20px 0 0;
  color: #a5a5a0;
  font-size: 9px;
  line-height: 2.2;
}

.error-message {
  color: #ff9e8e;
}

.activity-wrap { margin: 24px 0 26px; }
.activity-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, clamp(5px, .95vw, 10px)); grid-auto-columns: clamp(5px, .95vw, 10px); gap: clamp(2px, .32vw, 4px); overflow-x: auto; padding-bottom: 4px; scrollbar-color: #555 transparent; }
.activity-cell { display: block; width: clamp(5px, .95vw, 10px); height: clamp(5px, .95vw, 10px); padding: 0; border: 0; border-radius: 0; background: #242424; }
.level-1 { background: #536b24; }.level-2 { background: #86b72b; }.level-3 { background: #a8e62d; }.level-4 { background: var(--lime); }
.activity-legend { display: flex; align-items: center; gap: 4px; margin-top: 8px; color: #a0a09b; font-size: 7px; }
.activity-legend span:first-child { margin-right: 3px; }.activity-legend span:last-child { margin-left: 3px; }
.activity-legend .activity-cell { flex: none; }
.activity-easter-egg { cursor: pointer; }
.activity-easter-egg:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }
.inventory-section h2, .entries-section h2 { margin: 0 0 10px; color: var(--ink); font-size: 12px; font-weight: 400; }
.inventory-section { margin: 0 0 25px; }
.inventory-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.inventory-item { min-width: 0; min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; border: 1px solid #494949; background: transparent; color: var(--ink); cursor: pointer; }
.inventory-item strong { font-size: clamp(9px, 1vw, 13px); font-weight: 400; }
.inventory-item span { color: #aaa; font: 6px system-ui, sans-serif; }
.inventory-item:hover, .inventory-item:focus-visible, .inventory-item.selected { border-color: var(--lime); color: var(--lime); outline: none; }
.inventory-item.selected span { color: #d5eaa7; }
.inventory-description { min-height: 44px; display: flex; align-items: center; margin: 8px 0 0; padding: 10px; border: 1px solid #777; color: #ddd; font-size: 7px; line-height: 1.8; }
.entries-section { margin-top: 0; }
.wasm-game-overlay { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 18px; background: #000d; }
.wasm-game-dialog { width: min(100%, 1100px); height: min(92svh, 850px); display: flex; flex-direction: column; border: 2px solid var(--ink); background: #101010; box-shadow: 0 0 0 8px #0008; }
.wasm-game-header { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 16px; border-bottom: 1px solid #454545; }
.wasm-game-header h2 { margin: 0 0 6px; font: 10px 'Press Start 2P', monospace; }
.wasm-game-header p { margin: 0; color: #aaa; font: 10px system-ui, sans-serif; }
.close-game { width: 35px; height: 35px; flex: 0 0 auto; border: 1px solid #aaa; background: transparent; color: white; font-size: 25px; cursor: pointer; }
.close-game:hover, .close-game:focus-visible { border-color: var(--lime); color: var(--lime); outline: none; }
.wasm-game-dialog iframe { width: 100%; flex: 1; min-height: 0; border: 0; background: #111; }

@media (max-width: 760px) {
  .landing {
    padding-top: 12px;
  }

  .home-frame {
    min-height: min(690px, calc(100svh - 94px));
  }

  .home-content {
    padding: 34px 8px;
  }

  .pixel-mark {
    margin-bottom: 40px;
  }

  h1 {
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: clamp(25px, 8.2vw, 58px);
    line-height: 1.5;
  }

  .tagline {
    max-width: 440px;
    margin: 30px 0 36px;
    font-size: clamp(9px, 2.1vw, 12px);
    line-height: 2.4;
  }

  .cta {
    min-height: 58px;
    padding: 14px 19px;
    border-width: 4px;
    font-size: 10px;
  }

  .currently { max-width: 390px; }
  .footer { flex-wrap: wrap; gap: 8px 16px; padding: 12px 0; }

  .journal-frame {
    min-height: calc(100svh - 24px);
    padding: 20px 16px;
  }

  .journal-topbar {
    margin-bottom: 42px;
  }

  .journal-content h1 {
    font-size: clamp(18px, 4.7vw, 29px);
  }

  .stats-grid {
    gap: 7px;
  }

  .stat-card {
    padding: 10px 8px;
  }

  .stat-label {
    font-size: 7px;
  }

  .journal-row {
    grid-template-columns: 84px 37px minmax(0, 1fr);
    gap: 7px;
    font-size: 7px;
  }
  .inventory-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .inventory-item { min-height: 54px; }
  .wasm-game-overlay { padding: 8px; }
  .wasm-game-dialog { width: 100%; height: 94svh; }
  .wasm-game-header h2 { font-size: 8px; }
}

@media (max-width: 380px) {
  .home-frame {
    min-height: calc(100svh - 82px);
  }

  .home-content {
    width: calc(100% - 18px);
  }

  h1 {
    font-size: 24px;
  }

  .tagline {
    font-size: 8px;
  }

  .journal-frame {
    padding: 16px 11px;
  }

  .journal-row {
    grid-template-columns: 73px 31px minmax(0, 1fr);
    gap: 5px;
    font-size: 6px;
  }

  .journal-intro {
    font-size: 7px;
  }
  .journal-row { grid-template-columns: 64px 32px minmax(0, 1fr); gap: 4px; font-size: 6px; }
  .inventory-section h2, .entries-section h2 { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    transition-duration: .01ms !important;
  }
}
