.dice-shell {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 960px) {
  .dice-shell {
    grid-template-columns: 1fr;
  }
}

.dice-field label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}

#expr {
  width: 100%;
  padding: 12px 14px;
  font-size: 1.05rem;
  border: 1px solid #d7ddeb;
  border-radius: 12px;
  background: #fff;
}

.form-error {
  color: #c62828;
  font-size: 0.9rem;
  margin-top: 4px;
}

.dice-quick {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #e4e8f2;
  border-radius: 12px;
  background: #f9fbff;
}

.dice-quick-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.dice-quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.die-btn {
  border: 1px solid #d7ddeb;
  background: #f3f5fb;
  color: #0b264f;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: none;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.die-btn:hover,
.die-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(11, 87, 208, 0.2);
}

.die-btn.is-active {
  background: linear-gradient(135deg, #0b57d0, #0a46aa);
  color: #fff;
  border-color: #0b57d0;
  box-shadow: 0 10px 26px rgba(11, 87, 208, 0.25);
}

.dice-multi {
  display: flex;
  gap: 8px;
}

.dice-count-btn {
  border: 1px solid #cdd4e5;
  background: #fff;
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  color: #1f2a44;
}

.dice-count-btn.is-active {
  background: #0b57d0;
  border-color: #0b57d0;
  color: #fff;
  box-shadow: 0 8px 20px rgba(11, 87, 208, 0.25);
}

.dice-options {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dice-toggle {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.dice-toggle input {
  margin-top: 4px;
}

.dice-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dice-actions button {
  min-width: 130px;
}

.dice-actions .primary {
  flex: 1 1 160px;
}

.dice-result {
  background: linear-gradient(140deg, #0f172a, #0b57d0);
  color: #fff;
  padding: 18px;
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.dice-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dice-total {
  font-size: clamp(2.4rem, 4vw, 3.4rem);
  font-weight: 800;
  margin: 6px 0;
}

.dice-expr {
  opacity: 0.9;
  margin: 0 0 6px;
}

.dice-meaning {
  opacity: 0.82;
  font-size: 0.95rem;
  margin: 6px 0 0;
}

.dice-share {
  margin-top: 14px;
}

.dice-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dice-share-actions button {
  flex: 1 1 160px;
}

#shareTextPreview {
  font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
  background: #f5f7fb;
  border-radius: 10px;
  padding: 10px;
  margin-top: 10px;
  color: #1f2a44;
}

#statusMsg {
  margin-top: 8px;
  font-weight: 700;
  color: #0b57d0;
}

.dice-break {
  border: 1px solid #e2e7f2;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #f9fbff;
}

.dice-break-heading {
  font-weight: 700;
  margin-bottom: 6px;
}

.dice-break-body {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.die-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 10px;
  background: #e8edfa;
  color: #1b2340;
  font-weight: 700;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.04);
}

.die-chip--more {
  background: #d0d7ef;
  color: #0b57d0;
}

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

.history-item {
  width: 100%;
}

.history-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f7f8fc;
  border: 1px solid #e4e8f2;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
}

.history-button:hover,
.history-button:focus-visible {
  border-color: #0b57d0;
  transform: translateY(-1px);
}

.history-time {
  color: #5b6478;
  font-size: 0.92rem;
}

.history-expr {
  flex: 1;
  text-align: left;
}

.history-total {
  font-weight: 700;
  color: #0b57d0;
}

.dice-steps-list {
  display: grid;
  gap: 8px;
  padding-left: 20px;
  margin: 0;
}

.dice-steps-list strong {
  color: #0b57d0;
}

.muted {
  color: #5b6478;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .dice-share-actions button,
  .dice-actions button {
    flex: 1 1 100%;
  }
}
