/* ── Dice panel ──────────────────────────────────────────────────────────────── */

/* Layout pro panel kostek */
.dice-panel-top-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (min-width: 768px) {
  .dice-panel-top-grid.gm-layout {
    grid-template-columns: 2fr 1fr;
  }
}

.dice-presets-layout {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.dice-preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.5rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  flex: 1;
  min-width: 60px;
  --bg-die-dot: var(--bg3);
}
.dice-preset-btn:hover {
  background: var(--bg2);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.2);
  --bg-die-dot: var(--bg2);
}
.dice-preset-btn:active {
  transform: scale(0.95);
}

.preset-icon-container {
  display: flex;
  gap: 4px;
  font-size: 1.25rem;
  line-height: 1;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.2rem;
  height: 22px;
}

/* SVG dice presets */
.die-icon {
  transition: var(--transition);
}
.preset-2k6 {
  color: var(--text);
}
.preset-3k6-dis {
  border-color: rgba(239, 68, 68, 0.25);
}
.preset-3k6-dis:hover {
  border-color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}
.preset-3k6-dis .die-white {
  color: var(--text);
}
.preset-3k6-dis .die-sad {
  color: #ef4444;
}

.preset-3k6-adv {
  border-color: rgba(234, 179, 8, 0.25);
}
.preset-3k6-adv:hover {
  border-color: #eab308;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.2);
}
.preset-3k6-adv .die-white {
  color: var(--text);
}
.preset-3k6-adv .die-happy {
  color: #eab308;
}

.preset-3k6-presne {
  border-color: rgba(6, 182, 212, 0.25);
}
.preset-3k6-presne:hover {
  border-color: #06b6d4;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}
.preset-3k6-presne .die-white {
  color: var(--text);
}
.preset-3k6-presne .die-happy {
  color: #06b6d4;
}

.preset-1k100 {
  color: var(--accent2);
  border-color: rgba(167, 139, 250, 0.25);
}
.preset-1k100:hover {
  border-color: var(--accent2);
}

.preset-text {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
}

/* Ignorovaná kostka v logu */
.die-val.die-ignored {
  opacity: 0.35;
  text-decoration: line-through;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  box-shadow: none;
}

.dice-custom-row {
  display: flex;
  gap: .5rem;
}
.dice-custom-row input {
  flex: 1;
  font-family: monospace;
}
.dice-custom-row .btn-primary {
  margin-top: 0;
  white-space: nowrap;
  padding: .65rem 1.1rem;
}

.dice-context-row {
  margin-top: .5rem;
}

/* Log */
.dice-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .6rem;
}

#dice-log {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  max-height: 50vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.dice-entry {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .5rem .75rem;
  transition: border-color .2s;
}
.dice-entry.mine   { border-left: 3px solid var(--accent2); }
.dice-entry.theirs { border-left: 3px solid var(--bg3); }

.roll-top {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  margin-bottom: .25rem;
}
.roll-who     { font-weight: 700; font-size: .85rem; }
.roll-context {
  background: var(--bg3);
  color: var(--text-dim);
  font-size: .75rem;
  padding: .1rem .4rem;
  border-radius: 4px;
}
.roll-expr    { font-family: monospace; font-size: .8rem; color: var(--text-dim); }
.roll-time    { margin-left: auto; font-size: .75rem; color: var(--text-dim); }

.roll-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.roll-dice {
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-wrap: wrap;
}
.die-val {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.8rem;
  height: 1.8rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-weight: 700;
  font-size: .95rem;
}
/* Kritické zabarvení jednotlivých kostek bylo zrušeno */
.die-mod  { font-size: .9rem; color: var(--text-dim); font-family: monospace; }

.roll-total {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--accent2);
  min-width: 2.5rem;
  text-align: right;
  line-height: 1;
}

/* Kritické hody */
.dice-entry.crit-max {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  box-shadow: 0 0 8px 1px rgba(16, 185, 129, 0.2);
}
.dice-entry.crit-max .roll-total { color: #10b981; }

.dice-entry.crit-min {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  box-shadow: 0 0 8px 1px rgba(239, 68, 68, 0.25);
}
.dice-entry.crit-min .roll-total { color: #ef4444; }

.dice-crit-label {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .8rem;
  color: var(--text-dim);
  cursor: pointer;
  margin-top: .6rem;
  user-select: none;
}
.dice-crit-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent2);
  cursor: pointer;
}
@keyframes rollIn {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
.dice-entry.mine,
.dice-entry.theirs {
  animation: rollIn .18s ease;
}

/* Oddělovač logu */
.dice-log-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 0.8rem 0;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  gap: 1rem;
  animation: rollIn .18s ease;
}
.dice-log-divider::before,
.dice-log-divider::after {
  content: '';
  flex: 1;
  border-bottom: 2px dashed rgba(167, 139, 250, 0.4);
}
.dice-log-divider-label {
  background: var(--bg2);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  border: 1px solid rgba(167, 139, 250, 0.2);
  box-shadow: var(--shadow);
}

/* Tlačítko pro vymazání logu a příslušný potvrzovací prvek */
.btn-danger {
  background: #dc2626;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  margin-top: 0;
}
.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.3);
}
.btn-danger:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.dice-clear-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  border-top: 1px dashed var(--border);
  padding-top: 0.75rem;
}
.dice-clear-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.dice-clear-label input[type="checkbox"] {
  width: 0.95rem;
  height: 0.95rem;
  accent-color: #dc2626;
  cursor: pointer;
}

/* Kompaktní ovládací řádek - symetrické rozvržení */
.dice-controls-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.dice-modifier-select {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.35rem 0.5rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  font-size: 0.8rem;
  text-align: center;
  text-align-last: center;
  flex: 1;
  min-width: 60px;
  transition: var(--transition);
  height: 32px;
  box-sizing: border-box;
}
.dice-modifier-select:hover {
  background: var(--bg2);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.15);
}
.dice-modifier-select:focus {
  border-color: var(--accent);
}

.dice-control-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.5rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  flex: 1;
  min-width: 80px;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 600;
  text-align: center;
  user-select: none;
  height: 32px;
  box-sizing: border-box;
}
.dice-control-label input[type="checkbox"] {
  display: none; /* Skryjeme ošklivý nativní checkbox */
}
.dice-control-label:hover {
  background: var(--bg2);
  border-color: var(--accent);
  color: var(--text);
}

/* Aktivní / zaškrtnutý stav toggle tlačítek */
.dice-control-label:has(input:checked) {
  background: rgba(167, 139, 250, 0.15);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.15);
}

/* Zelený nádech pro aktivované kritické hody */
.dice-control-label:has(#dice-crit-check:checked) {
  background: rgba(16, 185, 129, 0.12);
  border-color: #10b981;
  color: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.1);
}

/* Custom tooltip for custom roll input */
.dice-expr-tooltip {
  position: absolute;
  z-index: 10000;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  max-width: 320px;
  color: var(--text);
  font-size: 0.85rem;
  pointer-events: none;
  animation: fadeIn 0.2s ease;
}

.dice-expr-tooltip .tooltip-title {
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
}

.dice-expr-tooltip .tooltip-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.dice-expr-tooltip .tooltip-list li {
  line-height: 1.35;
}

.dice-expr-tooltip .tooltip-list code {
  background: var(--bg3);
  padding: 0.1rem 0.25rem;
  border-radius: 3px;
  color: var(--accent2);
  font-family: monospace;
}

