*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #060408;
  color: #c8b8d8;
  font-family: 'Crimson Pro', Georgia, serif;
}

.ih-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(80, 20, 100, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 100%, rgba(40, 0, 60, 0.15) 0%, transparent 50%),
    linear-gradient(180deg, #0a0610 0%, #040306 100%);
}

.ih-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(140, 100, 180, 0.2);
  background: rgba(0, 0, 0, 0.45);
}

.ih-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ih-mark {
  font-size: 1.1rem;
  color: #a060d0;
  text-shadow: 0 0 12px rgba(160, 96, 208, 0.8);
  animation: ih-pulse 3s ease-in-out infinite;
}

@keyframes ih-pulse {
  50% { opacity: 0.45; transform: scale(0.92); }
}

.ih-brand h1 {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  color: #e8d8f8;
}

.ih-credit {
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  opacity: 0.45;
}

.ih-exit {
  font-size: 0.72rem;
  color: rgba(200, 180, 220, 0.55);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid rgba(140, 100, 180, 0.25);
  border-radius: 4px;
}

.ih-exit:hover { color: #e8d8f8; border-color: rgba(180, 140, 220, 0.5); }

.ih-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr min(300px, 36vw);
  gap: 12px;
  padding: 12px;
  min-height: 0;
}

.ih-board-wrap {
  position: relative;
  min-height: 0;
  border: 2px solid rgba(80, 50, 110, 0.35);
  border-radius: 8px;
  overflow: hidden;
  background: #08060c;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.8);
}

#ih-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: manipulation;
}

.ih-float-msg {
  position: absolute;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  padding: 8px 16px;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  color: #f0e0ff;
  background: rgba(20, 8, 30, 0.88);
  border: 1px solid rgba(160, 96, 208, 0.45);
  border-radius: 4px;
  pointer-events: none;
  z-index: 4;
}

.ih-scare-flash {
  position: absolute;
  inset: 0;
  background: rgba(160, 40, 200, 0.55);
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  transition: opacity 0.08s;
}

.ih-scare-flash.ih-active { opacity: 1; }

.ih-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
}

.ih-meters { display: flex; flex-direction: column; gap: 10px; }

.ih-meter-label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-bottom: 4px;
}

.ih-bar {
  height: 10px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(100, 70, 130, 0.25);
}

.ih-bar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.2s ease;
}

.ih-bar-ecto {
  background: linear-gradient(90deg, #401060, #a060d0);
  box-shadow: 0 0 10px rgba(160, 96, 208, 0.5);
}

.ih-bar-exo {
  background: linear-gradient(90deg, #601010, #d04040);
  box-shadow: 0 0 10px rgba(208, 64, 64, 0.4);
}

.ih-power-label {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(200, 180, 220, 0.7);
}

.ih-hint {
  display: block;
  font-size: 0.62rem;
  opacity: 0.55;
  text-transform: none;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.ih-powers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ih-power-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid rgba(100, 70, 130, 0.35);
  background: rgba(12, 8, 18, 0.85);
  color: #d8c8e8;
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.ih-power-btn:hover:not(:disabled) {
  border-color: rgba(160, 96, 208, 0.55);
  background: rgba(30, 16, 40, 0.9);
}

.ih-power-btn.ih-selected {
  border-color: #a060d0;
  background: rgba(60, 24, 80, 0.65);
  box-shadow: 0 0 14px rgba(160, 96, 208, 0.25);
}

.ih-power-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.ih-power-cost {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: #a080c0;
}

.ih-inv-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ih-inv {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid rgba(80, 60, 100, 0.3);
  background: rgba(8, 6, 12, 0.75);
  font-size: 0.82rem;
}

.ih-inv strong {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: #e8d8f8;
  margin-bottom: 6px;
}

.ih-inv-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.ih-inv-fill {
  height: 100%;
  background: linear-gradient(90deg, #3040a0, #80a0ff);
  transition: width 0.25s;
}

.ih-inv.ih-panicked { border-color: rgba(200, 80, 80, 0.5); }
.ih-inv.ih-fled { opacity: 0.35; text-decoration: line-through; }

.ih-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 2, 8, 0.94);
}

.ih-screen[hidden] { display: none; }

.ih-title-box {
  max-width: 480px;
  text-align: center;
}

.ih-title-badge {
  margin: 0 0 12px;
  font-size: 0.65rem;
  letter-spacing: 0.28em;
  color: #a060d0;
}

.ih-title-box h2 {
  margin: 0 0 16px;
  font-family: 'Cinzel', serif;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  letter-spacing: 0.12em;
  color: #f0e0ff;
  text-shadow: 0 0 30px rgba(160, 96, 208, 0.45);
}

.ih-title-desc {
  margin: 0 0 18px;
  font-size: 1rem;
  line-height: 1.65;
  color: rgba(200, 180, 220, 0.75);
}

.ih-title-rules {
  text-align: left;
  margin: 0 0 24px;
  padding-left: 1.2rem;
  font-size: 0.88rem;
  line-height: 1.7;
  color: rgba(180, 160, 200, 0.65);
}

.ih-btn {
  padding: 12px 28px;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #f0e0ff;
  background: rgba(40, 16, 60, 0.8);
  border: 1px solid rgba(160, 96, 208, 0.5);
  border-radius: 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ih-btn:hover {
  background: rgba(60, 24, 90, 0.9);
  border-color: #c080e0;
}

.ih-screen--end {
  flex-direction: column;
  text-align: center;
  gap: 16px;
}

.ih-screen--end h2 {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  letter-spacing: 0.2em;
  color: #f0e0ff;
}

.ih-screen--end p {
  margin: 0;
  max-width: 420px;
  line-height: 1.65;
  color: rgba(200, 180, 220, 0.75);
}

@media (max-width: 720px) {
  .ih-main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .ih-panel {
    max-height: 38vh;
  }
}

@media (hover: none), (pointer: coarse) {
  .ih-power-btn,
  .ih-btn {
    min-height: 48px;
  }
}
