/* IQ trigger button */
.iq-trigger {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background:
    radial-gradient(ellipse at 30% 30%, #f4d97a 0%, #d4a850 35%, #a87830 70%, #6a4a20 100%);
  box-shadow:
    inset 0 1px 1px rgba(255,240,180,0.6),
    inset 0 -2px 3px rgba(70,40,15,0.7),
    inset 2px 0 2px rgba(255,220,140,0.2),
    inset -2px 0 2px rgba(70,40,15,0.4),
    0 3px 8px rgba(0,0,0,0.6),
    0 1px 2px rgba(0,0,0,0.4);
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  animation: trigger-aura 8s ease-in-out infinite;
}
.iq-trigger::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background-image:
    radial-gradient(circle at 50% 50%, transparent 0%, transparent 38%, rgba(70,40,15,0.4) 39%, rgba(70,40,15,0.4) 40%, transparent 41%),
    radial-gradient(circle at 50% 50%, transparent 0%, transparent 52%, rgba(70,40,15,0.3) 53%, rgba(70,40,15,0.3) 54%, transparent 55%);
  opacity: 0.6;
  pointer-events: none;
}
.iq-trigger-glyph {
  position: relative;
  z-index: 2;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #c8e4ff;
  animation: glyph-cycle 8s ease-in-out infinite;
}
@keyframes glyph-cycle {
  0%, 5% { color: #c8e4ff; text-shadow: 0 -1px 0 rgba(20,40,70,0.6), 0 0 4px rgba(180,220,255,1), 0 0 10px rgba(120,190,255,0.95), 0 0 16px rgba(80,160,240,0.7), 0 0 24px rgba(60,140,230,0.45); }
  20% { color: #d8edff; text-shadow: 0 -1px 0 rgba(20,40,70,0.6), 0 0 5px rgba(200,230,255,1), 0 0 14px rgba(140,200,255,1), 0 0 20px rgba(90,170,245,0.85), 0 0 30px rgba(70,150,235,0.55); }
  35% { color: #e8c8b0; text-shadow: 0 -1px 0 rgba(45,30,50,0.6), 0 0 4px rgba(220,180,160,0.9), 0 0 12px rgba(180,130,110,0.6); }
  45% { color: #ffc090; text-shadow: 0 -1px 0 rgba(70,20,5,0.6), 0 0 4px rgba(255,160,90,0.95), 0 0 12px rgba(245,100,40,0.85), 0 0 20px rgba(220,70,25,0.65); }
  55%, 65% { color: #ffb070; text-shadow: 0 -1px 0 rgba(70,20,5,0.6), 0 0 5px rgba(255,150,75,1), 0 0 14px rgba(248,95,32,1), 0 0 22px rgba(225,65,22,0.85), 0 0 32px rgba(195,48,15,0.55); }
  75% { color: #ffc090; text-shadow: 0 -1px 0 rgba(70,20,5,0.6), 0 0 4px rgba(255,160,90,0.95), 0 0 12px rgba(245,100,40,0.85), 0 0 20px rgba(220,70,25,0.65); }
  85% { color: #b8c8dd; text-shadow: 0 -1px 0 rgba(40,35,55,0.6), 0 0 4px rgba(180,200,230,0.9), 0 0 12px rgba(130,160,200,0.6); }
  95%, 100% { color: #c8e4ff; text-shadow: 0 -1px 0 rgba(20,40,70,0.6), 0 0 4px rgba(180,220,255,1), 0 0 10px rgba(120,190,255,0.95), 0 0 16px rgba(80,160,240,0.7), 0 0 24px rgba(60,140,230,0.45); }
}
@keyframes trigger-aura {
  0%, 5%, 95%, 100% { box-shadow: inset 0 1px 1px rgba(255,240,180,0.6), inset 0 -2px 3px rgba(70,40,15,0.7), 0 3px 8px rgba(0,0,0,0.6), 0 0 16px rgba(80,160,240,0.25); }
  20% { box-shadow: inset 0 1px 1px rgba(255,240,180,0.6), inset 0 -2px 3px rgba(70,40,15,0.7), 0 3px 8px rgba(0,0,0,0.6), 0 0 20px rgba(100,180,250,0.32); }
  55%, 65% { box-shadow: inset 0 1px 1px rgba(255,240,180,0.6), inset 0 -2px 3px rgba(70,40,15,0.7), 0 3px 8px rgba(0,0,0,0.6), 0 0 22px rgba(220,80,30,0.32); }
}
.iq-trigger:hover { transform: scale(1.06); }
.iq-trigger:active { transform: scale(0.95); transition: transform 80ms ease-out; }

/* Modal backdrop */
.rune-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease;
  z-index: 9999;
}
.rune-modal-backdrop.open { opacity: 1; pointer-events: auto; }
.rune-modal-backdrop[hidden] { display: none; }
.rune-modal-content {
  transform: scale(0.92);
  opacity: 0;
  transition: transform 500ms cubic-bezier(0.34, 1.2, 0.64, 1), opacity 400ms ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  font-family: 'Cinzel', Georgia, serif;
}
.rune-modal-backdrop.open .rune-modal-content { transform: scale(1); opacity: 1; }
.rune-modal-content h2 {
  color: #c8b78a;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 18px;
  letter-spacing: 0.2em;
  margin: 0;
  text-transform: uppercase;
  opacity: 0.8;
  text-align: center;
}
.rune-modal-close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: none;
  border: none;
  color: rgba(200,180,130,0.5);
  font-size: 28px;
  font-family: 'Cinzel', Georgia, serif;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 200ms ease, background 200ms ease;
}
.rune-modal-close:hover { color: rgba(200,180,130,1); background: rgba(255,255,255,0.05); }

/* Tablet */
.rune-tablet {
  position: relative;
  width: 420px;
  height: 88px;
  background:
    radial-gradient(ellipse at 30% 30%, #2a2520 0%, transparent 60%),
    radial-gradient(ellipse at 70% 70%, #1a1614 0%, transparent 50%),
    linear-gradient(135deg, #1f1a16 0%, #2a2520 50%, #16120f 100%);
  border-radius: 8px;
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.8),
    inset 0 -1px 2px rgba(200,180,130,0.05),
    0 4px 16px rgba(0,0,0,0.6),
    0 1px 0 rgba(255,255,255,0.04);
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  transition: box-shadow 900ms ease;
}
.rune-tablet.mode-auto {
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.8), inset 0 0 50px rgba(80,160,230,0.06), 0 4px 24px rgba(40,100,180,0.12), 0 1px 0 rgba(255,255,255,0.04);
}
.rune-tablet.mode-expert {
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.8), inset 0 0 50px rgba(230,80,30,0.08), 0 4px 24px rgba(180,50,20,0.15), 0 1px 0 rgba(255,255,255,0.04);
}
.rune-tablet::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 15% 25%, rgba(80,60,40,0.15) 0%, transparent 8%),
    radial-gradient(circle at 75% 15%, rgba(60,40,30,0.12) 0%, transparent 10%),
    radial-gradient(circle at 45% 65%, rgba(40,30,20,0.18) 0%, transparent 12%);
  opacity: 0.7;
  pointer-events: none;
}
.rune-channel {
  position: absolute;
  inset: 14px 24px;
  background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.15) 50%, rgba(0,0,0,0.4) 100%);
  border-radius: 4px;
  box-shadow: inset 0 2px 3px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}
.rune-label {
  position: relative;
  z-index: 1;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 14px;
  letter-spacing: 0.35em;
  font-weight: 500;
  color: #3a342a;
  text-transform: uppercase;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.7);
  width: 90px;
  text-align: center;
  transition: color 900ms ease, text-shadow 900ms ease;
}
.rune-label.active-ice {
  color: rgba(180,220,255,0.75);
  text-shadow: 0 0 6px rgba(120,190,255,0.5), 0 -1px 0 rgba(0,0,0,0.7);
}
.rune-label.active-fire {
  color: rgba(255,180,110,0.75);
  text-shadow: 0 0 6px rgba(245,90,30,0.5), 0 -1px 0 rgba(0,0,0,0.7);
}

/* Sigil */
.sigil {
  position: absolute;
  top: 16px;
  width: 130px;
  height: 56px;
  border-radius: 6px;
  background: radial-gradient(ellipse at 30% 30%, #f4d97a 0%, #d4a850 35%, #a87830 70%, #6a4a20 100%);
  box-shadow:
    inset 0 1px 1px rgba(255,240,180,0.6),
    inset 0 -2px 3px rgba(70,40,15,0.7),
    0 3px 8px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  will-change: transform, left;
}
.sigil.throw-right {
  animation: throw-to-right 650ms cubic-bezier(0.32, 0.85, 0.5, 1) forwards;
}
@keyframes throw-to-right {
  0%   { left: 16px; }
  78%  { left: 260px; }
  88%  { left: 254px; }
  100% { left: 260px; }
}
.sigil.throw-left {
  animation: throw-to-left 650ms cubic-bezier(0.32, 0.85, 0.5, 1) forwards;
}
@keyframes throw-to-left {
  0%   { left: 260px; }
  78%  { left: 16px; }
  88%  { left: 22px; }
  100% { left: 16px; }
}
.sigil.at-right { left: 260px; }
.sigil.at-left  { left: 16px; }
.rune-tablet.pressing .sigil {
  transform: translateY(1px);
  transition: transform 100ms ease-out;
}
.sigil::before {
  content: '';
  position: absolute;
  inset: 4px;
  background-image: radial-gradient(circle at 50% 50%, transparent 0%, transparent 35%, rgba(70,40,15,0.4) 36%, rgba(70,40,15,0.4) 37%, transparent 38%);
  border-radius: 4px;
  opacity: 0.5;
  pointer-events: none;
}
.iq-glyph {
  position: relative;
  z-index: 3;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(40,20,5,0.9);
  text-shadow: 0 -1px 0 rgba(60,35,10,0.8);
  transition: color 1000ms ease, text-shadow 1000ms ease;
}
.iq-glyph.ice {
  color: #c8e4ff;
  animation: glyph-ice-modal 5s ease-in-out infinite;
}
@keyframes glyph-ice-modal {
  0%, 100% { text-shadow: 0 -1px 0 rgba(20,40,70,0.6), 0 0 4px rgba(180,220,255,1), 0 0 10px rgba(120,190,255,0.95), 0 0 18px rgba(80,160,240,0.8), 0 0 28px rgba(60,140,230,0.6); }
  50%      { text-shadow: 0 -1px 0 rgba(20,40,70,0.6), 0 0 5px rgba(200,230,255,1), 0 0 14px rgba(140,200,255,1), 0 0 22px rgba(90,170,245,0.9), 0 0 34px rgba(70,150,235,0.65); }
}
.iq-glyph.fire {
  color: #ffb070;
  animation: glyph-fire-modal 2.6s ease-in-out infinite;
}
@keyframes glyph-fire-modal {
  0%, 100% { text-shadow: 0 -1px 0 rgba(70,20,5,0.6), 0 0 4px rgba(255,150,70,1), 0 0 10px rgba(245,90,30,0.95), 0 0 18px rgba(220,60,20,0.85), 0 0 28px rgba(190,50,15,0.65); }
  50%      { text-shadow: 0 -1px 0 rgba(70,20,5,0.6), 0 0 6px rgba(255,170,90,1), 0 0 16px rgba(250,110,40,1), 0 0 26px rgba(230,70,25,0.95), 0 0 38px rgba(200,55,18,0.7); }
}

/* Particles */
.rune-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 4;
}
.rune-particle {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
}
.rune-particle.frost {
  width: 3px;
  height: 3px;
  background: rgba(220,240,255,1);
  box-shadow: 0 0 6px rgba(140,200,255,0.95), 0 0 12px rgba(100,180,250,0.55);
}
.rune-particle.frost.commit {
  animation: frost-burst 900ms ease-out forwards;
}
@keyframes frost-burst {
  0%   { opacity: 0; transform: translate(0,0) scale(0.4); }
  15%  { opacity: 1; transform: translate(calc(var(--dx)*0.45), calc(var(--dy)*0.45)) scale(1.4); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.2); }
}
.rune-particle.frost.drift {
  animation: frost-drift 3.2s ease-out forwards;
}
@keyframes frost-drift {
  0%   { opacity: 0; transform: translateY(0) scale(0.5); }
  25%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-45px) translateX(var(--dx, 0)) scale(0.2); background: rgba(120,180,240,0); }
}
.rune-particle.ember {
  width: 3px;
  height: 3px;
  background: rgba(255,220,120,1);
  box-shadow: 0 0 6px rgba(255,140,60,0.95), 0 0 12px rgba(245,80,30,0.55);
}
.rune-particle.ember.commit {
  animation: ember-burst 750ms ease-out forwards;
}
@keyframes ember-burst {
  0%   { opacity: 0; transform: translate(0,0) scale(0.4); }
  15%  { opacity: 1; transform: translate(calc(var(--dx)*0.5), calc(var(--dy)*0.5)) scale(1.3); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.2); background: rgba(180,40,15,0); }
}
.rune-particle.ember.drift {
  animation: ember-drift 2.3s ease-out forwards;
}
@keyframes ember-drift {
  0%   { opacity: 0; transform: translateY(0) scale(0.5); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-40px) translateX(var(--dx, 0)) scale(0.2); background: rgba(200,80,30,0); }
}

/* Mode status */
.rune-mode-status {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 14px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  min-height: 20px;
  transition: color 900ms ease, text-shadow 900ms ease;
  opacity: 0.85;
}
.rune-mode-status.ice { color: #a8c8e8; text-shadow: 0 0 8px rgba(120,190,255,0.3); }
.rune-mode-status.fire { color: #f0a070; text-shadow: 0 0 8px rgba(245,90,30,0.3); }

/* Launch button */
.rune-launch-frame { position: relative; width: 320px; margin-top: 4px; }
.rune-launch-button {
  position: relative;
  width: 100%;
  height: 72px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  overflow: visible;
  transition: transform 200ms ease, box-shadow 800ms ease;
  background: linear-gradient(135deg, #1f1a16 0%, #2a2520 50%, #14100d 100%);
  color: rgba(40,20,5,0.85);
  will-change: transform;
}
.rune-launch-button::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 6px;
  border: 1px solid rgba(120,90,40,0.4);
  pointer-events: none;
  transition: border-color 900ms ease, box-shadow 900ms ease;
}
.rune-launch-button.ice {
  color: #d8ecff;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.7), 0 0 4px rgba(180,220,255,0.9), 0 0 12px rgba(120,190,255,0.7);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.7), inset 0 0 32px rgba(60,140,230,0.18), 0 4px 16px rgba(0,0,0,0.6), 0 0 24px rgba(80,160,240,0.25);
  animation: launch-pulse-ice 4s ease-in-out infinite;
}
.rune-launch-button.ice::before {
  border-color: rgba(140,200,255,0.5);
  box-shadow: inset 0 0 12px rgba(80,160,240,0.4);
}
@keyframes launch-pulse-ice {
  0%, 100% { box-shadow: inset 0 2px 4px rgba(0,0,0,0.7), inset 0 0 32px rgba(60,140,230,0.18), 0 4px 16px rgba(0,0,0,0.6), 0 0 24px rgba(80,160,240,0.25); }
  50%      { box-shadow: inset 0 2px 4px rgba(0,0,0,0.7), inset 0 0 40px rgba(80,160,240,0.25), 0 4px 16px rgba(0,0,0,0.6), 0 0 32px rgba(100,180,250,0.32); }
}
.rune-launch-button.fire {
  color: #ffd098;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.7), 0 0 4px rgba(255,160,80,0.95), 0 0 12px rgba(245,90,30,0.75);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.7), inset 0 0 32px rgba(200,60,20,0.22), 0 4px 16px rgba(0,0,0,0.6), 0 0 24px rgba(220,80,30,0.3);
  animation: launch-pulse-fire 2.4s ease-in-out infinite;
}
.rune-launch-button.fire::before {
  border-color: rgba(255,140,70,0.55);
  box-shadow: inset 0 0 14px rgba(220,80,30,0.5);
}
@keyframes launch-pulse-fire {
  0%, 100% { box-shadow: inset 0 2px 4px rgba(0,0,0,0.7), inset 0 0 32px rgba(200,60,20,0.22), 0 4px 16px rgba(0,0,0,0.6), 0 0 24px rgba(220,80,30,0.3); }
  50%      { box-shadow: inset 0 2px 4px rgba(0,0,0,0.7), inset 0 0 44px rgba(230,90,35,0.32), 0 4px 16px rgba(0,0,0,0.6), 0 0 38px rgba(245,110,50,0.42); }
}
.rune-launch-button:hover { transform: translateY(-2px); }
.rune-launch-button:active { transform: translateY(1px) scale(0.98); transition: transform 80ms ease-out; }
.rune-launch-button.recoil { animation: launch-recoil 650ms cubic-bezier(0.22, 0.78, 0.32, 1) !important; }
@keyframes launch-recoil {
  0%   { transform: translateY(0) scale(1); }
  8%   { transform: translateY(3px) scale(0.96); }
  25%  { transform: translateY(-8px) scale(1.04); }
  45%  { transform: translateY(2px) scale(0.99); }
  65%  { transform: translateY(-2px) scale(1.01); }
  85%  { transform: translateY(1px) scale(1.00); }
  100% { transform: translateY(0) scale(1); }
}
.rune-launch-particles {
  position: absolute;
  inset: -30px;
  pointer-events: none;
  overflow: visible;
  z-index: 5;
}
