.random-hero {
  position: relative;
  min-height: 560px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: #061c36;
  color: #fff;
}
.random-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg,rgba(4,18,42,.98) 0%,rgba(4,18,42,.83) 39%,rgba(4,18,42,.07) 72%); }
.random-hero-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.random-hero-content { position: relative; z-index: 1; padding-block: 60px; }
.random-breadcrumbs { margin-bottom: 24px; color: #d9e7f3; font-size: 12px; font-weight: 800; }
.random-breadcrumbs a { color: #fff; }
.random-hero .eyebrow { color: var(--mint); }
.random-hero h1 { max-width: 750px; margin: 7px 0 18px; font-size: clamp(46px,6vw,76px); line-height: 1.12; }
.random-hero p:not(.eyebrow) { max-width: 620px; margin: 0 0 28px; font-size: 17px; font-weight: 700; }
.random-hero .button { background: var(--yellow); color: var(--ink); }

.random-band { padding: 72px 0 82px; background: #eff5f7; }
.tools-heading { display: grid; grid-template-columns: minmax(0,1fr) minmax(290px,450px); gap: 48px; align-items: end; margin-bottom: 32px; }
.tools-heading h2 { margin: 0; font-size: clamp(34px,4vw,50px); line-height: 1.2; }
.tools-heading > p { margin: 0; color: var(--ink-soft); }
.random-tools-grid { display: grid; grid-template-columns: minmax(300px,.78fr) minmax(0,1.22fr); gap: 20px; align-items: start; }
.random-tool { min-width: 0; overflow: hidden; background: #fff; border: 1px solid #cad8dc; border-radius: 6px; box-shadow: 0 16px 34px rgba(16,37,45,.08); }
.tool-heading { display: flex; align-items: center; gap: 13px; padding: 22px 24px; background: #102f3b; color: #fff; }
.tool-number { display: grid; place-items: center; width: 40px; height: 34px; flex: 0 0 auto; border: 1px solid #a36e00; background: var(--yellow); color: var(--ink); font-size: 11px; font-weight: 950; }
.tool-heading p { margin: 0 0 1px; color: var(--mint); font-size: 9px; font-weight: 950; }
.tool-heading h2 { margin: 0; font-size: 24px; line-height: 1.25; }
.random-tool form { padding: 24px; }
.number-tool form > label { display: block; }
.number-tool form > label > span:first-child { display: block; margin-bottom: 7px; color: #53666d; font-size: 12px; font-weight: 900; }
.number-input { display: flex; align-items: baseline; gap: 10px; border-bottom: 3px solid #a9bbb8; }
.number-input:focus-within { border-color: var(--mint-dark); }
.number-input b { flex: 0 0 auto; color: #5d6e74; font-size: 18px; }
.number-input input { width: 100%; min-width: 0; padding: 4px 0 8px; border: 0; outline: 0; background: transparent; color: var(--ink); text-align: right; font-size: 38px; font-weight: 950; font-variant-numeric: tabular-nums; }
.number-presets { display: grid; grid-template-columns: repeat(4,1fr); gap: 6px; margin-top: 14px; }
.number-presets button { min-height: 39px; border: 1px solid #bdccc9; background: #f7faf9; color: var(--ink); cursor: pointer; font-size: 12px; font-weight: 900; }
.number-presets button.selected { border-color: #0e725c; background: #dcfff4; color: #075746; }
.validation-message { min-height: 24px; margin: 0; padding-top: 5px; color: #b3271d; font-size: 11px; font-weight: 800; }
.draw-button { width: 100%; min-height: 55px; border: 2px solid var(--ink); background: var(--yellow); color: var(--ink); box-shadow: 4px 4px 0 var(--ink); cursor: pointer; font-size: 16px; font-weight: 950; }
.draw-button.coral { background: #ff786c; }
.draw-button:active { transform: translate(2px,2px); box-shadow: 2px 2px 0 var(--ink); }
.draw-button:disabled { cursor: wait; opacity: .7; }
.number-result { position: relative; display: grid; place-items: center; min-height: 240px; padding: 28px; overflow: hidden; background: #0b3944; color: #fff; text-align: center; }
.number-result::before { content: ""; position: absolute; width: 220px; height: 220px; border: 30px solid rgba(99,230,190,.1); border-radius: 50%; }
.number-result > * { position: relative; z-index: 1; }
.number-result span { align-self: end; color: var(--mint); font-size: 11px; font-weight: 950; }
.number-result strong { max-width: 100%; color: var(--yellow); font-size: clamp(68px,9vw,112px); line-height: 1; font-variant-numeric: tabular-nums; overflow-wrap: normal; word-break: normal; }
.number-result small { align-self: start; color: #d5e6e9; font-weight: 800; }
.number-result.drawing strong,.item-result.drawing strong { animation: result-pulse .11s linear infinite alternate; }
@keyframes result-pulse { to { transform: scale(1.06); opacity: .68; } }
.history-block { padding: 19px 24px 24px; border-top: 1px solid #d6e0e2; }
.history-block > div { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.history-block h3 { margin: 0; font-size: 14px; }
.history-block button { padding: 5px 0; border: 0; background: transparent; color: #566b72; cursor: pointer; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; }
.number-history,.item-history { display: flex; flex-wrap: wrap; gap: 7px; margin: 13px 0 0; padding: 0; list-style: none; }
.number-history li { display: grid; place-items: center; min-width: 38px; height: 34px; padding: 0 9px; border: 1px solid #a8c3bd; background: #ebf8f4; color: #075f4c; font-size: 13px; font-weight: 950; }
.history-block .empty-history { width: 100%; height: auto; padding: 8px 0; border: 0; background: transparent; color: #7b8b90; font-size: 11px; font-weight: 700; }

.candidate-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.candidate-head label { color: #53666d; font-size: 12px; font-weight: 900; }
.candidate-head span { flex: 0 0 auto; padding: 3px 8px; background: #e9f4f1; color: #186650; font-size: 10px; font-weight: 900; }
.candidate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.candidate-row { display: grid; grid-template-columns: 25px minmax(0,1fr) 34px; align-items: center; min-width: 0; border: 1px solid #ccd9dc; background: #f8fafb; }
.candidate-row > span { display: grid; place-items: center; height: 100%; background: #e8f0f2; color: #5b7077; font-size: 10px; font-weight: 950; }
.candidate-row input { width: 100%; min-width: 0; height: 43px; padding: 8px; border: 0; outline: 0; background: #fff; font-size: 13px; font-weight: 800; }
.candidate-row:focus-within { border-color: #0b755d; box-shadow: 0 0 0 2px rgba(99,230,190,.25); }
.candidate-row.winner { border-color: #c88900; background: #fff7d6; box-shadow: inset 4px 0 var(--yellow); }
.candidate-row.winner input { background: #fff7d6; }
.remove-candidate { width: 34px; height: 43px; border: 0; border-left: 1px solid #d5dfe1; background: transparent; color: #63767d; cursor: pointer; font-size: 17px; }
.candidate-actions { display: flex; gap: 8px; margin-top: 12px; }
.candidate-actions button { min-height: 39px; border: 1px solid #b9c9c6; background: #fff; color: var(--ink); cursor: pointer; font-size: 11px; font-weight: 900; }
.add-button { flex: 1; }
.add-button span { margin-right: 4px; font-size: 16px; }
.clear-button { padding-inline: 13px; }
.candidate-actions button:disabled { cursor: not-allowed; opacity: .45; }
.item-result { margin: 0 24px; padding: 25px 22px; border-left: 6px solid var(--coral); background: #fff4e4; text-align: center; }
.item-result span,.item-result small { display: block; color: #6d6358; font-size: 10px; font-weight: 900; }
.item-result strong { display: block; max-width: 100%; margin: 5px 0; color: #9d2f26; font-size: clamp(25px,4vw,42px); line-height: 1.25; overflow-wrap: anywhere; }
.item-history li { max-width: 100%; padding: 6px 10px; border-left: 3px solid var(--coral); background: #fff3e8; color: #72352f; font-size: 11px; font-weight: 900; overflow-wrap: anywhere; }
.item-history li:first-child:not(.empty-history) { background: #ffe0d9; }

.guide-grid { display: grid; grid-template-columns: minmax(240px,.7fr) minmax(0,1fr); gap: 60px; align-items: start; }
.guide-points { border-top: 2px solid var(--ink); }
.guide-points section { display: grid; grid-template-columns: 205px 1fr; gap: 22px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.guide-points strong { color: #0c705b; }
.guide-points p { margin: 0; }

@media (max-width: 900px) {
  .random-tools-grid { grid-template-columns: 1fr; }
  .number-tool { display: grid; grid-template-columns: minmax(300px,.8fr) minmax(0,1.2fr); }
  .number-tool .tool-heading,.number-tool .history-block { grid-column: 1 / -1; }
  .number-tool form { border-right: 1px solid #d4e0e2; }
}

@media (max-width: 700px) {
  .random-hero { min-height: 500px; align-items: flex-end; }
  .random-hero::after { background: linear-gradient(0deg,rgba(4,18,42,.98) 0%,rgba(4,18,42,.73) 60%,rgba(4,18,42,.05) 100%); }
  .random-hero-image { object-position: 70% center; }
  .random-hero-content { padding-block: 34px; }
  .random-hero h1 { font-size: 41px; }
  .random-hero p:not(.eyebrow) { max-width: 350px; font-size: 14px; }
  .random-band { padding: 48px 0 56px; }
  .tools-heading { grid-template-columns: 1fr; gap: 14px; }
  .tools-heading h2 { font-size: 32px; }
  .number-tool { display: block; }
  .number-tool form { border-right: 0; }
  .guide-grid { grid-template-columns: 1fr; gap: 26px; }
}

@media (max-width: 520px) {
  .random-hero { min-height: 480px; }
  .random-hero h1 { font-size: 36px; }
  .tool-heading { padding: 19px 17px; }
  .tool-heading h2 { font-size: 21px; }
  .random-tool form { padding: 19px 15px; }
  .history-block { padding: 17px 15px 20px; }
  .candidate-grid { grid-template-columns: 1fr; }
  .candidate-row input { font-size: 15px; }
  .item-result { margin: 0 15px; }
  .guide-points section { grid-template-columns: 1fr; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .number-result.drawing strong,.item-result.drawing strong { animation: none; }
}
