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

body.pharaoh {
  min-height: 100vh;
  background: linear-gradient(180deg, #f9e3b0 0%, #eec987 55%, #d9a860 100%);
  color: #4a3312;
  font-family: Georgia, "Palatino Linotype", serif;
}

.ph-header {
  text-align: center;
  padding: 1rem 1rem 0.8rem;
}

.ph-header h1 {
  font-size: 1.6rem;
  letter-spacing: 0.25em;
  color: #7a4d12;
  text-shadow: 0 1px 0 #fff3d0;
}

.ph-sub {
  font-style: italic;
  color: #8a6d3b;
  margin-top: 0.2rem;
  font-size: 0.9rem;
}

.ph-back {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: #2a4d8f;
  text-decoration: none;
  margin-bottom: 0.4rem;
}

.ph-stage {
  display: flex;
  align-items: stretch;
  max-width: 1060px;
  margin: 0.6rem auto 0;
  padding: 0 1rem 2.5rem;
}

.ph-scene {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ph-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.chip {
  background: rgba(255, 248, 230, 0.92);
  border: 2px solid #8a6d3b;
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  min-width: 78px;
  box-shadow: 0 2px 6px rgba(122, 77, 18, 0.25);
}

.chip span {
  display: block;
  font-size: 0.56rem;
  letter-spacing: 0.15em;
  color: #8a6d3b;
}

.chip b {
  font-size: 0.95rem;
  color: #7a4d12;
}

.chip.big b {
  font-size: 1.35rem;
  color: #2a4d8f;
}

#scene {
  width: 100%;
  height: auto;
  display: block;
  border: 6px solid #6b4a1f;
  border-right: none;
  border-radius: 10px 0 0 10px;
  box-shadow: 0 8px 28px rgba(122, 77, 18, 0.4), inset 0 0 0 2px #fff3d0;
  background: #f9e3b0;
  cursor: pointer;
}

#carveBtn {
  align-self: center;
  margin-top: 0.9rem;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: bold;
  letter-spacing: 0.12em;
  padding: 0.9rem 2.2rem;
  color: #fff8e6;
  background: linear-gradient(180deg, #3a63b0, #2a4d8f);
  border: 2px solid #1d3766;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 0 #1d3766;
  transition: transform 0.05s, box-shadow 0.05s;
}

#carveBtn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #1d3766;
}

.ph-side {
  width: 330px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #f3e6c0, #e7d3a0);
  border: 6px solid #6b4a1f;
  border-left: 3px solid #8a6d3b;
  border-radius: 0 10px 10px 0;
  padding: 1rem 1.1rem 1.4rem;
  box-shadow: 0 8px 28px rgba(122, 77, 18, 0.4), inset 0 0 0 2px #fff3d0;
  max-height: 640px;
  overflow-y: auto;
}

.ph-side h2 {
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  color: #2a4d8f;
  border-bottom: 2px solid #b98d3e;
  padding-bottom: 0.3rem;
  margin: 1.1rem 0 0.7rem;
}

.ph-side h2:first-child {
  margin-top: 0;
}

#shop {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.build-btn {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: inherit;
  text-align: left;
  padding: 0.55rem 0.7rem;
  background: #fff8e6;
  border: 2px solid #b98d3e;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, transform 0.05s;
}

.build-btn:hover:not(:disabled) {
  background: #fffdf4;
  transform: translateX(2px);
}

.build-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.b-icon {
  font-size: 1.3rem;
}

.b-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.b-name {
  font-weight: bold;
  color: #4a3312;
}

.b-name em {
  font-style: normal;
  color: #2a4d8f;
}

.b-desc {
  font-size: 0.72rem;
  color: #8a6d3b;
}

.b-cost {
  font-weight: bold;
  color: #7a4d12;
  white-space: nowrap;
}

.ph-progress {
  height: 16px;
  background: #e0cd9e;
  border: 2px solid #8a6d3b;
  border-radius: 8px;
  overflow: hidden;
}

#layerFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #c9a86a, #e8c33a);
  transition: width 0.15s;
}

.ph-note {
  font-size: 0.78rem;
  color: #6b4f22;
  margin-top: 0.5rem;
}

.ph-note a {
  color: #2a4d8f;
}

.noscript-info {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  padding: 0.6rem 1rem;
  text-align: center;
  font-size: 0.9rem;
  color: #7a4d12;
  background: #fff3d0;
  border-bottom: 2px solid #8a6d3b;
}

.ph-prestige {
  font-family: inherit;
  width: 100%;
  padding: 0.7rem;
  font-weight: bold;
  letter-spacing: 0.12em;
  color: #fff8e6;
  background: linear-gradient(180deg, #b08a2e, #8a6d1a);
  border: 2px solid #6b5210;
  border-radius: 8px;
  cursor: pointer;
}

.ph-prestige:active {
  transform: translateY(2px);
}

#toasts {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 20;
  pointer-events: none;
}

.toast {
  background: rgba(42, 77, 143, 0.92);
  color: #fff8e6;
  font-size: 0.85rem;
  padding: 0.6rem 1.1rem;
  border-radius: 20px;
  border: 1px solid #ffd700;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .ph-stage {
    flex-direction: column;
  }

  #scene {
    border-right: 6px solid #6b4a1f;
    border-radius: 10px 10px 0 0;
  }

  .ph-side {
    width: 100%;
    border-left: 6px solid #6b4a1f;
    border-top: 3px solid #8a6d3b;
    border-radius: 0 0 10px 10px;
    max-height: none;
  }
}
