/* ============================================================
   Hero's Path — V2 Dark Fantasy
   ============================================================ */

@font-face {
  font-family: "MiddAges";
  src: url('/style/MiddAges.ttf') format('truetype');
  font-display: swap;
}

#page-title {
  font-family: "MiddAges", "Transcend", "Cormorant Garamond", serif;
}

.reset-btn {
  margin-top: auto;
  margin-bottom: 10px;
  background: transparent;
  color: #c9a96a;
  border: 1px solid rgba(201,169,106,0.45);
  border-radius: 0;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  width: fit-content;
  align-self: center;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  flex-shrink: 0;
}
.reset-btn:hover {
  background: rgba(201,169,106,0.1);
  border-color: #c9a96a;
  color: #f1ddb1;
}
.reset-btn svg {
  width: 20px;
  height: 20px;
}

.stats {
  text-align: center;
  margin-bottom: 25px;
  font-size: 18px;
}
.stats span { margin: 0 15px; font-weight: 600; }

.board {
  position: relative;
  width: 90%;
  max-width: 1400px;
  margin: 0 auto 56px;
  padding: 32px 0;
  background: linear-gradient(180deg, rgba(22,18,16,0.96), rgba(8,7,7,0.94));
  border: 1px solid rgba(201,169,106,0.18);
}

/* ── Top panel above the path ── */
.top-panel {
  width: 90%;
  max-width: 1400px;
  margin: 16px auto 24px;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 14px;
}

.top-section {
  flex: 1 1 0;
  min-width: 0;
  background: linear-gradient(180deg, rgba(22,18,16,0.96), rgba(8,7,7,0.94));
  border: 1px solid rgba(201,169,106,0.25);
  box-shadow: 0 0 8px rgba(0,0,0,0.5);
  padding: 12px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.top-section-title {
  font-family: "Transcend", "Cormorant Garamond", serif;
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #f1ddb1;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(201,169,106,0.25);
  margin: 0;
}

.top-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.top-stats .stat-item { margin: 0; flex: 0 0 auto; }

.top-stats .reset-btn {
  margin: auto auto 0;
  align-self: center;
  padding: 6px 14px;
}
.top-stats .reset-btn svg { width: 18px; height: 18px; }

.top-panel .total-points {
  margin: 0;
  padding: 0;
  border: none;
  text-align: center;
}

.shards-cards-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shard-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(201,169,106,0.18);
}

.shard-card img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}

.shard-card-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.shard-card-name { font-weight: 600; font-size: 12px; color: #e8e0d2; }
.shard-card-cost { font-size: 10px; color: #c9a96a; }

.shard-card-input {
  width: 64px;
  background: rgba(0,0,0,0.6);
  color: #f1ddb1;
  border: 1px solid rgba(201,169,106,0.3);
  border-radius: 0;
  padding: 4px 8px;
  text-align: right;
  font-weight: 600;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
}
.shard-card-input:focus {
  outline: none;
  border-color: #c9a96a;
  box-shadow: 0 0 6px rgba(201,169,106,0.45);
}

.shards-total {
  text-align: right;
  font-size: 13px;
  color: #e8e0d2;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid rgba(201,169,106,0.18);
}
.shards-total span { font-weight: 700; color: #f1ddb1; }

/* "Planned Cost in Shards" devient horizontal dans le top-panel */
.top-panel #shardsContainer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.top-panel .shards-section {
  margin-top: 0;
  padding-top: 12px;
  border-top: 1px solid rgba(201,169,106,0.25);
}
.top-panel .shards-title { display: none; }
.top-panel .shard-item { margin-bottom: 0; }

.board::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(201,169,106,0.10);
  pointer-events: none;
  animation: borderGlow 4s ease-in-out infinite;
}

.board::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(201,169,106,0.04) 0%, transparent 30%, transparent 70%, rgba(201,169,106,0.04) 100%);
  pointer-events: none;
}

@keyframes borderGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(201,169,106,0.15), inset 0 0 10px rgba(201,169,106,0.05); opacity: 0.85; }
  50%       { box-shadow: 0 0 16px rgba(201,169,106,0.28), inset 0 0 18px rgba(201,169,106,0.09); opacity: 1; }
}

svg.connections {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  shape-rendering: crispEdges; /* lignes H/V nettes, épaisseur uniforme */
}

.reward-container {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 50px;
  width: 100%;
}

.reward-row {
  position: relative;
  height: 150px;
}

.reward-box {
  position: relative;
  background: rgba(12,10,9,0.88);
  border: 1px solid rgba(201,169,106,0.25);
  border-radius: 0;
  padding: 16px 10px 10px;
  width: 120px;
  height: 120px;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
  overflow: hidden;
}

.reward-box img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  margin-bottom: 6px;
  filter: grayscale(1) brightness(0.5);
  transition: filter 0.2s ease;
}

.reward-name { font-weight: 600; font-size: 11px; margin-bottom: 3px; color: #e8e0d2; }
.reward-cost { font-size: 10px; color: #c9a96a; }

/* ── Right sidebar ── */
#info-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 250px;
  height: 100vh;
  background: linear-gradient(180deg, rgba(18,14,12,0.98), rgba(8,7,6,0.97));
  border-left: 1px solid rgba(201,169,106,0.4);
  color: #e8e0d2;
  padding: 25px 20px 15px;
  box-shadow: -6px 0 24px rgba(0,0,0,0.7);
  transition: right 0.4s ease;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

#info-sidebar.closed {
  right: -360px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(0,0,0,0.32);
  border: 1px solid rgba(201,169,106,0.12);
  border-radius: 0;
  font-size: 14px;
}

.stat-item img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.stat-label {
  font-weight: 600;
  color: #c9a96a;
  flex: 1;
}

.stat-value {
  font-weight: 600;
  color: #e8e0d2;
}

.shards-section {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid rgba(201,169,106,0.2);
}

.shards-title {
  font-family: "Transcend", "Cormorant Garamond", serif;
  font-weight: 400;
  color: #f1ddb1;
  margin-bottom: 8px;
  font-size: 13px;
  text-align: center;
}

.shard-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(0,0,0,0.32);
  border: 1px solid rgba(201,169,106,0.12);
  border-radius: 0;
  margin-bottom: 6px;
}

.shard-item img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.shard-name {
  font-size: 14px;
  flex: 1;
  color: #e8e0d2;
}

.shard-count {
  font-weight: 600;
  font-size: 14px;
  color: #e8e0d2;
}

.total-points {
  text-align: center;
  font-size: 12px;
  color: rgba(232,224,210,0.4);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(201,169,106,0.15);
}

/* ── Reward states ── */
.reward-box.available img,
.reward-box.active img {
  filter: grayscale(0) brightness(1);
}

.reward-box.available {
  border-color: rgba(201,169,106,0.6);
  box-shadow: 0 0 8px rgba(201,169,106,0.2);
}
.reward-box.active {
  border-color: #22c55e;
  box-shadow: 0 0 18px rgba(34,197,94,0.4);
}
.reward-box.locked {
  border-color: rgba(201,169,106,0.12);
  filter: grayscale(1) brightness(0.4);
  cursor: not-allowed;
}
.reward-box.planned {
  border-color: #3b82f6;
  box-shadow: 0 0 10px rgba(59,130,246,0.4);
}

/* ── Flash red/green for lock blocked / available keys ── */
@keyframes flash-red-anim {
  0%, 100% {
    box-shadow: 0 0 0 rgba(255,0,0,0);
    border-color: rgba(201,169,106,0.12);
  }
  50% {
    box-shadow: 0 0 18px rgba(255,40,40,0.95), 0 0 32px rgba(255,0,0,0.55);
    border-color: #ff3030;
  }
}
@keyframes flash-green-anim {
  0%, 100% { box-shadow: 0 0 0 rgba(0,255,100,0); }
  50% {
    box-shadow: 0 0 18px rgba(34,197,94,0.9), 0 0 30px rgba(34,197,94,0.55);
    border-color: #22c55e;
  }
}
.reward-box.flash-red,
.reward-box.flash-green {
  filter: none !important;
}
.reward-box.flash-red {
  animation: flash-red-anim 0.5s ease-in-out 3;
}
.reward-box.flash-green {
  animation: flash-green-anim 0.5s ease-in-out 3;
}

/* ── Flash animation ── */
.activation-flash {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 140%;
  height: 140%;
  transform: translate(-50%, -50%) scale(0.2);
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(201,169,106,0.8) 0%, rgba(201,169,106,0) 70%);
  animation: pulse 0.7s ease-out forwards;
  z-index: 2;
}
@keyframes pulse {
  0%   { opacity: 0.9; transform: translate(-50%, -50%) scale(0.2); }
  50%  { opacity: 1;   transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0;   transform: translate(-50%, -50%) scale(1.8); }
}

/* ── Info button ── */
.info-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: #e8e0d2;
  cursor: pointer;
  z-index: 10001;
  padding: 6px;
  transition: color 0.25s ease, transform 0.2s ease;
}
.info-btn:hover {
  color: #c9a96a;
  transform: scale(1.08);
}
.info-btn svg {
  width: 28px;
  height: 28px;
  stroke-width: 1.75;
  vertical-align: middle;
}

/* ── Responsive ── */
@media (max-width: 1400px) {
  .reward-box { width: 60px; height: 60px; }
  .reward-box img { width: 50px; height: 50px; }
  .reward-name { display: none; }
  .reward-cost { font-size: 9px; margin-top: -10px; }
  #info-sidebar { width: 25%; right: calc(-25% - 2px); padding: 0; }
  #info-sidebar span { padding: 20px; }
  #info-sidebar.closed { right: 0; padding: 0; }
  #info-sidebar.closed span { padding: 20px; }
}

@media (max-width: 1100px) {
  .top-panel { flex-direction: column; }
}

@media (max-width: 1000px) {
  .reward-box { width: 40px; height: 40px; }
  .reward-box img { width: 20px; height: 20px; }
  .reward-cost { font-size: 7px; margin-top: -8px; }
}

@media (max-width: 700px) {
  .reward-box { width: 34px; height: 34px; padding: 2px; }
  .reward-box img { width: 20px; height: 20px; margin: 0; }
  .reward-cost { font-size: 6px; margin-top: -4px; }
  #page-title { font-size: 26px; padding-top: 16px; }
  .board { padding-top: 16px; }
  #info-sidebar { width: 100%; right: calc(-100% - 2px); }
  .shard-card-input { width: 56px; }
}
