@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@500;700;800;900&display=swap');

:root { color-scheme: light; font-family: Nunito, system-ui, sans-serif; color: #302c3b; background: #eee9df; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; padding: 18px; background: linear-gradient(145deg, #f8f5ee, #eae4d8); }
.game { width: min(1500px, 100%); margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 76px; margin-bottom: 16px; padding: 12px 22px; border: 1px solid #e2d8c8; border-radius: 18px; background: rgba(255,255,255,.82); box-shadow: 0 5px 18px #59472b0d; }
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: #5b8f67; color: white; font-weight: 900; letter-spacing: -.05em; }
.eyebrow, .panel-kicker { margin: 0 0 2px; color: #a36c48; font-size: .65rem; font-weight: 900; letter-spacing: .15em; }
h1 { margin: 0; font-size: 1.65rem; line-height: 1.1; font-weight: 900; letter-spacing: -.04em; }
.top-note { color: #777181; font-size: .9rem; font-weight: 800; }
.game-layout { display: grid; grid-template-columns: minmax(250px, .92fr) minmax(360px, 1.45fr) minmax(250px, .92fr); gap: 13px; height: min(680px, calc(100vh - 155px)); min-height: 0; }
.click-panel, .main-panel, .shop-panel { min-width: 0; min-height: 0; overflow: hidden; border: 1px solid #e2d8c8; border-radius: 17px; background: rgba(255,255,255,.78); box-shadow: 0 8px 25px #59472b0d; }
.click-panel { display: flex; flex-direction: column; align-items: center; padding: 18px 15px 20px; text-align: center; background: linear-gradient(180deg, #eaf2ed 0%, #fff 42%); }
.counter { display: flex; flex-direction: column; align-items: center; gap: 7px; margin: 22px 0 4px; }
.counter-main { display: flex; align-items: center; justify-content: center; gap: 12px; }
.counter strong { font-size: clamp(2.5rem, 5vw, 4rem); line-height: 1; font-weight: 900; font-variant-numeric: tabular-nums; color: #304b37; }
.counter-label { color: #718274; font-size: .9rem; font-weight: 900; }
.counter-rate { color: #8b968b; font-size: .78rem; font-weight: 800; }
.school-button { display: grid; place-items: center; width: 100%; flex: 1; min-height: 230px; padding: 12px 0; border: 0; border-radius: 14px; background: transparent; cursor: pointer; transition: transform .12s ease, filter .12s ease; -webkit-tap-highlight-color: transparent; }
.school-button img { display: block; width: min(100%, 330px); max-height: 390px; object-fit: contain; filter: drop-shadow(0 10px 8px #394d3020); user-select: none; pointer-events: none; }
.school-button { transition: filter .15s ease; }
.school-button img { transform: scale(1); transform-origin: center; }
.school-button:hover { filter: brightness(1.06); }
.school-button:hover img { animation: school-hover .32s ease-out; }
.school-button:active { transform: scale(.97); }
.school-button.click-wobble { animation: school-click .42s ease-in-out; }
.school-button:focus-visible { outline: 4px solid #e8a94c; outline-offset: 3px; }
@keyframes school-hover {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(1.045); }
  62% { transform: scale(.995); }
}
@keyframes school-click {
  0%, 100% { transform: scale(1); }
  20% { transform: scale(1.09); }
  45% { transform: scale(.96); }
  70% { transform: scale(1.055); }
}
.hint { min-height: 24px; margin: 5px 0 0; color: #777181; font-size: .88rem; font-weight: 800; }
.main-panel { padding: 22px; background: linear-gradient(180deg, #fff 0%, #f8f6f0 100%); }
.panel-heading { padding-bottom: 17px; border-bottom: 1px solid #eee7dc; }
h2 { margin: 3px 0 0; font-size: 1.3rem; font-weight: 900; letter-spacing: -.035em; }
.notice { display: flex; gap: 13px; margin-top: 20px; padding: 17px; border: 1px solid #eadfc9; border-radius: 13px; background: #fff9ec; }
.notice-icon { color: #c18a3d; font-size: 1.5rem; }
.notice strong { font-size: 1rem; }
.notice p, .empty-cour p { margin: 5px 0 0; color: #827b83; font-size: .88rem; line-height: 1.5; }
.school-status { display: flex; align-items: center; gap: 8px; margin-top: 20px; color: #637466; font-size: .8rem; font-weight: 800; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #65a874; box-shadow: 0 0 0 4px #65a87420; }
.status-tag { margin-left: auto; padding: 4px 8px; border-radius: 7px; background: #eeeae2; color: #8b8379; font-size: .68rem; }
.empty-cour { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 250px; margin-top: 18px; padding: 25px; border: 1px dashed #ded5c7; border-radius: 14px; text-align: center; background: #f7f5ef; }
.cour-icon { margin-bottom: 12px; font-size: 2.7rem; filter: saturate(.7); }
.empty-cour strong { font-size: .98rem; }
.empty-cour p { max-width: 280px; }

.shop-panel { display: grid; grid-template-rows: minmax(0, .9fr) minmax(0, 1.1fr); height: 100%; min-height: 0; padding: 0; background: #f8f7f2; }
.upgrade-section, .building-section { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; padding: 15px 13px 12px; }
.upgrade-section { border-bottom: 3px solid #e3dacb; }
.shop-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 8px; flex: 0 0 auto; padding: 0 3px 12px; }
.shop-section-heading h2 { font-size: 1.15rem; }
.scroll-hint { color: #a39a8e; font-size: .65rem; font-weight: 800; white-space: nowrap; }
.upgrade-scroll { display: flex; flex: 1 1 0; min-width: 0; min-height: 0; gap: 9px; overflow-x: auto; overflow-y: hidden; padding: 2px 2px 9px; overscroll-behavior-x: contain; scrollbar-width: auto; scrollbar-color: #c8bda9 #eee9df; }
.upgrade-card { display: flex; flex: 0 0 calc((100% - 18px) / 4); flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px; min-width: 0; padding: 8px; border: 1px solid #e5ddcf; border-radius: 11px; background: #fff; color: #4c4650; text-align: left; opacity: .82; cursor: not-allowed; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease, transform .18s ease, opacity .18s ease; }
.upgrade-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #f1eee6; font-size: 1.05rem; }
.upgrade-card strong { font-size: .78rem; line-height: 1.2; }
.upgrade-card small { color: #9a9290; font-size: .59rem; line-height: 1.2; }
.upgrade-card:hover, .upgrade-card:focus-visible,
.building-card:hover, .building-card:focus-visible {
  border-color: #d6a653;
  background: #fffaf0;
  box-shadow: 0 4px 12px #9b77301c, 0 0 0 2px #e8bd7040;
  opacity: 1;
  transform: translateY(-2px);
  outline: none;
}
.upgrade-card:hover .upgrade-icon, .building-card:hover .building-icon {
  background: #f8ebd1;
}
.building-section { padding-top: 13px; }
.building-heading { padding-bottom: 9px; }
.building-scroll { display: flex; flex: 1 1 0; min-height: 0; flex-direction: column; gap: 8px; overflow-x: hidden; overflow-y: auto; padding: 2px 4px 4px 2px; overscroll-behavior-y: contain; scrollbar-width: auto; scrollbar-color: #c8bda9 #eee9df; }
.building-card { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; width: 100%; min-height: 59px; padding: 8px; border: 1px solid #e5ddcf; border-radius: 10px; background: #fff; color: #4c4650; text-align: left; opacity: .82; cursor: pointer; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease, transform .18s ease, opacity .18s ease; }
.building-card.is-unaffordable { background: #eeece8; border-color: #e2ded6; color: #99938b; opacity: .72; cursor: pointer !important; }
.building-card.is-unaffordable .building-icon { background: #e5e2dc; filter: grayscale(1); }
.building-card.is-unaffordable .building-owned { background: #e3e1db; color: #918b82; }
.building-card.is-unaffordable .building-price { color: #aaa39a; }
.building-card:not(.is-unaffordable) { cursor: pointer; }
.building-owned { display: grid; place-items: center; flex: 0 0 25px; min-height: 25px; border-radius: 7px; background: #edf1e9; color: #526d55; font-size: .75rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.building-icon { display: grid; place-items: center; flex: 0 0 37px; height: 37px; border-radius: 9px; background: #edf1e9; font-size: 1.25rem; }
.building-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; }
.building-copy strong { font-size: .76rem; }
.building-copy small { color: #9a9290; font-size: .64rem; }
.building-price { color: #9a9290; font-size: .62rem; font-weight: 900; white-space: nowrap; }
.building-card:not(.is-unaffordable) .building-price { color: #66856b; }
.building-card.is-unaffordable:hover, .building-card.is-unaffordable:focus-visible {
  border-color: #e2ded6;
  background: #eeece8;
  box-shadow: none;
  opacity: .72;
  transform: none;
}
.building-card.is-unaffordable:hover .building-icon { background: #e5e2dc; }
footer { padding: 15px 4px 4px; color: #9a94a0; font-size: .78rem; text-align: center; }

@media (max-width: 900px) {
  body { padding: 12px; }
  .game-layout { grid-template-columns: minmax(220px, .85fr) minmax(300px, 1.15fr); height: auto; min-height: 0; }
  .shop-panel { grid-column: 1 / -1; height: 560px; min-height: 520px; }
}
@media (max-width: 620px) {
  body { padding: 9px; }
  .topbar { padding: 10px 13px; }
  .top-note { display: none; }
  .game-layout { display: flex; flex-direction: column; min-height: 0; }
  .click-panel { min-height: 470px; }
  .school-button { min-height: 250px; }
  .school-button img { max-height: 300px; }
  .main-panel { min-height: 430px; padding: 18px; }
  .shop-panel { height: 560px; min-height: 560px; }
  .upgrade-card { flex-basis: calc((100% - 18px) / 4); min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .school-button, .school-button img, .upgrade-card, .building-card { animation: none !important; transition: none !important; }
  .school-button:hover img, .school-button:hover, .upgrade-card:hover, .building-card:hover { transform: none; }
}


/* Bulle d'information rectangulaire des bâtiments */
.building-tooltip {
  position: fixed;
  z-index: 1000;
  display: flex;
  width: min(245px, calc(100vw - 24px));
  flex-direction: column;
  gap: 7px;
  padding: 12px 14px;
  border: 1px solid #d8c9ad;
  border-left: 4px solid #6f9874;
  border-radius: 7px;
  background: #fffdf8;
  color: #4c4650;
  box-shadow: 0 8px 24px #302c3b26;
  pointer-events: none;
  text-align: left;
  animation: tooltip-appear .12s ease-out;
}
.building-tooltip[hidden] { display: none; }
.building-tooltip-title { font-size: .84rem; font-weight: 900; }
.building-tooltip-description { color: #817982; font-size: .74rem; line-height: 1.4; }
.building-tooltip-rate {
  padding-top: 6px;
  border-top: 1px solid #eee7dc;
  color: #608365;
  font-size: .74rem;
  font-weight: 900;
}
@keyframes tooltip-appear {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .building-tooltip { animation: none; }
}


.building-tooltip-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 7px;
  border-top: 1px solid #eee7dc;
  color: #6f6870;
  font-size: .72rem;
  line-height: 1.35;
}


/* Mode sombre : repos des rétines */
:root {
  color-scheme: dark;
  color: #e8e4dc;
  background: #14191a;
}
body {
  background: radial-gradient(ellipse at top, #26312e 0%, #171d1e 58%, #111617 100%);
}
.topbar, .click-panel, .main-panel, .shop-panel {
  border-color: #394442;
  background: #202928;
  box-shadow: 0 8px 25px #00000035;
}
.topbar { background: #222c2a; }
.brand-mark { background: #477b58; }
.eyebrow, .panel-kicker { color: #d3a16a; }
.top-note, .hint, .notice p, .empty-cour p { color: #a6aaa3; }
.click-panel { background: linear-gradient(180deg, #263b32 0%, #202928 48%); }
.counter strong { color: #d5e8d5; }
.counter-label { color: #a8bca9; }
.counter-rate { color: #a3aaa0; }
.main-panel { background: linear-gradient(180deg, #252f2e 0%, #202827 100%); }
.panel-heading { border-bottom-color: #3a4541; }
h1, h2, .notice strong, .empty-cour strong { color: #eeeae2; }
.notice {
  border-color: #5a503b;
  background: #343226;
}
.notice-icon { color: #e0b36c; }
.school-status { color: #a9c3aa; }
.status-dot { background: #79b987; box-shadow: 0 0 0 4px #79b98720; }
.status-tag { background: #343d39; color: #b5b5a9; }
.empty-cour {
  border-color: #46524b;
  background: #252e2b;
}
.shop-panel { background: #202928; }
.upgrade-section { border-bottom-color: #394541; }
.scroll-hint { color: #a6a69b; }
.upgrade-scroll, .building-scroll {
  scrollbar-color: #596b60 #293330;
}
.upgrade-card, .building-card {
  border-color: #414d47;
  background: #2a3531;
  color: #e7e5dc;
}
.upgrade-icon, .building-icon {
  background: #39483e;
}
.upgrade-card small, .building-copy small, .building-price {
  color: #a7aaa0;
}
.upgrade-card:hover, .upgrade-card:focus-visible,
.building-card:hover, .building-card:focus-visible {
  border-color: #bd9658;
  background: #3a3a2e;
  box-shadow: 0 4px 12px #00000035, 0 0 0 2px #bd965830;
}
.upgrade-card:hover .upgrade-icon, .building-card:hover .building-icon {
  background: #514633;
}
.building-owned {
  background: #35483a;
  color: #c0dfc1;
}
.building-card:not(.is-unaffordable) .building-price { color: #a9d0a9; }
.building-card.is-unaffordable {
  background: #252b29;
  border-color: #353d39;
  color: #858b84;
}
.building-card.is-unaffordable .building-icon { background: #303632; }
.building-card.is-unaffordable .building-owned { background: #343a35; color: #92978e; }
.building-card.is-unaffordable .building-price { color: #858b84; }
.building-card.is-unaffordable:hover, .building-card.is-unaffordable:focus-visible {
  border-color: #353d39;
  background: #252b29;
}
footer { color: #858e87; }
.building-tooltip {
  border-color: #53645a;
  border-left-color: #79a982;
  background: #252f2c;
  color: #eeeae2;
  box-shadow: 0 8px 24px #00000070;
}
.building-tooltip-description { color: #b3b7ad; }
.building-tooltip-details {
  border-top-color: #46534b;
  color: #d0d2c9;
}
.building-tooltip-rate { border-top-color: #46534b; color: #a9d0a9; }
