.diceware-page {
  max-width: none;
  width: 100%;
  margin: 0 0 3rem;
  padding-left: 0;
  padding-right: 0;
  box-sizing: border-box;
  color: #e0e0e0;
}

.page-content.diceware-page {
  padding-left: 0;
  padding-right: 0;
}

.diceware-page > p,
.diceware-page > section {
  margin-bottom: 1.5rem;
}

.diceware-warning {
  padding: 0.85rem 1rem;
  color: #f5dfb2;
  background: #241d12;
  border: 1px solid #785f34;
  border-radius: 6px;
}

.diceware-distinction {
  padding: 0.85rem 1rem;
  background: #1a1a1a;
  border-left: 3px solid #bb86fc;
}

.diceware-distinction p {
  margin: 0.35rem 0;
}

.dice-tool {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
}

.dice-tool h2 {
  margin: 0 0 0.45rem;
  color: #f1f1f1;
  font-size: 1.4rem;
}

.dice-tool > p {
  margin-top: 0;
  color: #c7c7c7;
}

.dice-form fieldset {
  margin: 1rem 0;
  padding: 0;
  border: 0;
}

.dice-form legend,
.dice-label {
  display: block;
  margin-bottom: 0.45rem;
  color: #f1f1f1;
  font-weight: 600;
}

.dice-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.1rem;
}

.dice-options label {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.dice-options input {
  width: 18px;
  height: 18px;
  accent-color: #bb86fc;
}

.dice-label-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}

.dice-roll-count {
  color: #d1b6fc;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-weight: 600;
  white-space: nowrap;
}

.dice-form textarea,
.dice-form select {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 0.7rem 0.75rem;
  color: #f4f4f4;
  background: #121212;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  font: inherit;
}

.dice-form textarea {
  min-height: 125px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  line-height: 1.7;
  letter-spacing: 0.06em;
}

.dice-form textarea:focus,
.dice-form select:focus {
  outline: none;
  border-color: #bb86fc;
  box-shadow: 0 0 0 2px rgba(187, 134, 252, 0.18);
}

.dice-help,
.dice-groups,
.dice-environment {
  margin: 0.55rem 0 0;
  color: #aaa;
  font-size: 0.9rem;
}

.dice-groups {
  max-height: 5.2rem;
  overflow: auto;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.dice-environment {
  padding: 0.65rem 0.75rem;
  border: 1px solid #444;
  border-radius: 6px;
}

.dice-environment--local {
  color: #b8dfbf;
  background: #142019;
  border-color: #45664d;
}

.dice-environment--online {
  color: #f5dfb2;
  background: #241d12;
  border-color: #785f34;
}

.dice-actions,
.dice-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.dice-button,
.dice-download {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0.6rem 0.9rem;
  color: #f4f4f4;
  background: #2d2d2d;
  border: 1px solid #454545;
  border-radius: 6px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.dice-button:hover,
.dice-button:focus-visible,
.dice-download:hover,
.dice-download:focus-visible {
  color: #fff;
  background: #383838;
  border-color: #bb86fc;
  outline: none;
  text-decoration: underline;
}

.dice-button--primary {
  color: #171219;
  background: #bb86fc;
  border-color: #bb86fc;
}

.dice-button--primary:hover,
.dice-button--primary:focus-visible {
  color: #171219;
  background: #d1b6fc;
}

.dice-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dice-status {
  margin: 1rem 0 0;
  padding: 0.7rem 0.8rem;
  color: #e8e8e8;
  background: #202020;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
}

.dice-status--error {
  color: #ffb6bd;
  background: #281619;
  border-color: #7e3b44;
}

.dice-status--warning {
  color: #f5dfb2;
  background: #241d12;
  border-color: #785f34;
}

.dice-status--ready {
  color: #d8c4f0;
  background: #241b2d;
  border-color: #6f5387;
}

.dice-status--success {
  color: #b8dfbf;
  background: #142019;
  border-color: #45664d;
}

.dice-result {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid #444;
}

.dice-result h3 {
  margin: 0 0 0.35rem;
  color: #f1f1f1;
  font-size: 1.1rem;
}

.dice-result p {
  margin-top: 0;
}

.dice-word-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
}

.dice-word-list li {
  display: grid;
  grid-template-columns: 1.8rem minmax(0, 1fr);
  gap: 0.25rem;
  padding: 0.5rem;
  overflow-wrap: anywhere;
  background: #121212;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.dice-word-number {
  color: #888;
}

.dice-result.is-concealed .dice-word-list {
  filter: blur(9px);
  user-select: none;
}

.diceware-notes h2 {
  margin-top: 1.6rem;
  font-size: 1.35rem;
}

.diceware-notes li {
  margin-bottom: 0.55rem;
}

.dice-hash {
  display: block;
  margin-top: 0.6rem;
  padding: 0.7rem;
  overflow-wrap: anywhere;
  color: #ddd;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 650px) {
  .dice-tool {
    padding: 1rem;
  }

  .dice-word-list {
    grid-template-columns: 1fr;
  }

  .dice-actions .dice-button,
  .dice-result-actions .dice-button,
  .dice-download {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
