/* ===== Wykresy kolowe: plynnosc + holderzy ===== */

.pie-block {
  display: none;
  position: relative;
  z-index: 6;
  grid-template-columns: minmax(240px, 340px) 1fr;
  gap: 22px;
  align-items: start;
  margin: 6px 0 20px;
  padding: 18px;
  border-radius: 18px;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(0, 255, 65, 0.07) 0%, rgba(0, 0, 0, 0) 55%),
    linear-gradient(160deg, rgba(10, 16, 24, 0.92), rgba(6, 10, 16, 0.86));
  border: 1px solid rgba(0, 255, 65, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 18px 40px -28px rgba(0, 255, 65, 0.4);
  animation: pieBlockIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes pieBlockIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.pie-canvas-wrap {
  position: relative;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pie-canvas-wrap::after {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 255, 65, 0.10) 0%, rgba(0, 0, 0, 0) 68%);
  filter: blur(6px);
  pointer-events: none;
  animation: piePulse 4.5s ease-in-out infinite;
}

@keyframes piePulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.04); }
}

.pie-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  max-width: 46%;
}

.pie-center-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: #00ff41;
  text-shadow: 0 0 18px rgba(0, 255, 65, 0.45);
  line-height: 1.1;
}

.pie-center-label {
  display: block;
  margin-top: 4px;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8b9aa7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pie-pop { animation: piePop 0.45s cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes piePop {
  0%   { transform: translate(-50%, -50%) scale(0.86); opacity: 0.4; }
  60%  { transform: translate(-50%, -50%) scale(1.05); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.pie-side { min-width: 0; }

.pie-side-title {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7f8f9c;
  margin-bottom: 10px;
}

.pie-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 168px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.pie-legend::-webkit-scrollbar { width: 6px; }
.pie-legend::-webkit-scrollbar-thumb { background: rgba(0, 255, 65, 0.25); border-radius: 6px; }

.pie-legend-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.02);
  color: #d7e3ea;
  font: inherit;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.pie-legend-item:hover {
  background: rgba(0, 255, 65, 0.08);
  border-color: rgba(0, 255, 65, 0.28);
  transform: translateX(3px);
}

.pie-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 10px;
  box-shadow: 0 0 8px currentColor;
}

.pie-legend-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pie-legend-val { color: #00ffff; font-weight: 600; font-variant-numeric: tabular-nums; }

.pie-detail { margin-top: 12px; min-height: 60px; }

.pie-detail-hint { font-size: 0.78rem; color: #5f6d78; }

.pie-fade { animation: pieFade 0.35s ease both; }

@keyframes pieFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.pie-detail-card {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(0, 255, 255, 0.16);
  background: linear-gradient(150deg, rgba(0, 255, 255, 0.05), rgba(0, 0, 0, 0.25));
}

.pie-detail-head {
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  font-size: 0.92rem;
  word-break: break-word;
}

.pie-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  font-size: 0.82rem;
  color: #93a3b0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.pie-detail-row:last-of-type { border-bottom: none; }
.pie-detail-row b { color: #e8f3f7; font-variant-numeric: tabular-nums; text-align: right; }
.pie-detail-row b.pie-accent { color: #00ff41; }

.pie-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.pie-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 255, 65, 0.4);
  background: rgba(0, 255, 65, 0.12);
  color: #00ff41;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.pie-btn:hover { background: rgba(0, 255, 65, 0.22); box-shadow: 0 0 16px -4px rgba(0, 255, 65, 0.6); }

.pie-detail-link {
  display: inline-block;
  font-size: 0.78rem;
  color: #00ffff;
  text-decoration: none;
  border-bottom: 1px dotted rgba(0, 255, 255, 0.5);
}

.pie-detail-link:hover { color: #fff; }

@media (max-width: 860px) {
  .pie-block {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px;
    background: linear-gradient(160deg, rgba(8, 13, 20, 0.98), rgba(4, 7, 12, 0.98));
  }
  .pie-canvas-wrap { min-height: 220px; }
  .pie-legend { max-height: 132px; }
}

@media (prefers-reduced-motion: reduce) {
  .pie-block, .pie-pop, .pie-fade { animation: none; }
  .pie-canvas-wrap::after { animation: none; }
}

/* ===== v2: token icons, 24h change, deeper 3D stage ===== */

.pie-canvas-wrap {
  min-height: 300px;
  filter: drop-shadow(0 26px 34px rgba(0, 0, 0, 0.65));
}

/* elliptical "table" the 3D ring stands on */
.pie-canvas-wrap::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: 78%;
  height: 22%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 255, 65, 0.22) 0%, rgba(0, 255, 65, 0.06) 45%, rgba(0, 0, 0, 0) 72%);
  filter: blur(10px);
  pointer-events: none;
  animation: pieStage 6s ease-in-out infinite;
}

@keyframes pieStage {
  0%, 100% { opacity: 0.6; transform: translateX(-50%) scaleX(1); }
  50%      { opacity: 1;   transform: translateX(-50%) scaleX(1.06); }
}

.pie-legend-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex: 0 0 20px;
  object-fit: cover;
  background: #05090f;
  border: 1px solid rgba(255, 255, 255, 0.16);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.pie-legend-item:hover .pie-legend-icon {
  transform: rotateY(360deg) scale(1.18);
  box-shadow: 0 0 12px rgba(0, 255, 65, 0.7);
}

.pie-chg {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.78rem;
}

.pie-chg.up {
  color: #00ff41;
  background: rgba(0, 255, 65, 0.12);
  border: 1px solid rgba(0, 255, 65, 0.3);
}

.pie-chg.down {
  color: #ff5b5b;
  background: rgba(255, 68, 68, 0.12);
  border: 1px solid rgba(255, 68, 68, 0.3);
}

@media (max-width: 860px) {
  .pie-canvas-wrap { min-height: 250px; }
}

@media (prefers-reduced-motion: reduce) {
  .pie-canvas-wrap::before { animation: none; }
  .pie-legend-item:hover .pie-legend-icon { transform: none; }
}

/* mobile legend: keep the percentage column fully visible */
@media (max-width: 860px) {
  .pie-legend-item { gap: 6px; padding: 6px 8px; font-size: 0.8rem; }
  .pie-legend-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pie-legend-val { flex: 0 0 auto; margin-left: auto; }
  .pie-legend-icon { width: 18px; height: 18px; }
}

/* never let the legend push past the panel */
.pie-block { box-sizing: border-box; max-width: 100%; }
.pie-block > * { min-width: 0; }
.pie-legend { min-width: 0; box-sizing: border-box; }
.pie-legend-item { box-sizing: border-box; min-width: 0; }

/* ===== IL calculator: V2 / V3 model switch ===== */
.il-mode-switch {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px; padding: 10px 14px;
}
.il-mode-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1px; color: #9fb2c6; font-weight: 700; }
.il-mode-btns { display: flex; gap: 8px; }
.il-mode-btn {
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    min-width: 108px; cursor: pointer; padding: 7px 14px; border-radius: 10px;
    font-family: 'Rajdhani', sans-serif; font-weight: 800; font-size: 0.95rem; letter-spacing: 0.5px;
    color: #9fb2c6; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.14);
    transition: all 0.18s ease;
}
.il-mode-btn small { font-size: 0.64rem; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; opacity: 0.8; }
.il-mode-btn:hover { color: #fff; border-color: rgba(0,255,65,0.4); }
.il-mode-btn.active {
    color: #04150a; background: linear-gradient(135deg, #00ff41, #00d5ff);
    border-color: transparent; box-shadow: 0 0 18px rgba(0,255,65,0.35);
}

.il-v3-box {
    background: rgba(0,213,255,0.05); border: 1px solid rgba(0,213,255,0.28);
    border-radius: 12px; padding: 12px 14px; margin-bottom: 14px;
}
.il-v3-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.il-v3-grid label { display: block; font-size: 0.8rem; color: #9fe8ff; font-weight: 600; margin-bottom: 4px; }
.il-v3-grid input {
    width: 100%; background: transparent; border: none; border-bottom: 1px solid #666;
    color: #fff; font-size: 1.1rem; padding: 4px; outline: none; font-weight: 700;
}
.il-v3-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.il-v3-presets button {
    cursor: pointer; font-size: 0.74rem; font-weight: 700; padding: 4px 10px; border-radius: 20px;
    color: #9fe8ff; background: rgba(0,213,255,0.1); border: 1px solid rgba(0,213,255,0.35);
    transition: all 0.16s ease;
}
.il-v3-presets button:hover { background: rgba(0,213,255,0.35); color: #fff; }
.il-v3-info { margin-top: 12px; border-top: 1px dashed rgba(255,255,255,0.14); padding-top: 10px; }
.il-v3-line { display: flex; justify-content: space-between; gap: 10px; font-size: 0.82rem; color: #cfe; padding: 2px 0; }
.il-v3-line span { color: #93a4b8; }
.il-v3-line b { font-family: 'Rajdhani', monospace; color: #fff; }
.il-v3-status { margin-top: 8px; font-size: 0.8rem; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.il-inrange { color: #34e2a5; font-weight: 700; }
.il-outrange { color: #ffb347; font-weight: 700; }
.il-v3-fee { color: #93a4b8; }
@media (max-width: 620px) {
    .il-v3-grid { grid-template-columns: 1fr; }
    .il-mode-btns { width: 100%; }
    .il-mode-btn { flex: 1; min-width: 0; }
}
