:root {
  --bg: #eef6ff;
  --surface: #ffffff;
  --surface-strong: #f8fbff;
  --ink: #17202a;
  --muted: #64717e;
  --line: #d9e3f0;
  --teal: #4a8df7;
  --teal-dark: #2363d8;
  --coral: #ef6ca8;
  --green: #2e7d5b;
  --yellow: #f7bd5e;
  --blue: #6d8cff;
  --violet: #9f7aea;
  --pink: #f4a6d7;
  --sky: #8ec9ff;
  --shadow: 0 22px 58px rgba(54, 85, 148, 0.16);
  --shadow-soft: 0 10px 28px rgba(54, 85, 148, 0.1);
  --focus: 0 0 0 3px rgba(74, 141, 247, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 36% 12%, rgba(250, 190, 236, 0.38), transparent 34%),
    linear-gradient(135deg, #dff0ff 0, #f8e7ff 46%, #edf7ff 100%),
    var(--bg);
  color: var(--ink);
  font-family: "Noto Sans Thai", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.fonts-pending body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
input,
textarea,
select {
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 0;
  box-shadow: var(--focus);
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(239, 247, 255, 0.72)),
    rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid rgba(108, 139, 198, 0.18);
  box-shadow: 18px 0 48px rgba(81, 112, 180, 0.08);
  backdrop-filter: blur(18px);
}

.brand {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #84c2ff, #f3a5d8);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(98, 142, 234, 0.28);
}

.brand h1,
.brand p,
.section-head h2,
.section-head p,
.tool-title,
.tool-desc,
.panel-title h2,
.panel-title p,
.panel-empty h2,
.panel-empty p,
.output h3,
.mini-stat strong,
.mini-stat span {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.2;
}

.brand p {
  color: #6b7890;
  font-size: 13px;
}

.category-list {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.category-button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #54647a;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  text-align: left;
  position: relative;
}

.category-button span:not(.category-count) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-button:hover,
.category-button.is-active {
  background: rgba(255, 255, 255, 0.76);
  color: #1f2a38;
  box-shadow: 0 8px 18px rgba(75, 108, 170, 0.08);
}

.category-button.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--sky), var(--pink));
}

.category-button svg,
.ghost-button svg,
.tool-icon svg,
.search-wrap svg,
.panel-empty svg,
.panel-action svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.category-count {
  min-width: 26px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(103, 145, 241, 0.12);
  color: #315dbe;
  text-align: center;
  font-size: 12px;
}

.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-width: 0;
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(220px, 620px);
  gap: 12px;
  align-items: center;
  padding: 16px 24px;
  background: rgba(244, 249, 255, 0.74);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(115, 146, 203, 0.18);
}

.search-wrap {
  height: 46px;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid rgba(119, 151, 208, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-soft);
}

.search-wrap:focus-within {
  border-color: rgba(0, 124, 137, 0.55);
  box-shadow: var(--focus);
}

.search-wrap input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.ghost-button,
.panel-action,
.copy-button,
.primary-button,
.secondary-button,
.danger-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.primary-button {
  background: var(--teal);
  color: #ffffff;
  border-color: var(--teal);
}

.primary-button:hover {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}

.ghost-button:disabled,
.panel-action:disabled,
.copy-button:disabled,
.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}

.ghost-button:disabled:hover,
.panel-action:disabled:hover,
.copy-button:disabled:hover,
.primary-button:disabled:hover,
.secondary-button:disabled:hover,
.danger-button:disabled:hover {
  border-color: var(--line);
}

.secondary-button:hover,
.ghost-button:hover,
.panel-action:hover,
.copy-button:hover {
  border-color: #aab8c3;
}

.danger-button {
  border-color: rgba(217, 93, 57, 0.24);
  color: var(--coral);
}

.app-hero {
  position: relative;
  min-height: 176px;
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(260px, 0.86fr);
  gap: 18px;
  align-items: center;
  margin: 24px 24px 0;
  padding: 18px 32px;
  overflow: hidden;
  border: 1px solid rgba(125, 156, 218, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(110deg, rgba(207, 231, 255, 0.92) 0%, rgba(246, 230, 255, 0.9) 48%, rgba(211, 238, 255, 0.86) 100%),
    #edf6ff;
  box-shadow: var(--shadow);
}

.seo-fallback {
  margin: 18px 24px 0;
  padding: 16px;
  border: 1px solid rgba(125, 156, 218, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
}

.seo-fallback h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.seo-fallback p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.app-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.64), transparent 54%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 72px);
  pointer-events: none;
}

.hero-copy,
.hero-visual {
  position: relative;
  z-index: 1;
}

.hero-copy {
  display: grid;
  gap: 10px;
  max-width: 520px;
}

.hero-kicker {
  width: fit-content;
  padding: 6px 10px;
  border: 1px solid rgba(72, 115, 210, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  color: #4265b6;
  font-size: 12px;
  font-weight: 800;
}

.hero-copy h2 {
  margin: 0;
  color: #090b28;
  font-size: 40px;
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 440px;
  margin: 0;
  color: #506078;
  font-size: 14px;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 2px;
}

.hero-actions .primary-button,
.hero-actions .secondary-button {
  min-width: 210px;
}

.hero-actions .primary-button {
  border-color: #6ea8ff;
  background: linear-gradient(135deg, #67a5ff, #8b7cf6);
  box-shadow: 0 12px 28px rgba(82, 128, 235, 0.22);
}

.hero-actions .secondary-button {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(119, 151, 208, 0.32);
  color: #33435d;
}

.hero-visual {
  min-height: 150px;
  display: grid;
  place-items: center;
}

.hero-phone {
  position: relative;
  width: min(124px, 36%);
  min-width: 112px;
  aspect-ratio: 0.7;
  padding: 10px 8px 8px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(244, 247, 255, 0.88)),
    #ffffff;
  box-shadow:
    0 24px 52px rgba(96, 112, 180, 0.2),
    inset 0 0 0 1px rgba(104, 139, 218, 0.1);
}

.hero-phone-top {
  display: grid;
  grid-template-columns: 1fr 26px;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.hero-phone-top span,
.hero-widget-search span,
.hero-video-card span,
.hero-mobile-panel span,
.hero-mobile-panel strong {
  display: block;
  border-radius: 8px;
  background: rgba(118, 153, 221, 0.16);
}

.hero-phone-top span {
  height: 9px;
  width: 64%;
}

.hero-phone-top svg {
  width: 22px;
  height: 22px;
  padding: 5px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8f2ff, #ffe6f4);
  color: #85a8e8;
  box-shadow: 0 8px 18px rgba(94, 125, 195, 0.14);
}

.hero-video-card {
  min-height: 44px;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 7px;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
  background: linear-gradient(135deg, #8a74f8, #ee8fcc);
  box-shadow: 0 14px 32px rgba(143, 104, 223, 0.22);
}

.hero-video-card svg {
  width: 24px;
  height: 24px;
  padding: 6px;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.22);
}

.hero-video-card span {
  height: 10px;
  background: rgba(255, 255, 255, 0.28);
}

.hero-control-row {
  display: grid;
  grid-template-columns: 0.75fr 1fr 0.9fr;
  gap: 5px;
  margin: 8px 0;
}

.hero-control-row span {
  height: 22px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(106, 170, 255, 0.8), rgba(143, 125, 249, 0.75));
}

.hero-control-row span:nth-child(2) {
  background: linear-gradient(135deg, rgba(255, 139, 202, 0.82), rgba(247, 188, 94, 0.72));
}

.hero-mobile-panel {
  display: grid;
  gap: 5px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(233, 243, 255, 0.84);
}

.hero-mobile-panel span {
  height: 8px;
  width: 74%;
}

.hero-mobile-panel strong {
  height: 12px;
  width: 52%;
  background: rgba(94, 130, 204, 0.28);
}

.hero-nav {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 7px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  justify-items: center;
  color: #a8b8d7;
}

.hero-nav svg {
  width: 15px;
  height: 15px;
}

.hero-widget,
.hero-gear {
  position: absolute;
  z-index: 2;
}

.hero-widget {
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
  box-shadow: 0 14px 30px rgba(87, 115, 184, 0.12);
  backdrop-filter: blur(10px);
}

.hero-widget-chart {
  left: 7%;
  top: 38%;
  width: 106px;
  height: 40px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: end;
  gap: 8px;
  padding: 10px 12px;
}

.hero-widget-chart span {
  display: block;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #f29bd0, #82bdff);
}

.hero-widget-chart span:nth-child(1) {
  height: 24px;
}

.hero-widget-chart span:nth-child(2) {
  height: 38px;
}

.hero-widget-chart span:nth-child(3) {
  height: 30px;
}

.hero-widget-chart span:nth-child(4) {
  height: 46px;
}

.hero-widget-search {
  right: 5%;
  top: 23%;
  width: 110px;
  height: 30px;
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: #7a98d8;
}

.hero-widget-search span {
  height: 10px;
}

.hero-widget-tools {
  right: 1%;
  bottom: 22%;
  width: 118px;
  height: 32px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  justify-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, rgba(92, 159, 255, 0.72), rgba(150, 126, 245, 0.62));
}

.hero-widget-tools svg {
  width: 17px;
  height: 17px;
}

.hero-gear {
  color: rgba(94, 154, 242, 0.76);
  filter: drop-shadow(0 10px 14px rgba(84, 126, 220, 0.18));
}

.hero-gear-a {
  top: 7%;
  left: 19%;
  width: 34px;
  height: 34px;
}

.hero-gear-b {
  right: 6%;
  bottom: 8%;
  width: 42px;
  height: 42px;
}

.seo-content {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.1fr);
  gap: 22px;
  align-items: start;
  margin: 14px 24px 0;
  padding: 16px 18px;
  border: 1px solid rgba(119, 151, 208, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 14px 34px rgba(66, 96, 156, 0.06);
}

.seo-content[hidden] {
  display: none !important;
}

body.has-active-tool .seo-content,
body.has-wide-tool .seo-content {
  display: none;
}

.seo-kicker {
  display: inline-flex;
  margin-bottom: 4px;
  color: #2563eb;
  font-size: 11px;
  font-weight: 900;
}

.seo-content h2 {
  margin: 0;
  color: #17202a;
  font-size: 18px;
  line-height: 1.32;
}

.seo-content p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.seo-link-grid {
  display: grid;
  gap: 8px;
}

.seo-link-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #536273;
}

.seo-link-head strong {
  color: #233142;
  font-size: 12px;
  font-weight: 900;
}

.seo-link-head span {
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef5ff;
  color: #315dbe;
  font-size: 11px;
  font-weight: 900;
}

.seo-link-primary,
.seo-link-more div {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.seo-link-grid a {
  overflow: hidden;
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: #1f3b57;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seo-link-grid a:hover {
  border-color: rgba(37, 99, 235, 0.28);
  color: #1d4ed8;
}

.seo-link-more {
  min-width: 0;
}

.seo-link-more summary {
  width: max-content;
  min-height: 30px;
  display: flex;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.82);
  color: #536273;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.seo-link-more summary::-webkit-details-marker {
  display: none;
}

.seo-link-more summary::after {
  content: "+";
  margin-left: 7px;
  color: #2563eb;
  font-weight: 900;
}

.seo-link-more[open] summary::after {
  content: "-";
}

.seo-link-more div {
  margin-top: 7px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(380px, 1fr) minmax(380px, 540px);
  gap: 22px;
  padding: 24px;
  align-items: start;
}

body:not(.has-active-tool) .content-grid {
  grid-template-columns: 1fr;
}

body.has-active-tool .content-grid,
body.has-wide-tool .content-grid {
  grid-template-columns: 1fr;
}

body:not(.has-active-tool) .tool-panel {
  display: none;
}

body.has-active-tool .tool-browser,
body.has-wide-tool .tool-browser {
  display: none;
}

body.has-active-tool .app-hero,
body.has-wide-tool .app-hero {
  display: none;
}

.tool-browser,
.tool-panel {
  min-width: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
}

.section-head h2 {
  font-size: 26px;
  line-height: 1.25;
}

.section-head p {
  color: var(--muted);
  font-size: 14px;
}

.result-count {
  min-width: 42px;
  min-height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #ddebf0;
  color: var(--teal-dark);
  font-weight: 700;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.tools-dashboard {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 2px;
}

.tool-shelf {
  min-width: 0;
  display: grid;
  gap: 13px;
  padding: 16px;
  border: 1px solid rgba(119, 151, 208, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
}

.tool-shelf-head {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 11px;
}

.tool-shelf-head h3,
.tool-shelf-head p,
.tool-section-head h3,
.tool-section-head span {
  margin: 0;
}

.tool-shelf-head h3 {
  font-size: 17px;
  line-height: 1.25;
}

.tool-shelf-head p,
.tool-section-head span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.tool-shelf-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(74, 141, 247, 0.14), rgba(239, 108, 168, 0.16));
  color: var(--teal-dark);
}

.tool-shelf-icon svg {
  width: 18px;
  height: 18px;
}

.tool-shelf-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tool-shelf-empty {
  min-height: 132px;
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px dashed rgba(119, 151, 208, 0.38);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.72);
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.tool-section-head {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  padding-top: 10px;
}

.tool-section-head h3 {
  font-size: 20px;
  line-height: 1.25;
}

.tool-card {
  position: relative;
  min-height: 168px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 1px 0 rgba(23, 32, 42, 0.03);
}

.tool-card.is-compact {
  min-height: 142px;
  gap: 9px;
  padding: 14px;
  box-shadow: none;
}

.tool-card:hover,
.tool-card:focus-visible,
.tool-card.is-active {
  border-color: rgba(0, 124, 137, 0.55);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.tool-card.is-active {
  background: linear-gradient(180deg, #ffffff 0, #f2fbfc 100%);
}

.tool-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-right: 35px;
}

.favorite-tool-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(119, 151, 208, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: #8da0b8;
}

.favorite-tool-button:hover,
.favorite-tool-button.is-active {
  border-color: rgba(245, 158, 11, 0.35);
  background: #fff7e6;
  color: #d97706;
}

.favorite-tool-button.is-active svg {
  fill: currentColor;
}

.favorite-tool-button svg {
  width: 17px;
  height: 17px;
}

.tool-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  box-shadow: inset 0 -10px 18px rgba(0, 0, 0, 0.08);
}

.tool-icon.productivity {
  background: var(--teal);
}

.tool-icon.documents {
  background: var(--blue);
}

.tool-icon.images {
  background: #c2410c;
}

.tool-icon.hr {
  background: var(--green);
}

.tool-icon.communication {
  background: var(--coral);
}

.tool-icon.generators {
  background: #7a4d9f;
}

.tool-icon.random {
  background: #2563eb;
}

.tool-icon.daily {
  background: #6f6a3f;
}

.tool-title {
  font-size: 17px;
  line-height: 1.35;
}

.tool-desc {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.tool-meta {
  color: #496574;
  font-size: 13px;
  font-weight: 700;
}

.tool-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.tool-open svg {
  width: 15px;
  height: 15px;
}

.tools-empty {
  min-height: 260px;
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  padding: 32px;
  border: 1px dashed #afbec8;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  text-align: center;
}

.tools-empty svg {
  width: 36px;
  height: 36px;
  color: var(--teal);
}

.tools-empty strong {
  color: var(--ink);
  font-size: 18px;
}

.tool-panel {
  position: sticky;
  top: 98px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

body.has-active-tool .tool-panel,
body.has-wide-tool .tool-panel {
  position: static;
}

.tool-panel::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--teal), var(--yellow), var(--coral));
}

.panel-empty {
  min-height: 448px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.panel-empty svg {
  width: 36px;
  height: 36px;
  color: var(--teal);
}

.panel-empty h2 {
  color: var(--ink);
  font-size: 22px;
}

.panel-content {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.is-hidden {
  display: none !important;
}

.panel-title {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.panel-back-button {
  min-height: 36px;
  padding: 7px 10px;
  white-space: nowrap;
}

.panel-title h2 {
  font-size: 22px;
  line-height: 1.25;
}

.panel-title p {
  color: var(--muted);
  font-size: 14px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 13px;
  color: #394956;
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #ccd8e0;
  border-radius: 8px;
  padding: 9px 11px;
  background: var(--surface-strong);
  color: var(--ink);
  outline: 0;
}

.field textarea {
  min-height: 112px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 124, 137, 0.12);
}

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

.output {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfb;
}

.output h3 {
  font-size: 15px;
}

.output-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #26333f;
  line-height: 1.65;
}

.converter-tool {
  display: grid;
  gap: 14px;
}

.converter-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #f7fbff;
}

.converter-tab {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #425466;
  font-weight: 800;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.converter-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 124, 137, 0.2);
  background: rgba(255, 255, 255, 0.72);
}

.converter-tab.is-active {
  border-color: rgba(0, 124, 137, 0.28);
  background: #ffffff;
  color: var(--teal-dark);
  box-shadow: 0 8px 18px rgba(0, 124, 137, 0.1);
}

.converter-panel {
  display: none;
  gap: 12px;
}

.converter-panel.is-active {
  display: grid;
}

.world-time-summary {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #ffffff;
}

.world-time-summary strong,
.world-time-summary span,
.world-time-summary small {
  display: block;
}

.world-time-summary strong {
  color: #17202a;
}

.world-time-summary span {
  color: var(--teal-dark);
  font-size: 20px;
  font-weight: 900;
}

.world-time-summary small {
  color: var(--muted);
}

.world-time-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.world-time-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #ffffff;
}

.world-time-card.is-source {
  border-color: rgba(0, 124, 137, 0.4);
  background: #f2fbfc;
}

.world-time-card strong {
  overflow: hidden;
  color: #17202a;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.world-time-card span {
  color: var(--teal-dark);
  font-size: 24px;
  font-weight: 900;
  line-height: 1.1;
}

.world-time-card small {
  color: var(--muted);
  font-size: 12px;
}

.random-tool {
  display: grid;
  gap: 14px;
}

.random-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #f7fbff;
}

.random-tab {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #425466;
  font-weight: 800;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.random-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.2);
  background: rgba(255, 255, 255, 0.65);
}

.random-tab.is-active {
  border-color: rgba(37, 99, 235, 0.28);
  background: #ffffff;
  color: #1d4ed8;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.1);
}

.random-tab svg {
  width: 16px;
  height: 16px;
}

.random-suspense-control {
  display: grid;
  grid-template-columns: minmax(160px, 0.65fr) minmax(180px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0, #f7fbff 100%);
}

.random-suspense-control div {
  display: grid;
  gap: 2px;
}

.random-suspense-control strong {
  color: #17202a;
  font-size: 14px;
  line-height: 1.2;
}

.random-suspense-control span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.random-suspense-control input[type="range"] {
  width: 100%;
  accent-color: #2563eb;
}

.random-suspense-control output {
  min-width: 76px;
  padding: 6px 9px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 8px;
  background: #ffffff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.random-panel {
  display: none;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.random-panel.is-active {
  display: grid;
  animation: randomPanelIn 180ms ease both;
}

.random-check-card {
  min-height: 40px;
  align-self: end;
  padding: 9px 11px;
  border: 1px solid #ccd8e0;
  border-radius: 8px;
  background: #ffffff;
}

.random-team-preview {
  min-height: 92px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  align-items: stretch;
  padding: 12px;
  border: 1px dashed rgba(37, 99, 235, 0.24);
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fbff 0, #ffffff 100%);
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
}

.random-team-preview.has-result,
.random-team-preview.is-mixing {
  grid-template-columns: 1fr;
  align-content: start;
  border-style: solid;
  background:
    radial-gradient(circle at 12% 20%, rgba(124, 58, 237, 0.13), transparent 34%),
    radial-gradient(circle at 86% 18%, rgba(14, 165, 233, 0.13), transparent 34%),
    linear-gradient(180deg, #fbfaff 0, #ffffff 100%);
}

.random-team-preview.has-result {
  grid-template-rows: auto minmax(0, 1fr);
}

.random-team-preview.has-result::before,
.random-team-preview.is-mixing::before {
  content: "";
  position: absolute;
  inset: -45% -10% auto;
  height: 160px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.78), transparent);
  transform: translateX(-100%) rotate(-6deg);
  animation: randomTeamSheen 2800ms ease-in-out infinite;
  pointer-events: none;
}

.random-team-empty-state {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 12px;
  text-align: left;
}

.random-team-empty-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(124, 58, 237, 0.22);
}

.random-team-empty-icon svg {
  width: 23px;
  height: 23px;
}

.random-team-empty-state strong {
  display: block;
  color: #17202a;
  font-size: 15px;
  font-weight: 900;
}

.random-team-empty-state span:last-child {
  display: block;
  margin-top: 2px;
  color: #617089;
  font-weight: 800;
}

.random-team-mixer {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
}

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

.random-team-mixer-copy span,
.random-team-result-banner span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #6d28d9;
  font-size: 13px;
  font-weight: 900;
}

.random-team-mixer-copy svg,
.random-team-result-banner svg {
  width: 17px;
  height: 17px;
}

.random-team-mixer-copy strong,
.random-team-result-banner strong {
  color: #17202a;
  font-size: 13px;
  font-weight: 900;
}

.random-team-mixer-stage {
  position: relative;
  min-height: 138px;
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 50%, rgba(124, 58, 237, 0.14), transparent 34%),
    linear-gradient(135deg, rgba(37, 99, 235, 0.09), rgba(219, 39, 119, 0.08)),
    rgba(255, 255, 255, 0.76);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84);
  overflow: hidden;
}

.random-team-mixer-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(180px, 54%);
  aspect-ratio: 1;
  border: 2px dashed rgba(124, 58, 237, 0.3);
  border-radius: 999px;
  transform: translate(-50%, -50%);
  animation: randomTeamRingSpin 2200ms linear infinite;
}

.random-team-mixer-ring::before,
.random-team-mixer-ring::after {
  content: "";
  position: absolute;
  inset: 18%;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: inherit;
}

.random-team-mixer-ring::after {
  inset: 38%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.28), transparent 62%);
  border: 0;
}

.random-team-mixer-chip {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  max-width: min(150px, 42%);
  padding: 6px 10px;
  border: 1px solid rgba(var(--team-accent-rgb), 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #17202a;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 12px 24px rgba(var(--team-accent-rgb), 0.18);
  animation: randomTeamChipMix 1150ms ease-in-out var(--delay) infinite alternate;
}

.random-team-mixer-chip::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--team-accent);
  box-shadow: 0 0 14px rgba(var(--team-accent-rgb), 0.52);
}

.random-team-mixer-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.random-team-mixer-slots span {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(var(--team-accent-rgb), 0.24);
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(var(--team-accent-rgb), 0.18), rgba(255, 255, 255, 0.9)),
    #ffffff;
  color: var(--team-accent);
  box-shadow: 0 10px 20px rgba(var(--team-accent-rgb), 0.12);
}

.random-team-mixer-slots b {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.random-team-result-banner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid rgba(244, 183, 64, 0.28);
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(244, 183, 64, 0.16), rgba(236, 102, 180, 0.1), rgba(101, 199, 247, 0.13)),
    rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 24px rgba(76, 91, 159, 0.08);
}

.random-team-result-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  align-items: start;
  align-self: stretch;
}

.random-team-card {
  --team-accent: #2563eb;
  --team-accent-rgb: 37, 99, 235;
  position: relative;
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(var(--team-accent-rgb), 0.28);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(var(--team-accent-rgb), 0.13), rgba(255, 255, 255, 0) 46%),
    #ffffff;
  box-shadow: 0 12px 26px rgba(var(--team-accent-rgb), 0.12);
  overflow: hidden;
}

.random-team-preview.has-result .random-team-card {
  gap: 9px;
  padding: 14px;
  animation: randomTeamInlineReveal 500ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.random-team-preview.has-result .random-team-card strong {
  font-size: 16px;
}

.random-team-preview.has-result .random-team-card ol {
  gap: 5px;
}

.random-team-preview.has-result .random-team-card li {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.random-team-preview.has-result .random-team-card li::before {
  content: counter(teamMember);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--team-accent);
  color: #ffffff;
  font-size: 11px;
  box-shadow: 0 8px 16px rgba(var(--team-accent-rgb), 0.2);
}

.random-team-preview.has-result .random-team-card:nth-child(2) {
  animation-delay: 90ms;
}

.random-team-preview.has-result .random-team-card:nth-child(3) {
  animation-delay: 180ms;
}

.random-team-preview.has-result .random-team-card:nth-child(4) {
  animation-delay: 270ms;
}

.random-team-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--team-accent);
}

.random-team-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.random-team-card strong {
  color: #17202a;
  font-size: 15px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.random-team-card span {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(var(--team-accent-rgb), 0.11);
  color: var(--team-accent);
  font-size: 12px;
  font-weight: 900;
}

.random-team-card ol {
  counter-reset: teamMember;
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  color: #425466;
  list-style: none;
}

.random-team-card li {
  counter-increment: teamMember;
  min-width: 0;
  overflow-wrap: anywhere;
}

.random-team-card li::before {
  content: counter(teamMember) ". ";
  color: var(--team-accent);
  font-weight: 900;
}

.random-tool[data-random-mode="team"] > .random-result-card,
.random-tool[data-random-mode="team"] > .random-history {
  display: none;
}

body.has-random-team-presentation,
body.has-random-wheel-fullscreen {
  overflow: hidden;
}

.random-team-presentation {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  padding: clamp(18px, 3vw, 36px);
  isolation: isolate;
  background:
    linear-gradient(112deg, rgba(124, 58, 237, 0.2) 0 17%, transparent 17% 53%, rgba(14, 165, 233, 0.16) 53% 73%, transparent 73%),
    linear-gradient(180deg, #fbf7ff 0, #f7fbff 46%, #ffffff 100%);
  color: #17202a;
  overflow: hidden;
}

.random-team-presentation::before {
  content: "";
  position: absolute;
  inset: -24% -12%;
  z-index: -2;
  background:
    repeating-linear-gradient(100deg, rgba(124, 58, 237, 0.08) 0 2px, transparent 2px 46px),
    linear-gradient(105deg, transparent 0 35%, rgba(255, 255, 255, 0.72) 45%, transparent 55% 100%);
  transform: translateX(-18%);
  animation: randomTeamSpotlight 8s ease-in-out infinite alternate;
}

.random-team-presentation::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  z-index: -1;
  height: 38vh;
  background:
    linear-gradient(180deg, transparent, rgba(37, 99, 235, 0.06)),
    repeating-linear-gradient(90deg, rgba(37, 99, 235, 0.16) 0 1px, transparent 1px 64px);
  mask-image: linear-gradient(180deg, transparent, #000 42%);
}

.random-team-presentation-burst {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.random-team-presentation-burst span {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: -22px;
  width: 8px;
  height: 16px;
  border-radius: 2px;
  background: hsl(var(--hue), 84%, 58%);
  box-shadow: 0 0 18px hsla(var(--hue), 84%, 58%, 0.34);
  opacity: 0.72;
  animation: randomTeamConfetti 5.6s linear var(--delay) infinite;
}

.random-team-presentation.is-hidden {
  display: none;
}

.random-team-presentation:fullscreen {
  width: 100vw;
  height: 100vh;
}

.random-team-presentation-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.random-team-presentation-head span {
  color: #6d28d9;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.random-team-presentation-head h3 {
  margin: 3px 0 0;
  color: #111827;
  font-size: clamp(28px, 4vw, 54px);
  line-height: 1.05;
}

.random-team-presentation-head p {
  margin: 10px 0 0;
  width: fit-content;
  padding: 7px 12px;
  border: 1px solid rgba(124, 58, 237, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: #334155;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.12);
}

.random-team-presentation-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.random-team-presentation-grid {
  position: relative;
  z-index: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: clamp(14px, 2vw, 24px);
  align-content: start;
  perspective: 1200px;
  overflow: auto;
  padding-bottom: 4px;
}

.random-team-presentation-card {
  --team-accent: #2563eb;
  --team-accent-rgb: 37, 99, 235;
  position: relative;
  min-width: 0;
  display: grid;
  gap: clamp(14px, 1.8vw, 22px);
  padding: clamp(18px, 2.4vw, 30px);
  border: 1px solid rgba(var(--team-accent-rgb), 0.34);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(var(--team-accent-rgb), 0.16), rgba(255, 255, 255, 0.06) 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 255, 0.94)),
    #ffffff;
  box-shadow:
    0 24px 54px rgba(var(--team-accent-rgb), 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
  overflow: hidden;
  animation: randomTeamCardReveal 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.random-team-presentation-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 9px;
  background: linear-gradient(90deg, var(--team-accent), rgba(var(--team-accent-rgb), 0.32));
}

.random-team-presentation-card::after {
  content: "";
  position: absolute;
  inset: 9px 0 auto;
  height: 1px;
  background: rgba(255, 255, 255, 0.84);
}

.random-team-presentation-card:nth-child(2) {
  animation-delay: 80ms;
}

.random-team-presentation-card:nth-child(3) {
  animation-delay: 160ms;
}

.random-team-presentation-card:nth-child(4) {
  animation-delay: 240ms;
}

.random-team-presentation-card:nth-child(5) {
  animation-delay: 320ms;
}

.random-team-presentation-card:nth-child(6) {
  animation-delay: 400ms;
}

.random-team-presentation-card .random-team-card-title {
  align-items: flex-start;
}

.random-team-presentation-card strong {
  color: #111827;
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.08;
}

.random-team-presentation-card span {
  width: fit-content;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(var(--team-accent-rgb), 0.12);
  color: var(--team-accent);
  font-size: clamp(13px, 1.5vw, 16px);
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(var(--team-accent-rgb), 0.12);
}

.random-team-presentation-card ol {
  counter-reset: teamMember;
  display: grid;
  gap: clamp(8px, 1.1vw, 12px);
  margin: 0;
  padding: 0;
  color: #1f2937;
  font-size: clamp(20px, 2.5vw, 34px);
  font-weight: 900;
  line-height: 1.25;
  list-style: none;
}

.random-team-presentation-card li {
  counter-increment: teamMember;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  overflow-wrap: anywhere;
}

.random-team-presentation-card li::before {
  content: counter(teamMember);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: clamp(30px, 3.2vw, 42px);
  height: clamp(30px, 3.2vw, 42px);
  border-radius: 999px;
  background: var(--team-accent);
  color: #ffffff;
  font-size: clamp(16px, 1.8vw, 22px);
  box-shadow: 0 10px 20px rgba(var(--team-accent-rgb), 0.22);
}

.random-wheel-manager {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #f8fbff;
}

.random-wheel-manager summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  color: #1f3b57;
  font-size: 13px;
  font-weight: 900;
}

.random-wheel-manager summary::-webkit-details-marker {
  display: none;
}

.random-wheel-manager summary span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.random-wheel-manager summary svg {
  width: 17px;
  height: 17px;
  color: #2563eb;
}

.random-wheel-manager summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.random-wheel-manager[open] summary {
  margin-bottom: 10px;
}

.random-wheel-manager:not([open]) > :not(summary) {
  display: none;
}

.random-wheel-manager-row,
.random-wheel-preset-row,
.random-wheel-command-grid {
  display: grid;
  gap: 8px;
}

.random-wheel-manager-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.random-wheel-preset-row {
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) repeat(3, auto);
}

.random-wheel-command-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
}

.random-wheel-command-grid .primary-button {
  grid-column: 1 / -1;
  min-height: 46px;
}

.random-wheel-tap-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  justify-self: center;
  margin: -2px 0 2px;
  color: #2563eb;
  font-size: 13px;
  font-weight: 900;
}

.random-wheel-tap-hint svg {
  width: 16px;
  height: 16px;
}

.party-game {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(320px, 430px);
  gap: 14px;
  align-items: start;
}

.party-game-board,
.party-control-panel,
.party-history,
.party-result-card {
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #ffffff;
}

.party-game-board {
  display: grid;
  gap: 12px;
  justify-items: center;
  min-height: 640px;
  padding: 18px;
}

.party-control-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.party-control-panel textarea {
  min-height: 152px;
}

.party-custom-actions {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fbff, #ffffff);
}

.party-custom-actions summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

.party-custom-actions summary::-webkit-details-marker {
  display: none;
}

.party-custom-actions summary span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #17202a;
  font-size: 14px;
  font-weight: 900;
}

.party-custom-actions summary svg {
  width: 17px;
  height: 17px;
  color: #2563eb;
}

.party-custom-actions summary small {
  padding: 5px 8px;
  border-radius: 999px;
  background: #eef5ff;
  color: #2563eb;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.party-custom-actions textarea {
  min-height: 118px;
}

.party-action-switches,
.party-option-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.party-option-tools .secondary-button,
.party-option-tools .ghost-button {
  min-height: 42px;
}

.party-wheel-stage {
  position: relative;
  width: min(540px, 100%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 999px;
  outline: none;
}

.party-wheel-stage:focus-visible {
  box-shadow: 0 0 0 4px rgba(239, 108, 168, 0.18);
}

.party-wheel-stage:hover .party-wheel-disc {
  box-shadow: 0 24px 60px rgba(239, 108, 168, 0.2);
}

.party-wheel-disc {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 10px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 20px 48px rgba(37, 99, 235, 0.16);
  transition: transform var(--party-wheel-duration, 2600ms) cubic-bezier(0.12, 0.74, 0.18, 1);
}

.party-wheel-disc.is-spinning {
  box-shadow: 0 26px 70px rgba(239, 108, 168, 0.24);
}

.party-wheel-pointer {
  position: absolute;
  top: -4px;
  z-index: 4;
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 36px solid #17202a;
  filter: drop-shadow(0 5px 10px rgba(23, 32, 42, 0.24));
}

.party-wheel-label {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 2;
  max-width: 142px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.1;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.38);
  transform: translate(-50%, -50%) rotate(calc(var(--party-wheel-rotation, 0deg) * -1));
  transform-origin: center;
}

.party-wheel-label b {
  display: block;
  overflow: hidden;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.58);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-wheel-center {
  position: relative;
  z-index: 3;
  width: min(174px, 38%);
  aspect-ratio: 1;
  display: inline-grid;
  place-items: center;
  align-content: center;
  padding: 18px;
  border: 8px solid #ffffff;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #f4f8fb);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.12);
  text-align: center;
}

.party-wheel-center strong,
.party-wheel-center span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-wheel-center strong {
  color: #17202a;
  font-size: 19px;
  font-weight: 900;
}

.party-wheel-center span {
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
}

.party-wheel-hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: #2563eb;
  font-size: 13px;
  font-weight: 900;
}

.party-wheel-hint svg {
  width: 16px;
  height: 16px;
}

.party-result-card {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 14px;
}

.party-result-card span,
.party-safety span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.party-result-card h3 {
  margin: 0;
  color: #17202a;
  font-size: 24px;
  line-height: 1.15;
}

.party-result-card p {
  min-height: 42px;
  margin: 0;
  color: #425466;
  line-height: 1.55;
}

.party-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.party-actions .primary-button {
  grid-column: 1 / -1;
  min-height: 46px;
}

.party-safe-note {
  padding: 10px 11px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #f8fbff;
}

.party-safety {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(0, 124, 137, 0.2);
  border-radius: 8px;
  background: #f2fbfc;
}

.party-safety svg {
  width: 18px;
  height: 18px;
  color: var(--teal);
}

.party-history {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.party-history-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.party-history-item {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
}

.party-history-item strong {
  color: #17202a;
  font-size: 13px;
}

.party-history-item span,
.party-history-item small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-popup-panel h3 {
  color: #ef6ca8;
  font-size: clamp(34px, 7vw, 72px);
}

.random-option-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.random-option-grid .check-row {
  padding: 9px 10px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #f8fbfd;
}

.random-wheel-stage {
  position: relative;
  width: min(500px, 100%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  justify-self: center;
  margin: 6px 0 8px;
  cursor: pointer;
  border-radius: 999px;
  outline: none;
}

.random-wheel-stage:focus-visible {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.random-wheel-stage:hover .random-wheel-disc {
  box-shadow: 0 22px 56px rgba(37, 99, 235, 0.24);
}

.random-wheel-disc {
  position: absolute;
  inset: 0;
  border: 10px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 18px 46px rgba(37, 99, 235, 0.18);
  transition: transform var(--wheel-duration, 2600ms) cubic-bezier(0.12, 0.74, 0.18, 1);
  overflow: hidden;
}

.random-wheel-disc.is-spinning {
  box-shadow: 0 24px 62px rgba(37, 99, 235, 0.26);
}

.random-wheel-disc::after {
  content: none;
}

.random-wheel-pointer {
  position: absolute;
  top: -2px;
  z-index: 3;
  width: 0;
  height: 0;
  border-left: 17px solid transparent;
  border-right: 17px solid transparent;
  border-top: 34px solid #17202a;
  filter: drop-shadow(0 4px 8px rgba(23, 32, 42, 0.24));
}

.random-wheel-label {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 1;
  width: auto;
  max-width: 138px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.15;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.42);
  transform: translate(-50%, -50%) rotate(calc(var(--wheel-rotation, 0deg) * -1));
  transform-origin: center;
}

.random-wheel-label b {
  max-width: 138px;
  display: block;
  overflow: hidden;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.62);
  box-shadow: 0 7px 16px rgba(15, 23, 42, 0.22);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.random-wheel-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 900;
}

.random-wheel-center {
  position: absolute;
  bottom: 18px;
  z-index: 4;
  max-width: min(270px, 74%);
  display: inline-grid;
  gap: 1px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.72);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.22);
  text-align: center;
  backdrop-filter: blur(4px);
}

.random-wheel-center strong,
.random-wheel-center span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.random-wheel-center strong {
  color: #ffffff;
  font-size: 15px;
  line-height: 1.25;
}

.random-wheel-center span {
  color: #dbeafe;
  font-size: 12px;
  font-weight: 900;
}

.random-wheel-name-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
}

.random-wheel-name-list span {
  max-width: 180px;
  overflow: hidden;
  padding: 5px 9px;
  border: 1px solid #d9e3f0;
  border-radius: 999px;
  background: #ffffff;
  color: #425466;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.random-wheel-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 18px;
  padding: 18px;
  background:
    linear-gradient(135deg, #f0f7ff, #ffffff),
    radial-gradient(circle at 28% 24%, rgba(37, 99, 235, 0.16), transparent 34%);
}

.random-wheel-fullscreen.is-hidden {
  display: none;
}

.random-wheel-fullscreen:fullscreen {
  width: 100vw;
  height: 100vh;
}

.random-wheel-fullscreen-stage {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.random-wheel-fullscreen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.random-wheel-fullscreen-head span {
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.random-wheel-fullscreen-head h3 {
  margin: 0;
  color: #17202a;
  font-size: 30px;
  line-height: 1.1;
}

.random-wheel-stage-full {
  width: min(72vh, 76vw);
  max-width: 760px;
  align-self: center;
}

.random-wheel-stage-full .random-wheel-label {
  max-width: 180px;
  font-size: 20px;
}

.random-wheel-stage-full .random-wheel-label b {
  max-width: 180px;
  padding: 8px 12px;
}

.random-wheel-stage-full .random-wheel-center {
  bottom: 26px;
  max-width: min(330px, 74%);
  padding: 10px 15px;
}

.random-wheel-stage-full .random-wheel-center strong {
  font-size: 18px;
}

.random-wheel-fullscreen-result {
  min-height: 64px;
  display: grid;
  align-content: center;
  padding: 14px 16px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.35;
  white-space: pre-wrap;
}

.random-wheel-fullscreen-panel {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 20px 44px rgba(22, 41, 77, 0.14);
}

.random-wheel-fullscreen-panel textarea {
  min-height: min(34vh, 280px);
}

.random-wheel-fullscreen-panel .actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.random-wheel-fullscreen-panel .primary-button {
  grid-column: 1 / -1;
  min-height: 48px;
}

.random-wheel-winner {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(3px);
}

.random-wheel-winner.is-hidden {
  display: none;
}

.random-wheel-winner-card {
  position: relative;
  z-index: 2;
  width: min(720px, 92vw);
  display: grid;
  gap: 10px;
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
  text-align: center;
  animation: randomWinnerPop 520ms cubic-bezier(0.2, 0.82, 0.18, 1) both;
}

.random-wheel-winner-card span {
  color: #2563eb;
  font-size: 14px;
  font-weight: 1000;
  text-transform: uppercase;
}

.random-wheel-winner-card h2 {
  margin: 0;
  color: #17202a;
  font-size: clamp(44px, 8vw, 92px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.random-wheel-winner-card pre {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: #f8fbff;
  color: #425466;
  font: 900 20px/1.45 "Noto Sans Thai", ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
}

.random-wheel-winner-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.random-wheel-winner-fireworks {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.random-wheel-winner-fireworks span {
  position: absolute;
  left: 50%;
  top: 48%;
  width: var(--size);
  height: var(--size);
  border-radius: 999px;
  background: var(--firework-color);
  animation: randomWinnerFirework 1100ms ease-out var(--delay) both;
  transform: rotate(var(--angle)) translateX(0);
}

.random-dice-stage {
  min-height: 190px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 18px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(238, 246, 255, 0.84), rgba(255, 255, 255, 0.96)),
    radial-gradient(circle at 50% 0, rgba(74, 141, 247, 0.14), transparent 46%);
  overflow: hidden;
  perspective: 760px;
}

.random-dice-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 130px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.random-die {
  position: relative;
  width: 58px;
  height: 58px;
  justify-self: center;
  display: grid;
  place-items: center;
  border: 2px solid rgba(23, 32, 42, 0.1);
  border-radius: 12px;
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.95), transparent 24%),
    linear-gradient(145deg, #ffffff 0, #eef6ff 100%);
  box-shadow:
    0 13px 24px rgba(37, 99, 235, 0.16),
    inset 0 -8px 16px rgba(37, 99, 235, 0.08);
  color: #17202a;
  font-weight: 1000;
  transform-origin: 50% 80%;
  transform-style: preserve-3d;
  will-change: transform, opacity;
}

.random-die::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -13px;
  height: 12px;
  border-radius: 999px;
  background: rgba(23, 32, 42, 0.12);
  filter: blur(4px);
  transform-origin: center;
  animation: randomDiceShadow 900ms cubic-bezier(0.18, 0.82, 0.22, 1) var(--delay) both;
}

.random-die-face,
.random-die-number {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.74);
}

.random-die-face {
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 7px;
}

.random-die-face i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: transparent;
}

.random-die-face i.is-on {
  background: #17202a;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.24);
}

.random-die-face.is-hidden-face {
  display: flex;
  gap: 4px;
}

.random-die-face.is-hidden-face i {
  background: #8da0b8;
  animation: randomDiceThinking 640ms ease-in-out infinite alternate;
}

.random-die-face.is-hidden-face i:nth-child(2) {
  animation-delay: 110ms;
}

.random-die-face.is-hidden-face i:nth-child(3) {
  animation-delay: 220ms;
}

.random-die-number {
  font-size: 25px;
  line-height: 1;
}

.random-die.is-falling {
  color: #8da0b8;
  animation: randomDiceDrop 920ms cubic-bezier(0.16, 0.78, 0.18, 1) var(--delay) both;
}

.random-die.is-waiting {
  color: #8da0b8;
  transform: translateY(0) rotateX(0) rotateZ(0) scale(1);
}

.random-die.is-revealed {
  color: #1d4ed8;
  animation: randomDiceReveal 440ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.random-die.is-revealed .random-die-face,
.random-die.is-revealed .random-die-number {
  background: rgba(255, 255, 255, 0.92);
}

.random-result-card,
.random-history {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfb;
}

.random-result-card {
  position: relative;
  overflow: hidden;
}

.random-result-card.is-rolling {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 14px 32px rgba(37, 99, 235, 0.12);
  animation: randomCardPulse 720ms ease-in-out infinite alternate;
}

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

.random-result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.random-spin-count {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid #d9e3f0;
  border-radius: 999px;
  background: #ffffff;
  color: #425466;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.random-result-head h3 {
  margin: 0;
  font-size: 15px;
}

.random-result-card pre {
  min-height: 84px;
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
  font: 800 18px/1.55 "Noto Sans Thai", ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.random-spinner {
  position: absolute;
  inset: auto 18px 18px auto;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.82);
  transition: opacity 160ms ease, transform 160ms ease;
}

.random-spinner {
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.94) 0 34%, transparent 35%),
    conic-gradient(from 0deg, rgba(37, 99, 235, 0.08), rgba(84, 198, 189, 0.38), rgba(139, 124, 246, 0.12), rgba(37, 99, 235, 0.08));
  border-radius: 999px;
  animation: randomOrbitGlow 960ms linear infinite;
}

.random-spinner::before,
.random-spinner::after {
  content: "";
  position: absolute;
  border-radius: 999px;
}

.random-spinner::before {
  inset: 7px;
  border: 4px solid rgba(37, 99, 235, 0.12);
}

.random-spinner::after {
  inset: 7px;
  border: 4px solid transparent;
  border-top-color: #2563eb;
  border-right-color: #54c6bd;
  animation: randomSpin 720ms linear infinite;
}

.random-spinner span {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #2563eb;
  box-shadow: 0 0 16px rgba(37, 99, 235, 0.35);
}

.random-spinner span:nth-child(1) {
  transform: rotate(0deg) translateX(32px);
  animation: randomDotOrbit 850ms linear infinite;
}

.random-spinner span:nth-child(2) {
  background: #54c6bd;
  transform: rotate(120deg) translateX(32px);
  animation: randomDotOrbit 850ms linear infinite;
  animation-delay: -280ms;
}

.random-spinner span:nth-child(3) {
  background: #8b7cf6;
  transform: rotate(240deg) translateX(32px);
  animation: randomDotOrbit 850ms linear infinite;
  animation-delay: -560ms;
}

.random-result-card.is-rolling .random-spinner {
  opacity: 1;
  transform: scale(1);
}

.random-result-card pre.is-rolling {
  animation: randomRolling 110ms linear infinite;
  color: #1d4ed8;
  padding-right: 104px;
}

.random-result-card pre.is-revealed {
  animation: randomReveal 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.random-history-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.random-history-item {
  display: grid;
  gap: 2px;
  padding: 10px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #ffffff;
  color: #26333f;
  text-align: left;
}

.random-history-item strong,
.random-history-item span,
.random-history-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.random-history-item span,
.random-history-item small {
  color: var(--muted);
  font-size: 12px;
}

.random-history-item small {
  color: #1d4ed8;
  font-weight: 800;
}

.random-history-item.is-list-log {
  gap: 6px;
}

.random-history-item.is-list-log span {
  max-height: 180px;
  overflow: auto;
  text-overflow: clip;
  white-space: pre-wrap;
}

.random-popup {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 28, 43, 0.42);
  backdrop-filter: blur(8px);
}

.random-popup.is-hidden {
  display: none;
}

.random-popup-panel {
  position: relative;
  z-index: 2;
  width: min(560px, 100%);
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 72px rgba(22, 41, 77, 0.32);
  animation: randomPopupIn 360ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.random-popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.random-popup-kicker {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 900;
}

.random-popup-panel h3 {
  margin: 0;
  color: #17202a;
  font-size: 24px;
  line-height: 1.25;
}

.random-popup-panel pre {
  max-height: min(46vh, 360px);
  margin: 0;
  overflow: auto;
  padding: 18px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #f8fbfd;
  color: #0f172a;
  font: 900 22px/1.55 "Noto Sans Thai", ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.random-popup-actions {
  justify-content: flex-end;
}

.random-fireworks {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.random-fireworks span {
  position: absolute;
  left: var(--origin-x);
  top: var(--origin-y);
  width: var(--size);
  height: var(--size);
  border-radius: 999px;
  background: var(--firework-color);
  box-shadow: 0 0 18px var(--firework-color);
  transform: rotate(var(--angle)) translateX(0) scale(0.4);
  opacity: 0;
  animation: randomFirework 1500ms ease-out var(--delay) both;
}

@keyframes randomPopupIn {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  60% {
    opacity: 1;
    transform: translateY(-2px) scale(1.015);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes randomFirework {
  0% {
    opacity: 0;
    transform: rotate(var(--angle)) translateX(0) scale(0.4);
  }
  16% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--angle)) translateX(var(--distance)) scale(1);
  }
}

@keyframes randomWinnerPop {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.92);
  }
  62% {
    opacity: 1;
    transform: translateY(-4px) scale(1.035);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes randomWinnerFirework {
  0% {
    opacity: 0;
    transform: rotate(var(--angle)) translateX(0) scale(0.35);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--angle)) translateX(var(--distance)) scale(1);
  }
}

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

@keyframes randomRolling {
  0% {
    transform: translateY(0);
    filter: blur(0);
  }
  50% {
    transform: translateY(-1px);
    filter: blur(0.5px);
  }
  100% {
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes randomCardPulse {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-2px);
  }
}

@keyframes randomSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes randomOrbitGlow {
  to {
    rotate: 360deg;
  }
}

@keyframes randomDotOrbit {
  to {
    transform: rotate(360deg) translateX(32px);
  }
}

@keyframes randomReveal {
  0% {
    opacity: 0.35;
    transform: scale(0.985);
  }
  55% {
    opacity: 1;
    transform: scale(1.015);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes randomTeamSheen {
  0%,
  38% {
    transform: translateX(-115%) rotate(-6deg);
  }
  100% {
    transform: translateX(115%) rotate(-6deg);
  }
}

@keyframes randomTeamRingSpin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes randomTeamChipMix {
  from {
    transform: translate3d(-6px, 5px, 0) scale(0.96);
  }
  to {
    transform: translate3d(8px, -7px, 0) scale(1.04);
  }
}

@keyframes randomTeamInlineReveal {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  64% {
    opacity: 1;
    transform: translateY(-2px) scale(1.01);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes randomTeamSpotlight {
  from {
    transform: translateX(-18%);
  }
  to {
    transform: translateX(10%);
  }
}

@keyframes randomTeamConfetti {
  0% {
    transform: translate3d(0, -24px, 0) rotate(0deg);
    opacity: 0;
  }
  14% {
    opacity: 0.78;
  }
  100% {
    transform: translate3d(var(--drift), 112vh, 0) rotate(520deg);
    opacity: 0;
  }
}

@keyframes randomTeamCardReveal {
  0% {
    opacity: 0;
    transform: translateY(18px) rotateX(5deg) scale(0.98);
  }
  70% {
    opacity: 1;
    transform: translateY(-3px) rotateX(0deg) scale(1.01);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotateX(0deg) scale(1);
  }
}

@keyframes randomDiceDrop {
  0% {
    opacity: 0;
    transform: translateX(var(--drift)) translateY(calc(-1 * var(--travel))) rotateX(72deg) rotateY(-36deg) rotateZ(var(--rotate-start)) scale(0.76);
  }
  42% {
    opacity: 1;
    transform: translateX(calc(var(--drift) * -0.25)) translateY(18px) rotateX(-24deg) rotateY(18deg) rotateZ(var(--rotate-mid)) scale(1.08, 0.88);
  }
  58% {
    transform: translateX(calc(var(--drift) * 0.15)) translateY(-20px) rotateX(22deg) rotateY(-12deg) rotateZ(calc(var(--rotate-mid) * -0.45)) scale(0.96, 1.06);
  }
  72% {
    transform: translateX(0) translateY(9px) rotateX(-9deg) rotateY(7deg) rotateZ(calc(var(--rotate-mid) * 0.22)) scale(1.03, 0.96);
  }
  86% {
    transform: translateX(0) translateY(-5px) rotateX(5deg) rotateY(-3deg) rotateZ(0deg) scale(0.99, 1.01);
  }
  100% {
    opacity: 1;
    transform: translateX(0) translateY(0) rotateX(0) rotateY(0) rotateZ(0) scale(1);
  }
}

@keyframes randomDiceShadow {
  0% {
    opacity: 0;
    transform: scale(0.35);
  }
  48% {
    opacity: 1;
    transform: scale(1.22);
  }
  63% {
    opacity: 0.48;
    transform: scale(0.72);
  }
  78% {
    opacity: 0.78;
    transform: scale(1.06);
  }
  100% {
    opacity: 0.64;
    transform: scale(0.92);
  }
}

@keyframes randomDiceReveal {
  0% {
    transform: translateY(-4px) rotateX(78deg) scale(0.84);
  }
  62% {
    transform: translateY(0) rotateX(-9deg) scale(1.12);
  }
  100% {
    transform: translateY(0) rotateX(0) scale(1);
  }
}

@keyframes randomDiceThinking {
  from {
    opacity: 0.35;
    transform: translateY(2px) scale(0.75);
  }
  to {
    opacity: 1;
    transform: translateY(-2px) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .random-tab,
  .random-panel.is-active,
  .random-result-card.is-rolling,
  .random-spinner,
  .random-spinner span,
  .random-spinner::after,
  .random-wheel-disc,
  .random-die,
  .random-wheel-winner-card,
  .random-wheel-winner-fireworks span,
  .random-popup-panel,
  .random-fireworks span,
  .random-team-preview.has-result::before,
  .random-team-preview.is-mixing::before,
  .random-team-mixer-ring,
  .random-team-mixer-chip,
  .random-team-preview.has-result .random-team-card,
  .random-team-presentation::before,
  .random-team-presentation-burst span,
  .random-team-presentation-card,
  .random-result-card pre.is-rolling,
  .random-result-card pre.is-revealed,
  .random-park-lights span {
    animation: none;
    transition: none;
    transform: none;
  }
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mini-stat {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 12px;
  border-radius: 8px;
  background: linear-gradient(180deg, #eff7f7 0, #e7f0f1 100%);
  border: 1px solid rgba(0, 124, 137, 0.08);
}

.mini-stat strong {
  font-size: 22px;
  line-height: 1.1;
  color: var(--teal-dark);
}

.mini-stat span {
  font-size: 12px;
  color: var(--muted);
}

.document-builder {
  display: grid;
  grid-template-columns: minmax(340px, 0.92fr) minmax(420px, 1.08fr);
  gap: 16px;
  align-items: start;
}

.document-controls,
.document-preview-shell {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-soft);
}

.document-controls {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.document-control-head,
.document-section-row,
.document-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.document-control-head h3,
.document-section h4 {
  margin: 0;
  color: #17202a;
  line-height: 1.25;
}

.document-control-head h3 {
  font-size: 18px;
}

.document-control-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.document-live-chip,
.document-preview-head > span {
  flex: 0 0 auto;
  border: 1px solid rgba(74, 141, 247, 0.22);
  border-radius: 999px;
  padding: 5px 10px;
  background: #eef6ff;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.document-quick-panel {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) repeat(4, auto);
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid rgba(74, 141, 247, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(238, 246, 255, 0.9), rgba(255, 255, 255, 0.96));
}

.document-convert-panel {
  grid-template-columns: minmax(170px, 1fr) auto;
}

.document-quick-panel .secondary-button,
.document-quick-panel .ghost-button {
  min-height: 38px;
  padding: 8px 10px;
  white-space: nowrap;
}

.document-section {
  display: grid;
  gap: 10px;
  padding: 0;
  border: 1px solid rgba(126, 152, 197, 0.34);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(35, 63, 112, 0.05);
}

.document-section-content {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #ffffff;
}

.document-section-content[hidden] {
  display: none;
}

.document-section.is-collapsed {
  gap: 0;
  background: #f1f6ff;
}

.document-section-toggle {
  flex: 0 0 auto;
  margin-left: auto;
  border-color: rgba(52, 120, 246, 0.24);
  background: #ffffff;
}

.document-section.is-collapsed .document-section-row {
  margin-bottom: 0;
}

.document-section > .document-section-row {
  min-height: 54px;
  padding: 12px;
  border-bottom: 1px solid rgba(126, 152, 197, 0.2);
  background:
    linear-gradient(90deg, rgba(52, 120, 246, 0.12), transparent 38%),
    #f1f6ff;
}

.document-section.is-collapsed > .document-section-row {
  border-bottom: 0;
  background:
    linear-gradient(90deg, rgba(52, 120, 246, 0.16), transparent 42%),
    #edf4ff;
}

.document-section > .document-section-row::before {
  content: "";
  align-self: stretch;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #3478f6, #65c7f7);
}

.document-section h4 {
  font-size: 14px;
}

.document-items {
  display: grid;
  gap: 8px;
}

.document-item {
  display: grid;
  grid-template-columns: 28px minmax(110px, 1fr) 60px 66px 82px 34px;
  gap: 6px;
  align-items: center;
}

.document-item-index {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #eef6ff;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

.document-item input {
  width: 100%;
  min-height: 36px;
  border: 1px solid #ccd8e0;
  border-radius: 8px;
  padding: 7px 9px;
  background: #ffffff;
  color: var(--ink);
  outline: 0;
  min-width: 0;
}

.document-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.document-profile-actions .secondary-button,
.document-profile-actions .ghost-button {
  min-height: 34px;
  padding: 7px 10px;
  white-space: nowrap;
}

.document-profile-bar {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(200px, 1fr);
  gap: 12px;
  padding: 10px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #f8fbfd;
}

.document-logo-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #ffffff;
}

.document-logo-control .secondary-button,
.document-logo-control .ghost-button {
  min-height: 36px;
  padding: 7px 10px;
  white-space: nowrap;
}

.document-logo-control strong,
.document-logo-control span {
  display: block;
}

.document-logo-control strong {
  color: #17202a;
  font-size: 13px;
}

.document-logo-control span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-logo-toggle {
  min-height: 36px;
  padding: 0 6px;
  white-space: nowrap;
}

.document-bank-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.document-signature-slots {
  display: grid;
  gap: 10px;
}

.document-subsection-row h4 {
  font-size: 13px;
}

.document-signature-card {
  display: grid;
  grid-template-columns: 28px repeat(4, minmax(0, 1fr)) 34px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #ffffff;
}

.document-signature-card .field label {
  font-size: 12px;
}

.document-bank-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #ffffff;
}

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

.document-bank-toggle {
  min-width: 0;
  margin: 0;
}

.document-bank-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.document-bank-grid .field label {
  font-size: 12px;
}

.document-bank-grid input {
  min-height: 36px;
  padding: 7px 9px;
  background: #ffffff;
}

.document-status {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f7fbfb;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.document-preview-shell {
  overflow: hidden;
  background: #eef3f8;
}

.document-preview-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
}

.document-preview-head strong,
.document-preview-head span {
  display: block;
}

.document-preview-head strong {
  font-size: 16px;
}

.document-preview-head div span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.document-paper {
  width: min(100%, 210mm);
  min-height: 297mm;
  margin: 14px auto;
  padding: 14mm 16mm;
  background: #ffffff;
  color: #17202a;
  box-shadow: 0 18px 48px rgba(54, 85, 148, 0.18);
  font-size: 12.5px;
  line-height: 1.55;
}

.doc-paper-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.62fr);
  gap: 28px;
  padding-bottom: 14px;
  border-bottom: 1px solid #d7dce2;
}

.doc-brand-block {
  min-width: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.doc-brand-block.is-logo-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.doc-logo-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 2px solid #28313b;
  color: #28313b;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}

.doc-logo-image {
  width: 58px;
  height: 58px;
  object-fit: contain;
  display: block;
}

.doc-paper-header h1 {
  margin: 0 0 6px;
  font-size: 15px;
  line-height: 1.25;
}

.doc-paper-header p,
.doc-paper-title span,
.doc-meta-grid span,
.doc-meta-grid small,
.doc-notes p,
.doc-signatures small {
  color: #5f6c78;
  font-size: 11px;
  line-height: 1.45;
}

.doc-paper-title {
  display: grid;
  align-content: start;
  gap: 8px;
  text-align: right;
}

.doc-paper-title strong {
  color: #686868;
  font-size: 31px;
  font-weight: 800;
  line-height: 1.2;
}

.doc-copy-label {
  color: #2e3338;
  font-size: 11px;
  font-weight: 800;
}

.doc-header-card {
  display: grid;
  gap: 3px;
  margin-left: auto;
  width: min(100%, 250px);
  padding: 10px 12px;
  border-radius: 5px;
  background: #e9e9e9;
  text-align: left;
}

.doc-header-card div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px;
  align-items: baseline;
}

.doc-header-card span {
  color: #20252a;
  font-size: 11px;
  font-weight: 800;
}

.doc-header-card b {
  color: #4c4c4c;
  font-size: 11px;
  font-weight: 700;
}

.doc-meta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.42fr);
  gap: 18px;
  margin: 14px 0 10px;
}

.doc-meta-grid div {
  display: grid;
  gap: 4px;
  min-height: 50px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #ffffff;
}

.doc-meta-grid strong {
  line-height: 1.35;
  font-size: 12.5px;
}

.doc-subject {
  margin: 12px 0 14px;
}

.doc-subject span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.doc-subject h2,
.doc-contract-title h2 {
  margin: 3px 0 6px;
  font-size: 16px;
  line-height: 1.3;
}

.doc-subject-formal p,
.doc-contract-title p {
  margin: 6px 0;
}

.doc-body,
.doc-subject p,
.doc-list-section,
.doc-notes {
  line-height: 1.65;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin: 12px 0 0;
  font-size: 12px;
}

.doc-col-index {
  width: 34px;
}

.doc-col-qty,
.doc-col-unit {
  width: 64px;
}

.doc-col-money {
  width: 92px;
}

.doc-col-person,
.doc-col-date {
  width: 116px;
}

.doc-table th,
.doc-table td {
  border: 0;
  border-bottom: 1px solid #d8d8d8;
  padding: 8px 7px;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.doc-table th {
  background: #e8e8e8;
  text-align: left;
  font-weight: 900;
}

.doc-table th:first-child,
.doc-table td:first-child {
  width: 34px;
  text-align: center;
}

.doc-table .num {
  text-align: right;
  white-space: nowrap;
}

.doc-total-box {
  position: relative;
  width: 100%;
  margin-left: auto;
  display: grid;
  gap: 6px;
  border: 0;
}

.doc-total-box div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 0;
  border-bottom: 0;
}

.doc-total-box .grand-total {
  margin-top: 4px;
  padding: 14px 16px;
  border-top: 0;
  border-radius: 5px;
  background: #e9e9e9;
  color: #3f4667;
  font-size: 16px;
}

.doc-amount-text {
  display: grid !important;
  gap: 2px !important;
  margin-top: 2px;
  color: #4d5662;
  font-size: 11px;
}

.doc-amount-text span,
.doc-amount-text strong {
  display: block;
}

.doc-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 285px;
  gap: 26px;
  align-items: start;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #d8d8d8;
}

.doc-summary-note {
  min-width: 0;
}

.paid-stamp {
  width: fit-content;
  margin-left: auto;
  margin-top: 10px;
  border: 2px solid var(--green);
  color: var(--green);
  padding: 5px 14px;
  font-weight: 900;
  transform: rotate(-4deg);
}

.doc-list-section h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.doc-list-section ul {
  margin: 0;
  padding-left: 20px;
}

.doc-notes {
  margin-top: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #ffffff;
}

.doc-notes p {
  margin: 4px 0 0;
}

.doc-terms {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #d8d8d8;
}

.doc-terms p {
  margin: 4px 0 0;
  color: #414b55;
}

.doc-payment-info {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #d8d8d8;
}

.doc-payment-info p {
  margin: 3px 0 0;
  color: #414b55;
  line-height: 1.45;
}

.doc-payment-account {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid #ececec;
}

.doc-payment-account:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.doc-payment-account small {
  display: block;
  margin-bottom: 2px;
  color: #6a737c;
  font-size: 10.5px;
  font-weight: 800;
}

.doc-payment-account b {
  color: #20252a;
}

.doc-approval-box {
  min-height: 340px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #d8d8d8;
  border-radius: 5px;
  background: #fff;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.doc-signatures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 34px;
  margin-top: 50px;
  padding-top: 18px;
  border-top: 1px solid #d8d8d8;
  text-align: center;
}

.doc-signatures span {
  position: relative;
  min-height: 42px;
  display: block;
  border-top: 1px solid #17202a;
  margin-bottom: 8px;
}

.doc-signature-image,
.doc-stamp-image {
  position: absolute;
  left: 50%;
  bottom: 5px;
  transform: translateX(-50%);
  max-width: 130px;
  max-height: 46px;
  object-fit: contain;
}

.doc-stamp-image {
  left: calc(50% + 62px);
  max-width: 64px;
  max-height: 64px;
  opacity: 0.84;
}

.doc-signatures strong,
.doc-signatures small {
  display: block;
}

.doc-authorization-body {
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.85;
}

.doc-witnesses {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid #d8d8d8;
}

.doc-witnesses div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.doc-witnesses span {
  display: block;
  padding-top: 24px;
  border-top: 1px solid #17202a;
  text-align: center;
}

.todo-list,
.agenda-list {
  display: grid;
  gap: 8px;
}

.todo-item,
.agenda-item {
  display: grid;
  grid-template-columns: 24px 1fr 36px;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.todo-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.todo-item.is-done span {
  color: var(--muted);
  text-decoration: line-through;
}

.icon-only {
  width: 34px;
  height: 34px;
  padding: 0;
}

.signature-preview {
  border-left: 4px solid var(--teal);
  padding-left: 12px;
  line-height: 1.5;
}

.qr-box {
  display: grid;
  place-items: center;
  min-height: 224px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px dashed #b8c5cf;
}

.qr-box canvas {
  max-width: 100%;
  height: auto !important;
}

.image-studio {
  display: grid;
  gap: 14px;
}

.image-studio-drop,
.image-studio-controls,
.image-studio-status,
.image-studio-files,
.image-studio-preview-grid {
  min-width: 0;
}

.image-studio-drop {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border: 1px solid rgba(74, 141, 247, 0.24);
  border-radius: 8px;
  background: linear-gradient(135deg, #f8fbff 0, #eef7ff 100%);
}

.image-studio-drop > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
}

.image-studio-drop h3,
.image-studio-drop p {
  margin: 0;
}

.image-studio-drop h3 {
  color: #17202a;
  font-size: 19px;
  line-height: 1.25;
}

.image-studio-drop p {
  grid-column: 2;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.image-studio-upload {
  white-space: nowrap;
}

#loadImageStudioSamples {
  white-space: nowrap;
}

.image-studio-controls {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.image-studio-check {
  min-height: 40px;
  align-self: end;
  padding: 9px 10px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #ffffff;
}

.image-studio-details {
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #f8fbfd;
  overflow: hidden;
}

.image-studio-details summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  color: #17202a;
  font-weight: 800;
}

.image-studio-details summary span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.image-studio-details summary svg {
  width: 17px;
  height: 17px;
  color: var(--teal-dark);
}

.image-studio-details summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.image-studio-details[open] {
  padding-bottom: 12px;
}

.image-studio-details[open] > .form-grid {
  padding: 0 12px;
}

.image-studio-actions {
  flex-wrap: wrap;
}

.image-studio-status {
  padding: 10px 12px;
  border: 1px solid rgba(74, 141, 247, 0.2);
  border-radius: 8px;
  background: #eef6ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 800;
}

.image-studio-files,
.image-studio-preview-grid {
  display: grid;
  gap: 10px;
}

.image-studio-file,
.image-studio-result {
  min-width: 0;
  display: grid;
  grid-template-columns: 68px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #d9e3f0;
  border-radius: 8px;
  background: #ffffff;
}

.image-studio-result {
  grid-template-columns: 96px 1fr;
}

.image-studio-file img,
.image-studio-result img {
  width: 100%;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  background: #eef2f6;
}

.image-studio-result img {
  height: 76px;
}

.image-studio-file strong,
.image-studio-file span,
.image-studio-result strong,
.image-studio-result span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-studio-file strong,
.image-studio-result strong {
  color: #17202a;
  font-size: 13px;
}

.image-studio-file span,
.image-studio-result span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.image-studio-preview-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.image-studio-preview-grid:empty,
.image-studio-files:empty {
  display: none;
}

.image-tool {
  display: grid;
  gap: 14px;
}

.image-preview {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 12px;
  border: 1px dashed #b8c5cf;
  border-radius: 8px;
  background:
    linear-gradient(45deg, #e8eef2 25%, transparent 25%),
    linear-gradient(-45deg, #e8eef2 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e8eef2 75%),
    linear-gradient(-45deg, transparent 75%, #e8eef2 75%),
    #f4f7f9;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  overflow: auto;
}

.image-preview canvas {
  max-width: 100%;
  height: auto;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(23, 32, 42, 0.12);
}

.range-row {
  display: grid;
  grid-template-columns: 1fr 58px;
  gap: 10px;
  align-items: center;
}

.range-row input[type="range"] {
  width: 100%;
}

.image-stat-line {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #43515e;
  font-size: 14px;
  font-weight: 700;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.pdf-editor {
  display: grid;
  gap: 16px;
}

.pdf-editor-stage {
  position: relative;
  min-height: 260px;
  display: block;
  overflow: auto;
  padding: 12px;
  border: 1px dashed #b8c5cf;
  border-radius: 8px;
  background: #eef3f6;
}

.pdf-editor-stage.is-dragging {
  outline: 3px solid rgba(0, 124, 137, 0.35);
  outline-offset: -3px;
  background: #e1f2f4;
}

.pdf-editor-stage.is-smart-text {
  cursor: text;
}

.pdf-editor-stage.is-pointer {
  cursor: default;
}

.pdf-editor-stage canvas {
  display: block;
  margin: 0 auto;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(23, 32, 42, 0.14);
}

.pdf-native-edit-preview {
  border: 2px solid rgba(74, 141, 247, 0.9);
  border-radius: 4px;
  background: rgba(74, 141, 247, 0.08);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.78);
}

.pdf-native-edit-preview span {
  position: absolute;
  left: 0;
  bottom: calc(100% + 4px);
  max-width: 180px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 5px 14px rgba(37, 99, 235, 0.25);
}

.pdf-edit-layer,
.pdf-text-guide-layer {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.pdf-text-guide-layer {
  z-index: 2;
}

.pdf-edit-layer {
  z-index: 3;
}

.pdf-inline-text-editor,
.pdf-inline-fragment-input {
  position: absolute;
  z-index: 8;
  display: none;
  min-width: 90px;
  max-width: calc(100% - 24px);
  overflow: hidden;
  padding: 5px 7px;
  border: 2px solid rgba(74, 141, 247, 0.96);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.22);
  line-height: 1;
  resize: none;
  outline: 0;
  white-space: pre;
}

.pdf-inline-text-editor.is-visible {
  display: block;
}

.pdf-inline-fragment-editor {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: none;
  pointer-events: none;
}

.pdf-inline-fragment-editor.is-visible {
  display: block;
}

.pdf-inline-fragment-editor.is-visible .pdf-inline-fragment-input {
  display: block;
  pointer-events: auto;
}

.pdf-inline-fragment-input {
  min-width: 24px;
  padding: 4px 5px;
  text-align: left;
}

.pdf-inline-edit-tip {
  position: absolute;
  z-index: 9;
  display: none;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(23, 32, 42, 0.9);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
  white-space: nowrap;
}

.pdf-inline-edit-tip.is-visible {
  display: block;
}

.pdf-editor-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.5);
}

.pdf-editor-placeholder svg {
  width: 38px;
  height: 38px;
  color: var(--teal);
}

.pdf-editor-placeholder strong {
  color: var(--ink);
  font-size: 20px;
}

.pdf-editor-placeholder small {
  color: var(--muted);
  font-weight: 500;
}

.pdf-mode-hint {
  position: sticky;
  top: 10px;
  z-index: 5;
  width: fit-content;
  max-width: min(520px, calc(100% - 24px));
  margin: 0 auto 10px;
  padding: 9px 12px;
  border: 1px solid rgba(0, 124, 137, 0.22);
  border-radius: 8px;
  background: rgba(242, 251, 252, 0.96);
  color: var(--teal-dark);
  box-shadow: var(--shadow-soft);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.pdf-text-row-guide {
  position: absolute;
  min-height: 18px;
  border: 1px solid rgba(0, 124, 137, 0.7);
  border-radius: 4px;
  background: rgba(0, 124, 137, 0.08);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.78);
}

.pdf-text-row-guide span {
  position: absolute;
  left: -10px;
  top: -10px;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--teal);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
}

.pdf-text-row-guide em {
  position: absolute;
  left: 4px;
  bottom: 100%;
  max-width: 280px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(20, 36, 47, 0.88);
  color: #ffffff;
  font-size: 11px;
  font-style: normal;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdf-text-guide-loading,
.pdf-text-guide-empty {
  width: fit-content;
  max-width: min(420px, calc(100% - 24px));
  margin: 52px auto 0;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  box-shadow: var(--shadow-soft);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.pdf-edit-marker {
  position: absolute;
  white-space: normal;
  pointer-events: none;
}

.pdf-edit-marker.is-draft {
  outline: 1px solid rgba(0, 124, 137, 0.7);
}

.pdf-edit-marker.is-selected {
  outline: 2px solid rgba(74, 141, 247, 0.9);
  outline-offset: 2px;
}

.pdf-edit-cover {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  display: block;
  background: #ffffff;
  border: 1px dashed rgba(217, 93, 57, 0.55);
}

.pdf-edit-text {
  position: relative;
  z-index: 1;
  display: block;
  font-weight: 400;
  line-height: 1;
  white-space: pre;
}

.pdf-edit-text.is-link {
  color: #0d47a1 !important;
  text-decoration: underline;
}

.pdf-edit-text.is-signature {
  font-family: "Noto Sans Thai", cursive;
  font-weight: 700;
}

.pdf-edit-line {
  display: block;
  border-top: 2px solid var(--ink);
}

.pdf-edit-highlight {
  display: block;
  opacity: 0.45;
}

.pdf-edit-image {
  display: block;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.75);
  outline: 1px dashed rgba(0, 124, 137, 0.5);
}

.pdf-edit-note {
  display: block;
  overflow: hidden;
  padding: 8px;
  background: #fff3a6;
  border: 1px solid #d8a318;
  color: #3b2e0f;
  white-space: pre-wrap;
}

.pdf-edit-draw {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.pdf-edit-list {
  display: grid;
  gap: 8px;
}

.pdf-edit-row {
  display: grid;
  grid-template-columns: 1fr 32px 32px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.pdf-edit-row.is-selected {
  border-color: rgba(74, 141, 247, 0.65);
  background: #edf5ff;
}

.pdf-editor-app {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  background: #e9edf3;
}

.pdf-word-shell {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pdf-word-shell.is-empty .pdf-program-row,
.pdf-word-shell.is-empty .pdf-format-row,
.pdf-word-shell.is-empty .pdf-thumb-sidebar,
.pdf-word-shell.is-empty .pdf-inspector,
.pdf-word-shell.is-empty .pdf-bottom-controls,
.pdf-word-shell.is-empty .pdf-mode-hint,
.pdf-word-shell.is-empty #pdfPreviewCanvas,
.pdf-word-shell.is-empty #pdfEditLayer,
.pdf-word-shell.is-empty #pdfTextGuideLayer,
.pdf-word-shell.is-empty #pdfInlineTextEditor,
.pdf-word-shell.is-empty #pdfInlineFragmentEditor,
.pdf-word-shell.is-empty #pdfInlineEditTip {
  display: none;
}

.pdf-word-shell.is-empty #toggleThumbs,
.pdf-word-shell.is-empty #pdfUndo,
.pdf-word-shell.is-empty #pdfRedo,
.pdf-word-shell.is-empty [data-pdf-mode],
.pdf-word-shell.is-empty #savePdfEdits,
.pdf-word-shell.is-empty #pdfSearchInput,
.pdf-word-shell.is-empty #pdfSearchButton {
  display: none;
}

.pdf-word-shell.is-empty .pdf-word-row {
  justify-content: flex-end;
  min-height: 54px;
  padding: 6px 12px;
}

.pdf-word-shell.is-empty .pdf-word-main {
  grid-template-columns: minmax(0, 1fr);
}

.pdf-word-shell.is-empty .pdf-document-area {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}

.pdf-word-shell.is-empty .pdf-editor-app .pdf-editor-stage,
.pdf-word-shell.is-empty .pdf-editor-stage {
  min-height: min(560px, calc(100vh - 120px));
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #f7fbff, #eef5fb);
}

.pdf-word-shell.is-empty .pdf-editor-placeholder {
  position: static;
  width: min(460px, calc(100% - 40px));
  min-height: 260px;
  border: 1px dashed #bad0e8;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 14px 38px rgba(37, 62, 91, 0.08);
}

.pdf-word-toolbar {
  position: relative;
  flex: 0 0 auto;
  z-index: 30;
  background: #ffffff;
  border-bottom: 1px solid #cfd8e3;
}

.pdf-word-row,
.pdf-program-row,
.pdf-format-row {
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-height: 58px;
  padding: 0 8px;
  overflow-x: auto;
}

.pdf-program-row {
  min-height: 76px;
  align-items: stretch;
  gap: 0;
  padding: 6px 10px 4px;
  background: #fbfcfe;
  border-top: 1px solid #edf1f6;
}

.pdf-ribbon-group {
  min-width: max-content;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 2px;
  padding: 0 10px;
  border-right: 1px solid #dbe4ef;
}

.pdf-ribbon-group:first-child {
  padding-left: 0;
}

.pdf-ribbon-group:last-child {
  border-right: 0;
}

.pdf-ribbon-buttons {
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.pdf-ribbon-label {
  color: #6b7788;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
}

.pdf-program-tab {
  min-width: 78px;
  min-height: 50px;
  display: grid;
  grid-template-rows: 22px auto;
  place-items: center;
  align-content: center;
  gap: 2px;
  flex: 0 0 auto;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #28384a;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pdf-program-tab svg {
  width: 20px;
  height: 20px;
}

.pdf-program-tab:hover,
.pdf-program-tab.is-active {
  border-color: rgba(74, 141, 247, 0.44);
  background: #eef5ff;
  color: #174ca6;
}

.pdf-format-row {
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: #f6f8fb;
}

.pdf-word-shell [data-pdf-mode],
.pdf-word-shell #pdfSearchInput,
.pdf-word-shell #pdfSearchButton,
.pdf-format-row > :not(#pdfEditStatus) {
  display: none !important;
}

.pdf-word-shell [data-pdf-mode="pointer"],
.pdf-word-shell [data-pdf-mode="smartText"] {
  display: grid !important;
}

.pdf-format-row {
  min-height: 38px;
  justify-content: center;
  padding: 4px 12px;
}

.pdf-tool-button {
  min-width: 74px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #17202a;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  padding: 8px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.pdf-tool-button:hover,
.pdf-tool-button.is-active {
  background: #fff0e8;
}

.pdf-tool-button:disabled {
  color: #9aa7b3;
  cursor: default;
}

.pdf-tool-button svg {
  width: 22px;
  height: 22px;
}

.pdf-toolbar-spacer {
  flex: 1 0 24px;
}

.pdf-icon-chip {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 4px;
  display: grid;
  place-items: center;
  background: transparent;
}

.pdf-icon-chip:hover,
.pdf-icon-chip.is-active {
  background: #ffe7dc;
  color: #d95d39;
}

.pdf-icon-chip.is-ready {
  background: #e7f8ef;
  color: #16824a;
}

.pdf-icon-chip.is-warning {
  background: #fff4df;
  color: #a55f00;
}

.pdf-icon-chip.is-loading {
  background: #edf5ff;
  color: #2157bf;
}

.pdf-icon-chip.is-loading svg {
  animation: pdfSpin 1s linear infinite;
}

@keyframes pdfSpin {
  to {
    transform: rotate(360deg);
  }
}

.pdf-color-input {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
}

.pdf-number-input,
.pdf-format-row select {
  height: 34px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  padding: 4px 8px;
}

.pdf-number-input {
  width: 76px;
}

.pdf-status-line {
  position: sticky;
  right: 0;
  z-index: 2;
  flex: 0 0 min(320px, 48vw);
  max-width: min(320px, 48vw);
  margin-left: auto;
  align-self: center;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f6f8fb;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-search-input,
.pdf-link-input {
  width: 140px;
  height: 34px;
  align-self: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
  background: #ffffff;
}

.pdf-link-input {
  display: none;
  width: 190px;
}

.pdf-link-input.is-visible {
  display: block;
}

.pdf-word-main {
  min-height: 0;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  flex: 1 1 auto;
  overflow: hidden;
}

.pdf-utility-ribbon {
  display: grid;
  grid-template-columns: minmax(180px, 230px) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  align-content: start;
  grid-auto-rows: max-content;
  flex: 0 0 auto;
  max-height: min(28vh, 190px);
  overflow: auto;
  padding: 8px 12px;
  border-bottom: 1px solid #d7dfe8;
  background:
    linear-gradient(135deg, rgba(239, 247, 255, 0.96), rgba(249, 241, 255, 0.96)),
    #f7fbff;
}

.pdf-utility-ribbon .pdf-utility-title {
  min-height: 0;
  padding: 10px;
  border: 1px solid #d7e2ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.pdf-utility-body {
  min-width: 0;
  padding: 8px;
  border: 1px solid #d7e2ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.pdf-utility-ribbon-body > .form-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  align-items: end;
}

.pdf-utility-ribbon-body .output {
  padding: 10px;
}

.pdf-current-file {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(74, 141, 247, 0.22);
  border-radius: 8px;
  background: #eff7ff;
}

.pdf-current-file svg {
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, #5f9fff, #8b7cf6);
}

.pdf-current-file strong,
.pdf-current-file span {
  display: block;
}

.pdf-current-file strong {
  color: #17345f;
  font-size: 13px;
}

.pdf-current-file span {
  min-width: 0;
  overflow: hidden;
  color: #4d6178;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-quick-actions {
  min-width: 0;
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
}

.pdf-current-file-compact {
  min-width: 190px;
  max-width: 260px;
  padding: 8px;
}

.pdf-current-file-compact svg {
  width: 30px;
  height: 30px;
  padding: 7px;
}

.pdf-inline-field {
  min-width: 150px;
  display: grid;
  gap: 4px;
  color: #43515e;
  font-size: 12px;
  font-weight: 800;
}

.pdf-inline-field-wide {
  min-width: min(320px, 100%);
  flex: 1 1 260px;
}

.pdf-inline-field input,
.pdf-inline-field select {
  height: 38px;
  border: 1px solid #cfdceb;
  border-radius: 8px;
  padding: 7px 10px;
  background: #f8fbff;
  font: inherit;
  font-weight: 600;
}

.pdf-action-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pdf-command-button {
  min-height: 38px;
  border: 1px solid #cfdceb;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  background: #ffffff;
  color: #24384f;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.pdf-command-button:hover {
  border-color: rgba(74, 141, 247, 0.6);
  background: #eef6ff;
  color: #225bc8;
}

.pdf-command-button.is-primary {
  border-color: rgba(74, 141, 247, 0.45);
  background: #4a8df7;
  color: #ffffff;
}

.pdf-command-button.is-danger {
  border-color: rgba(238, 99, 82, 0.45);
  background: #fff3f1;
  color: #c94d3b;
}

.pdf-command-button svg {
  width: 17px;
  height: 17px;
}

.pdf-inline-status {
  min-height: 38px;
  display: flex;
  align-items: center;
  flex: 1 1 220px;
  padding: 7px 10px;
  border: 1px solid #d9e7ef;
  border-radius: 8px;
  background: #f6fbfc;
  color: #4d6178;
  font-size: 12px;
  font-weight: 700;
}

.pdf-thumb-sidebar {
  min-height: 0;
  overflow: auto;
  padding: 14px;
  background: #f5f7fa;
  border-right: 1px solid #d7dfe8;
}

.pdf-thumb-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  color: #43515e;
  font-weight: 700;
}

.pdf-thumb-list {
  display: grid;
  gap: 16px;
}

.pdf-thumb-card {
  border: 2px solid transparent;
  border-radius: 4px;
  background: transparent;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 0;
  color: #43515e;
  font-weight: 700;
}

.pdf-thumb-card canvas {
  width: 178px;
  max-width: 100%;
  height: auto;
  background: #ffffff;
  border: 1px solid #d5dde6;
  box-shadow: 0 2px 8px rgba(23, 32, 42, 0.12);
}

.pdf-thumb-card span {
  min-width: 40px;
  min-height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #d9e1ea;
}

.pdf-thumb-card.is-active canvas {
  border-color: #ff3b30;
  box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.12);
}

.pdf-thumb-card.is-active span {
  background: #ff4b45;
  color: #ffffff;
}

.pdf-document-area {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.pdf-editor-app .pdf-editor-stage {
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #eef2f7;
}

.pdf-editor-app .pdf-editor-stage canvas {
  margin: 0 auto 32px;
}

.pdf-bottom-controls {
  min-height: 42px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  background: rgba(23, 32, 42, 0.82);
  color: #ffffff;
}

.pdf-bottom-controls input {
  width: 54px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  text-align: center;
}

.pdf-zoom-select {
  height: 30px;
  border: 0;
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  outline: 0;
}

.pdf-zoom-select option {
  color: #17202a;
}

.pdf-mini-button {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: transparent;
  color: #ffffff;
}

.pdf-fit-button {
  width: 34px;
}

.pdf-inspector {
  min-height: 0;
  overflow: auto;
  display: none;
  align-content: start;
  gap: 12px;
  padding: 16px;
  background: #ffffff;
  border-left: 1px solid #d7dfe8;
}

.pdf-inspector h2 {
  margin: 0;
  font-size: 18px;
}

.pdf-inspector textarea,
.pdf-inspector input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #f8fafc;
}

.pdf-inspector textarea {
  min-height: 110px;
  resize: vertical;
}

#pdfEditFilename,
#addPdfEditSide,
#clearPdfEdits,
#pdfAdvancedPanel,
#pdfReplacementRegistry {
  display: none !important;
}

.pdf-advanced-panel {
  display: grid;
  gap: 10px;
  border: 1px solid #dbe6ef;
  border-radius: 8px;
  background: #fbfdff;
}

.pdf-advanced-panel summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  color: #31475f;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.pdf-advanced-panel[open] {
  padding: 0 10px 10px;
}

.pdf-advanced-panel[open] summary {
  margin: 0 -10px 2px;
  border-bottom: 1px solid #e5edf5;
}

.pdf-match-note {
  padding: 9px 10px;
  border: 1px solid #d7e7ea;
  border-radius: 8px;
  background: #f2fbfc;
  color: #43616d;
  font-size: 12px;
  line-height: 1.45;
}

.pdf-smart-strategy {
  display: grid;
  gap: 6px;
  color: #43515e;
  font-size: 12px;
  font-weight: 800;
}

.pdf-smart-strategy select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #f8fafc;
  color: #233142;
  font-weight: 800;
}

.pdf-strategy-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #dbe6ef;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.pdf-strategy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pdf-strategy-head strong {
  color: #233142;
  font-size: 12px;
  font-weight: 900;
}

.pdf-strategy-head span {
  min-width: 46px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.pdf-strategy-head span.is-great {
  background: #16824a;
}

.pdf-strategy-head span.is-good {
  background: #1c6ed3;
}

.pdf-strategy-head span.is-risk {
  background: #b65b00;
}

.pdf-strategy-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.pdf-strategy-meta span {
  min-height: 28px;
  display: grid;
  align-items: center;
  padding: 6px 8px;
  border-radius: 7px;
  background: #eef5ff;
  color: #35506f;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.pdf-strategy-native {
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.pdf-strategy-native.is-ready {
  border: 1px solid #b9e4cb;
  background: #ecfbf2;
  color: #17613a;
}

.pdf-strategy-native.is-fallback {
  border: 1px solid #f2d3a8;
  background: #fff7e9;
  color: #8a4a03;
}

.pdf-strategy-card p {
  margin: 0;
  color: #647284;
  font-size: 11px;
  line-height: 1.45;
}

.pdf-compare-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid #d7dfe8;
  border-radius: 8px;
  background: #f5f8fb;
}

.pdf-compare-switch button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #536273;
  font-size: 12px;
  font-weight: 800;
}

.pdf-compare-switch button.is-active {
  background: #ffffff;
  color: #1346a3;
  box-shadow: 0 1px 5px rgba(20, 46, 80, 0.14);
}

.pdf-inspector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pdf-inspector-grid label {
  display: grid;
  gap: 5px;
  color: #43515e;
  font-size: 12px;
  font-weight: 700;
}

.pdf-smart-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.pdf-smart-actions .ghost-button {
  min-height: 34px;
  justify-content: center;
  padding: 7px 8px;
  font-size: 11px;
  white-space: nowrap;
}

.pdf-smart-actions .ghost-button svg {
  width: 15px;
  height: 15px;
}

.pdf-export-mode {
  display: grid;
  gap: 6px;
  color: #43515e;
  font-size: 12px;
  font-weight: 800;
}

.pdf-export-mode select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #f8fafc;
}

.pdf-qa-panel {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid #dbe6ef;
  border-radius: 8px;
  background: #fbfdff;
}

.pdf-qa-empty {
  display: grid;
  gap: 4px;
  color: #647284;
  font-size: 12px;
  line-height: 1.4;
}

.pdf-qa-empty strong,
.pdf-qa-head strong {
  color: #233142;
  font-size: 12px;
  font-weight: 900;
}

.pdf-qa-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pdf-qa-head span {
  min-width: 46px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.pdf-qa-head span.is-great {
  background: #16824a;
}

.pdf-qa-head span.is-good {
  background: #1c6ed3;
}

.pdf-qa-head span.is-risk {
  background: #b65b00;
}

.pdf-qa-bars {
  display: grid;
  gap: 6px;
}

.pdf-qa-meter {
  display: grid;
  grid-template-columns: 58px 1fr 38px;
  align-items: center;
  gap: 7px;
  color: #506070;
  font-size: 11px;
  font-weight: 800;
}

.pdf-qa-meter i {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5edf5;
}

.pdf-qa-meter b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #62c4c3, #4a8df7);
}

.pdf-qa-meter em {
  color: #34465c;
  font-style: normal;
  text-align: right;
}

.pdf-qa-note {
  color: #647284;
  font-size: 11px;
  line-height: 1.4;
}

.pdf-replacement-registry {
  display: grid;
  gap: 7px;
  padding-top: 12px;
  border-top: 1px solid #d7dfe8;
}

.pdf-registry-title {
  color: #233142;
  font-size: 12px;
  font-weight: 900;
}

.pdf-registry-empty {
  color: #788595;
  font-size: 12px;
  line-height: 1.4;
}

.pdf-registry-row {
  display: grid;
  gap: 2px;
  padding: 7px 8px;
  border: 1px solid #e0e8f0;
  border-radius: 8px;
  background: #f8fbff;
  font-size: 11px;
}

.pdf-registry-row span,
.pdf-registry-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-editor-stage.is-compare-before .pdf-edit-layer {
  display: none;
}

.pdf-editor-stage.is-compare-overlay .pdf-edit-layer {
  opacity: 0.66;
}

.pdf-utility-box {
  display: grid;
  gap: 12px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid #d7dfe8;
}

.pdf-utility-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.pdf-utility-head h2 {
  margin: 0;
  font-size: 16px;
}

.pdf-utility-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pdf-utility-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pdf-utility-button {
  min-height: 42px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  color: #34465c;
  text-align: left;
  font-size: 12px;
  font-weight: 800;
}

.pdf-utility-button:hover,
.pdf-utility-button.is-active {
  border-color: rgba(74, 141, 247, 0.55);
  background: #edf5ff;
  color: #2157bf;
}

.pdf-utility-button svg {
  width: 18px;
  height: 18px;
}

.pdf-utility-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-utility-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #d7dfe8;
  border-radius: 8px;
  background: #ffffff;
}

.pdf-utility-empty {
  min-height: 74px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.pdf-utility-title {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.pdf-utility-title svg {
  width: 34px;
  height: 34px;
  padding: 8px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6aa5ff, #8a78f6);
  color: #ffffff;
}

.pdf-utility-title strong,
.pdf-utility-title span {
  display: block;
}

.pdf-utility-title strong {
  color: var(--ink);
  font-size: 14px;
}

.pdf-utility-title span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.pdf-utility-panel .form-grid {
  gap: 10px;
}

.pdf-utility-panel .field label {
  font-size: 12px;
}

.pdf-utility-panel .actions {
  gap: 8px;
}

@media (max-width: 1380px) {
  .document-builder {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 14px;
  }

  .category-list {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: 1fr;
    overflow-x: visible;
    padding-bottom: 2px;
  }

  .category-button {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tools-dashboard,
  .tool-shelf-grid,
  .seo-content {
    grid-template-columns: 1fr;
  }

  .seo-link-primary,
  .seo-link-more div {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .app-hero {
    grid-template-columns: 1fr;
    margin: 18px 18px 0;
    padding: 28px;
  }

  .hero-copy {
    max-width: 680px;
  }

  .hero-copy h2 {
    font-size: 54px;
  }

  .hero-visual {
    min-height: 236px;
  }

  .tool-panel {
    position: static;
  }

  .document-builder {
    grid-template-columns: 1fr;
  }

  .document-preview-shell {
    overflow-x: auto;
  }

  body.has-active-tool .tool-browser {
    order: 2;
  }

  body.has-active-tool .tool-panel {
    order: 1;
  }

  .pdf-word-main {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .pdf-inspector {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid #d7dfe8;
  }

  .pdf-utility-ribbon {
    grid-template-columns: 1fr;
    max-height: min(30vh, 220px);
  }

  .pdf-utility-ribbon .pdf-utility-title {
    display: none;
  }

  .pdf-utility-ribbon-body > .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .party-game {
    grid-template-columns: 1fr;
  }

  .party-game-board {
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .topbar,
  .content-grid {
    padding: 14px;
  }

  .app-hero {
    min-height: auto;
    margin: 14px 14px 0;
    padding: 22px;
  }

  .seo-content {
    margin: 14px 14px 0;
    padding: 14px;
  }

  .seo-link-grid {
    gap: 7px;
  }

  .seo-link-primary,
  .seo-link-more div {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .seo-link-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-copy h2 {
    font-size: 42px;
  }

  .hero-copy p {
    font-size: 14px;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-actions .primary-button,
  .hero-actions .secondary-button {
    width: 100%;
  }

  .random-tabs,
  .random-suspense-control,
  .random-wheel-manager-row,
  .random-wheel-preset-row,
  .random-wheel-command-grid,
  .random-option-grid,
  .party-game,
  .party-actions,
  .party-action-switches,
  .party-option-tools,
  .converter-tabs {
    grid-template-columns: 1fr;
  }

  .party-game-board,
  .party-control-panel {
    padding: 12px;
  }

  .party-wheel-stage {
    width: min(420px, 100%);
  }

  .party-wheel-label {
    max-width: 104px;
    font-size: 13px;
  }

  .party-wheel-label b {
    padding: 5px 8px;
  }

  .party-wheel-center {
    width: min(138px, 42%);
    padding: 14px;
  }

  .random-dice-stage {
    grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
    padding: 14px;
  }

  .random-wheel-stage {
    width: min(420px, 100%);
  }

  .random-wheel-label {
    max-width: 106px;
    font-size: 13px;
  }

  .random-wheel-label b {
    max-width: 106px;
    padding: 5px 8px;
  }

  .random-wheel-center {
    bottom: 14px;
    max-width: 76%;
    padding: 7px 10px;
  }

  .random-wheel-fullscreen {
    grid-template-columns: 1fr;
    overflow: auto;
    padding: 12px;
  }

  .random-wheel-fullscreen-head h3 {
    font-size: 22px;
  }

  .random-wheel-stage-full {
    width: min(88vw, 64vh);
  }

  .random-wheel-stage-full .random-wheel-label {
    max-width: 112px;
    font-size: 13px;
  }

  .random-wheel-stage-full .random-wheel-label b {
    max-width: 112px;
    padding: 5px 8px;
  }

  .random-wheel-fullscreen-panel {
    padding: 12px;
  }

  .random-wheel-fullscreen-panel .actions {
    grid-template-columns: 1fr;
  }

  .random-team-presentation {
    padding: 14px;
  }

  .random-team-presentation-burst span {
    width: 6px;
    height: 12px;
  }

  .random-team-presentation-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .random-team-presentation-head h3 {
    font-size: 32px;
  }

  .random-team-presentation-actions {
    width: 100%;
  }

  .random-team-presentation-actions .secondary-button {
    flex: 1 1 auto;
  }

  .random-team-presentation-card li {
    padding-inline: 8px;
  }

  .random-team-empty-state,
  .random-team-mixer-copy,
  .random-team-result-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .random-team-mixer-stage {
    min-height: 164px;
  }

  .random-team-mixer-chip {
    max-width: 46%;
    font-size: 11px;
  }

  .random-team-result-grid {
    grid-template-columns: 1fr;
  }

  .random-die {
    width: 50px;
    height: 50px;
  }

  .random-die span {
    width: 33px;
    height: 33px;
    font-size: 21px;
  }

  .random-die-face,
  .random-die-number {
    width: 33px;
    height: 33px;
  }

  .random-die-face {
    gap: 3px;
    padding: 6px;
  }

  .random-die-face i {
    width: 5px;
    height: 5px;
  }

  .random-result-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .random-result-actions {
    width: 100%;
    justify-content: space-between;
  }

  .hero-visual {
    min-height: 230px;
    overflow: hidden;
  }

  .hero-phone {
    min-width: 178px;
    width: 178px;
  }

  .hero-widget-chart {
    left: 0;
    top: 42%;
    width: 116px;
  }

  .hero-widget-search,
  .hero-widget-tools {
    right: -18px;
    width: 132px;
  }

  .hero-gear-a {
    left: 12%;
    width: 36px;
    height: 36px;
  }

  .hero-gear-b {
    right: 2%;
    width: 44px;
    height: 44px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .brand {
    grid-template-columns: 42px 1fr;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .sidebar {
    gap: 14px;
    overflow: hidden;
  }

  .category-list {
    width: 100%;
    max-width: 100%;
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: 1fr;
    overflow-x: visible;
  }

  .category-button {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }

  .section-head {
    align-items: start;
  }

  .panel-title {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .panel-back-button {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
  }

  .tools-grid,
  .tools-dashboard,
  .tool-shelf-grid,
  .image-studio-drop,
  .image-studio-preview-grid,
  .two-col,
  .three-col,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .image-studio-drop > div {
    grid-template-columns: 38px 1fr;
  }

  .image-studio-upload,
  #loadImageStudioSamples,
  .image-studio-actions .primary-button,
  .image-studio-actions .secondary-button,
  .image-studio-actions .ghost-button {
    width: 100%;
    justify-content: center;
  }

  .image-studio-file,
  .image-studio-result {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .image-studio-file .icon-only {
    grid-column: 2;
    justify-self: end;
  }

  .random-tabs,
  .random-suspense-control,
  .random-wheel-manager-row,
  .random-wheel-preset-row,
  .random-wheel-command-grid,
  .random-option-grid,
  .converter-tabs {
    grid-template-columns: 1fr;
  }

  .document-controls {
    padding: 12px;
  }

  .document-control-head,
  .document-section-row,
  .document-preview-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-item {
    grid-template-columns: 28px 1fr 1fr;
  }

  .document-profile-actions,
  .document-profile-bar,
  .document-logo-control,
  .document-quick-panel,
  .document-convert-panel {
    grid-template-columns: 1fr;
  }

  .document-profile-actions {
    width: 100%;
    justify-content: stretch;
  }

  .document-profile-actions .secondary-button,
  .document-profile-actions .ghost-button,
  .document-quick-panel .secondary-button,
  .document-quick-panel .ghost-button {
    width: 100%;
    justify-content: center;
  }

  .document-bank-head {
    align-items: flex-start;
  }

  .document-bank-grid {
    grid-template-columns: 1fr;
  }

  .document-signature-card {
    grid-template-columns: 28px 1fr 34px;
  }

  .document-signature-card .field {
    grid-column: 2 / -1;
  }

  .document-signature-card .icon-only {
    grid-column: 3;
    justify-self: end;
  }

  .document-item input[data-field="desc"] {
    grid-column: 2 / -1;
  }

  .document-item .icon-only {
    grid-column: 3;
    justify-self: end;
  }

  .document-paper {
    width: 720px;
    min-height: 1018px;
    margin: 10px;
    padding: 34px;
  }

  body:not(.has-active-tool) .tool-panel {
    display: none;
  }

  .pdf-word-row {
    min-height: 54px;
  }

  .pdf-tool-button {
    min-width: 64px;
    padding: 7px 8px;
  }

  .pdf-word-main {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .pdf-utility-ribbon {
    max-height: min(32vh, 260px);
  }

  .pdf-utility-ribbon-body > .form-grid {
    grid-template-columns: 1fr;
  }

  .pdf-thumb-sidebar {
    max-height: 220px;
    border-right: 0;
    border-bottom: 1px solid #d7dfe8;
  }

  .pdf-thumb-list {
    grid-auto-flow: column;
    grid-auto-columns: 130px;
    overflow-x: auto;
  }

  .pdf-editor-app .pdf-editor-stage {
    height: 540px;
    min-height: 360px;
  }
}

/* Visual polish layer - final overrides */
:root {
  --bg: #f2f7ff;
  --surface: #ffffff;
  --surface-strong: #f7fbff;
  --ink: #111827;
  --muted: #617089;
  --line: #d8e3f2;
  --teal: #3478f6;
  --teal-dark: #1d4ed8;
  --coral: #f05a96;
  --green: #18a058;
  --yellow: #f4b740;
  --blue: #5b8cff;
  --violet: #7c5cf6;
  --pink: #ec66b4;
  --sky: #65c7f7;
  --glass: rgba(255, 255, 255, 0.78);
  --shadow: 0 26px 70px rgba(40, 73, 130, 0.18);
  --shadow-soft: 0 14px 34px rgba(40, 73, 130, 0.1);
  --shadow-card: 0 18px 42px rgba(35, 63, 112, 0.12);
  --focus: 0 0 0 4px rgba(52, 120, 246, 0.18);
}

body {
  background:
    linear-gradient(115deg, rgba(101, 199, 247, 0.18) 0 22%, transparent 22% 100%),
    linear-gradient(245deg, rgba(240, 90, 150, 0.13) 0 18%, transparent 18% 100%),
    linear-gradient(135deg, #eef6ff 0%, #f9f3ff 46%, #eefaf6 100%);
  background-attachment: fixed;
}

.app-shell {
  isolation: isolate;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 250, 255, 0.78)),
    var(--glass);
  border-right-color: rgba(126, 152, 197, 0.24);
  box-shadow: 22px 0 58px rgba(47, 76, 128, 0.11);
}

.brand {
  padding: 8px;
  border: 1px solid rgba(125, 156, 218, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.52);
}

.brand-mark {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.32), transparent 42%),
    linear-gradient(135deg, #3478f6, #ec66b4 56%, #f4b740);
  box-shadow:
    0 14px 30px rgba(52, 120, 246, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.category-button {
  overflow: hidden;
  border: 1px solid transparent;
}

.category-button:hover,
.category-button.is-active {
  border-color: rgba(125, 156, 218, 0.22);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(248, 251, 255, 0.72));
  box-shadow: 0 12px 28px rgba(47, 76, 128, 0.1);
}

.category-button.is-active::before {
  background: linear-gradient(180deg, #3478f6, #ec66b4, #f4b740);
}

.category-button.is-active svg {
  color: #1d4ed8;
}

.category-count {
  background: linear-gradient(135deg, rgba(52, 120, 246, 0.15), rgba(236, 102, 180, 0.12));
}

.topbar {
  grid-template-columns: minmax(240px, 720px);
  background: rgba(248, 251, 255, 0.78);
  box-shadow: 0 12px 34px rgba(53, 84, 138, 0.08);
}

.search-wrap {
  border-color: rgba(125, 156, 218, 0.34);
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 14px 34px rgba(47, 76, 128, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.search-wrap:focus-within {
  border-color: rgba(52, 120, 246, 0.58);
}

.ghost-button,
.panel-action,
.copy-button,
.primary-button,
.secondary-button,
.danger-button {
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(35, 63, 112, 0.06);
}

.primary-button {
  border-color: #3478f6;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent 42%),
    linear-gradient(135deg, #3478f6, #7c5cf6);
  box-shadow: 0 14px 30px rgba(52, 120, 246, 0.24);
}

.primary-button:hover {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 42%),
    linear-gradient(135deg, #1d4ed8, #6d4cf6);
  transform: translateY(-1px);
}

.secondary-button:hover,
.ghost-button:hover,
.panel-action:hover,
.copy-button:hover {
  border-color: rgba(52, 120, 246, 0.28);
  background: #ffffff;
  transform: translateY(-1px);
}

.app-hero {
  min-height: 190px;
  border-color: rgba(125, 156, 218, 0.28);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.82), transparent 48%),
    linear-gradient(135deg, #d9edff 0%, #f8e9ff 47%, #ddf6ee 100%);
  box-shadow:
    0 34px 90px rgba(45, 76, 130, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.app-hero::before {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.72), transparent 58%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 74px),
    repeating-linear-gradient(0deg, rgba(63, 91, 148, 0.05) 0 1px, transparent 1px 74px);
}

.app-hero::after {
  content: "";
  position: absolute;
  inset: auto 34px 22px 34px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(52, 120, 246, 0.34), rgba(236, 102, 180, 0.3), transparent);
}

.hero-kicker {
  border-color: rgba(52, 120, 246, 0.18);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 10px 22px rgba(47, 76, 128, 0.08);
}

.hero-copy h2 {
  color: transparent;
  background: linear-gradient(105deg, #0f172a 0%, #1d4ed8 44%, #db2777 84%);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-actions .primary-button,
.hero-actions .secondary-button {
  min-height: 40px;
}

.hero-phone {
  transform: rotate(1.5deg);
  box-shadow:
    0 34px 70px rgba(76, 91, 159, 0.24),
    inset 0 0 0 1px rgba(104, 139, 218, 0.1);
}

.hero-widget {
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 18px 42px rgba(68, 97, 160, 0.14);
}

.hero-widget-chart {
  animation: visualFloatA 5.6s ease-in-out infinite;
}

.hero-widget-search,
.hero-widget-tools {
  animation: visualFloatB 6.2s ease-in-out infinite;
}

.hero-gear {
  animation: visualSlowSpin 16s linear infinite;
}

.seo-content,
.tool-shelf,
.tool-panel,
.random-panel,
.random-result-card,
.random-history,
.party-game-board,
.party-control-panel,
.party-history,
.party-result-card {
  border-color: rgba(125, 156, 218, 0.25);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 251, 255, 0.86)),
    #ffffff;
  box-shadow: var(--shadow-card);
}

.content-grid {
  gap: 24px;
}

.section-head {
  padding: 0 2px;
}

.section-head h2 {
  font-size: 30px;
  color: #0f172a;
}

.result-count {
  border: 1px solid rgba(52, 120, 246, 0.16);
  background: rgba(52, 120, 246, 0.1);
}

.tools-grid {
  gap: 18px;
}

.tool-card {
  overflow: hidden;
  border-color: rgba(125, 156, 218, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.92)),
    #ffffff;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 12px 26px rgba(35, 63, 112, 0.08);
}

.tool-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #3478f6, #65c7f7, #ec66b4, #f4b740);
  opacity: 0;
  transition: opacity 180ms ease;
}

.tool-card::after {
  content: "";
  position: absolute;
  inset: auto 16px 14px;
  height: 1px;
  background: linear-gradient(90deg, rgba(52, 120, 246, 0.18), transparent);
  opacity: 0.6;
}

.tool-card:hover,
.tool-card:focus-visible,
.tool-card.is-active {
  border-color: rgba(52, 120, 246, 0.38);
  box-shadow: 0 24px 58px rgba(35, 63, 112, 0.16);
  transform: translateY(-4px);
}

.tool-card:hover::before,
.tool-card:focus-visible::before,
.tool-card.is-active::before {
  opacity: 1;
}

.tool-icon {
  box-shadow:
    inset 0 -12px 18px rgba(0, 0, 0, 0.1),
    0 12px 24px rgba(35, 63, 112, 0.15);
}

.tool-icon.productivity {
  background: linear-gradient(135deg, #3478f6, #65c7f7);
}

.tool-icon.documents {
  background: linear-gradient(135deg, #5b8cff, #7c5cf6);
}

.tool-icon.images {
  background: linear-gradient(135deg, #f97316, #f05a96);
}

.tool-icon.hr {
  background: linear-gradient(135deg, #18a058, #65c7f7);
}

.tool-icon.communication {
  background: linear-gradient(135deg, #ec66b4, #f4b740);
}

.tool-icon.generators {
  background: linear-gradient(135deg, #7c5cf6, #ec66b4);
}

.tool-icon.random {
  background: linear-gradient(135deg, #2563eb, #7c5cf6);
}

.tool-icon.daily {
  background: linear-gradient(135deg, #0f766e, #f4b740);
}

.tool-open {
  width: fit-content;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(52, 120, 246, 0.08);
}

.tool-card:hover .tool-open {
  background: rgba(52, 120, 246, 0.13);
}

.tool-panel {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.tool-panel::before {
  height: 5px;
  background: linear-gradient(90deg, #3478f6, #65c7f7, #f4b740, #f05a96);
}

.panel-content {
  gap: 20px;
}

.panel-title {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(125, 156, 218, 0.18);
}

.field input,
.field textarea,
.field select {
  border-color: rgba(125, 156, 218, 0.34);
  background: rgba(248, 251, 255, 0.9);
}

.field input:hover,
.field textarea:hover,
.field select:hover {
  border-color: rgba(52, 120, 246, 0.36);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: #3478f6;
  box-shadow: var(--focus);
}

.output {
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.96), rgba(255, 255, 255, 0.96)),
    #ffffff;
}

.random-tabs,
.converter-tabs {
  padding: 7px;
  border-color: rgba(125, 156, 218, 0.26);
  background: rgba(238, 246, 255, 0.82);
}

.random-tab,
.converter-tab {
  min-height: 42px;
}

.random-tab.is-active,
.converter-tab.is-active {
  background:
    linear-gradient(180deg, #ffffff, #f7fbff);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.13);
}

.random-suspense-control,
.random-wheel-manager,
.random-check-card,
.party-safe-note,
.party-safety {
  border-color: rgba(125, 156, 218, 0.25);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 251, 255, 0.9));
}

.random-wheel-stage,
.party-wheel-stage {
  filter: drop-shadow(0 24px 42px rgba(37, 99, 235, 0.14));
}

.random-wheel-disc,
.party-wheel-disc {
  border-width: 12px;
  box-shadow:
    0 22px 58px rgba(37, 99, 235, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.44);
}

.random-wheel-pointer,
.party-wheel-pointer {
  border-top-color: #111827;
}

.random-wheel-name-list span,
.party-history-item,
.world-time-card {
  border-color: rgba(125, 156, 218, 0.25);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 18px rgba(35, 63, 112, 0.06);
}

.random-result-card,
.random-history {
  position: relative;
  overflow: hidden;
}

.random-result-card::before,
.random-history::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #3478f6, #ec66b4, #f4b740);
}

.random-result-head {
  position: relative;
  z-index: 1;
}

.random-dice-stage {
  border-color: rgba(125, 156, 218, 0.28);
  background:
    linear-gradient(180deg, rgba(238, 246, 255, 0.88), rgba(255, 255, 255, 0.98)),
    linear-gradient(90deg, rgba(52, 120, 246, 0.08), rgba(236, 102, 180, 0.07));
}

.random-die {
  border-radius: 14px;
  box-shadow:
    0 16px 28px rgba(37, 99, 235, 0.16),
    inset 0 -10px 18px rgba(37, 99, 235, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.random-popup-panel,
.random-wheel-winner-card {
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff, #f8fbff);
}

.party-game {
  gap: 18px;
}

.party-game-board {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(247, 251, 255, 0.9)),
    linear-gradient(120deg, rgba(52, 120, 246, 0.08), rgba(236, 102, 180, 0.06));
}

.party-control-panel {
  position: sticky;
  top: 96px;
}

@keyframes visualFloatA {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

@keyframes visualFloatB {
  0%,
  100% {
    transform: translateY(0) translateX(0);
  }

  50% {
    transform: translateY(8px) translateX(-4px);
  }
}

@keyframes visualSlowSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes randomParkLight {
  0%,
  100% {
    opacity: 0.58;
    transform: translateY(0) scale(0.9);
  }
  50% {
    opacity: 1;
    transform: translateY(-1px) scale(1.08);
  }
}

.random-tool {
  --random-accent: #2563eb;
  --random-accent-dark: #1d4ed8;
  --random-accent-soft: rgba(37, 99, 235, 0.12);
  --random-accent-faint: rgba(37, 99, 235, 0.06);
  --random-panel-bg: #f3f7ff;
  position: relative;
  padding: 14px;
  border: 1px solid rgba(125, 156, 218, 0.28);
  border-radius: 12px;
  background:
    radial-gradient(circle at 9% 12%, rgba(255, 204, 76, 0.22), transparent 23%),
    radial-gradient(circle at 88% 14%, rgba(236, 102, 180, 0.18), transparent 27%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(242, 248, 255, 0.9)),
    #ffffff;
  box-shadow:
    0 24px 70px rgba(42, 72, 128, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
  overflow: hidden;
}

.random-tool::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  background: linear-gradient(90deg, #3478f6, #65c7f7, #f4b740, #f05a96, #7c5cf6);
}

.random-park-lights {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(16, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(125, 156, 218, 0.2);
  border-radius: 999px;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.86) 0 14px, rgba(255, 244, 214, 0.82) 14px 28px),
    #ffffff;
  box-shadow:
    0 16px 30px rgba(35, 63, 112, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.random-park-lights span {
  justify-self: center;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: hsl(calc(210deg + (var(--i) * 28deg)), 88%, 62%);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.82),
    0 0 18px hsl(calc(210deg + (var(--i) * 28deg)), 88%, 62%);
  animation: randomParkLight 1700ms ease-in-out calc(var(--i) * -90ms) infinite;
}

.random-tool[data-random-mode="number"] {
  --random-accent: #2563eb;
  --random-accent-dark: #1d4ed8;
  --random-accent-soft: rgba(37, 99, 235, 0.14);
  --random-accent-faint: rgba(37, 99, 235, 0.07);
  --random-panel-bg: #eff6ff;
}

.random-tool[data-random-mode="list"] {
  --random-accent: #0891b2;
  --random-accent-dark: #0e7490;
  --random-accent-soft: rgba(8, 145, 178, 0.14);
  --random-accent-faint: rgba(8, 145, 178, 0.07);
  --random-panel-bg: #ecfeff;
}

.random-tool[data-random-mode="team"] {
  --random-accent: #7c3aed;
  --random-accent-dark: #6d28d9;
  --random-accent-soft: rgba(124, 58, 237, 0.15);
  --random-accent-faint: rgba(124, 58, 237, 0.07);
  --random-panel-bg: #f5f3ff;
}

.random-tool[data-random-mode="wheel"] {
  --random-accent: #e11d48;
  --random-accent-dark: #be123c;
  --random-accent-soft: rgba(225, 29, 72, 0.14);
  --random-accent-faint: rgba(225, 29, 72, 0.07);
  --random-panel-bg: #fff1f2;
}

.random-tool[data-random-mode="dice"] {
  --random-accent: #ea580c;
  --random-accent-dark: #c2410c;
  --random-accent-soft: rgba(234, 88, 12, 0.14);
  --random-accent-faint: rgba(234, 88, 12, 0.07);
  --random-panel-bg: #fff7ed;
}

.random-tool[data-random-mode="coin"] {
  --random-accent: #ca8a04;
  --random-accent-dark: #a16207;
  --random-accent-soft: rgba(202, 138, 4, 0.16);
  --random-accent-faint: rgba(202, 138, 4, 0.08);
  --random-panel-bg: #fefce8;
}

.random-tool[data-random-mode="password"] {
  --random-accent: #0f766e;
  --random-accent-dark: #115e59;
  --random-accent-soft: rgba(15, 118, 110, 0.15);
  --random-accent-faint: rgba(15, 118, 110, 0.07);
  --random-panel-bg: #f0fdfa;
}

.random-tabs {
  gap: 10px;
  padding: 10px;
  border-color: rgba(30, 64, 175, 0.2);
  background:
    linear-gradient(90deg, rgba(52, 120, 246, 0.08), rgba(244, 183, 64, 0.1), rgba(236, 102, 180, 0.08)),
    linear-gradient(180deg, #ffffff, #eef6ff),
    #eef6ff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.78);
}

.random-tab {
  min-height: 46px;
  border-color: rgba(125, 156, 218, 0.3);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 252, 255, 0.92)),
    #ffffff;
  color: #243447;
  box-shadow:
    0 8px 16px rgba(35, 63, 112, 0.06),
    inset 0 -2px 0 rgba(35, 63, 112, 0.04);
}

.random-tab[data-random-mode="number"] {
  --tab-color: #2563eb;
}

.random-tab[data-random-mode="list"] {
  --tab-color: #0891b2;
}

.random-tab[data-random-mode="team"] {
  --tab-color: #7c3aed;
}

.random-tab[data-random-mode="wheel"] {
  --tab-color: #e11d48;
}

.random-tab[data-random-mode="dice"] {
  --tab-color: #ea580c;
}

.random-tab[data-random-mode="coin"] {
  --tab-color: #ca8a04;
}

.random-tab[data-random-mode="password"] {
  --tab-color: #0f766e;
}

.random-tab svg {
  color: var(--tab-color, #2563eb);
  stroke-width: 2.4;
}

.random-tab:hover {
  border-color: color-mix(in srgb, var(--tab-color, #2563eb) 42%, white);
  background:
    linear-gradient(180deg, #ffffff, color-mix(in srgb, var(--tab-color, #2563eb) 10%, white));
  transform: translateY(-2px);
}

.random-tab.is-active {
  border-color: var(--tab-color, #2563eb);
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.28), transparent 28%),
    linear-gradient(135deg, var(--tab-color, #2563eb), color-mix(in srgb, var(--tab-color, #2563eb) 72%, #f05a96));
  color: #ffffff;
  box-shadow:
    0 16px 30px color-mix(in srgb, var(--tab-color, #2563eb) 28%, transparent),
    inset 0 -3px 0 rgba(0, 0, 0, 0.1);
}

.random-tab.is-active svg {
  color: #ffffff;
}

.random-suspense-control {
  border: 1px solid color-mix(in srgb, var(--random-accent) 30%, white);
  border-left: 6px solid var(--random-accent);
  background:
    linear-gradient(90deg, var(--random-accent-faint), rgba(255, 255, 255, 0.96) 42%),
    #ffffff;
  box-shadow: 0 12px 26px rgba(35, 63, 112, 0.08);
}

.random-suspense-control strong,
.random-panel label,
.random-result-head h3 {
  color: #111827;
}

.random-suspense-control input[type="range"] {
  accent-color: var(--random-accent);
}

.random-suspense-control output {
  border-color: color-mix(in srgb, var(--random-accent) 32%, white);
  background: #ffffff;
  color: var(--random-accent-dark);
}

.random-panel.is-active {
  border: 1px solid color-mix(in srgb, var(--random-accent) 36%, white);
  border-left: 6px solid var(--random-accent);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), var(--random-panel-bg)),
    #ffffff;
  box-shadow:
    0 18px 42px rgba(35, 63, 112, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.random-team-panel.is-active {
  position: relative;
  grid-template-columns: minmax(280px, 0.92fr) minmax(360px, 1.08fr);
  grid-template-areas:
    "members stage"
    "settings stage"
    "names stage"
    "actions stage";
  align-items: start;
  gap: 14px 16px;
  padding: 22px 16px 16px;
  border-left: 0;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 248, 239, 0.74)),
    linear-gradient(135deg, rgba(244, 183, 64, 0.12), rgba(236, 102, 180, 0.1) 46%, rgba(101, 199, 247, 0.12)),
    #ffffff;
  box-shadow:
    0 24px 58px rgba(54, 66, 118, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
  overflow: hidden;
}

.random-team-panel.is-active::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 12px;
  background:
    repeating-linear-gradient(90deg, #f05a96 0 36px, #ffffff 36px 72px, #f4b740 72px 108px, #ffffff 108px 144px, #65c7f7 144px 180px, #ffffff 180px 216px);
  box-shadow: 0 6px 18px rgba(236, 102, 180, 0.12);
}

.random-team-panel.is-active::after {
  content: "";
  position: absolute;
  inset: auto 16px 14px 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(244, 183, 64, 0.42), rgba(236, 102, 180, 0.38), transparent);
  pointer-events: none;
}

.random-team-members-field {
  grid-area: members;
}

.random-team-settings-grid {
  grid-area: settings;
}

.random-team-names-field {
  grid-area: names;
}

.random-team-actions {
  grid-area: actions;
  align-self: end;
  align-content: start;
  padding: 12px;
  border: 1px solid rgba(125, 156, 218, 0.22);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 248, 239, 0.72)),
    #ffffff;
}

.random-team-panel .field,
.random-team-settings-grid {
  position: relative;
  z-index: 1;
}

.random-team-panel .field label {
  color: #17202a;
}

.random-team-panel .field input,
.random-team-panel .field textarea,
.random-team-panel .field select {
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 252, 255, 0.92)),
    #ffffff;
}

.random-team-panel .field textarea {
  min-height: 154px;
}

.random-team-panel .random-team-preview {
  grid-area: stage;
  align-self: stretch;
  min-height: 100%;
  padding: 16px;
  border: 1px solid rgba(124, 58, 237, 0.24);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 14%, rgba(244, 183, 64, 0.22), transparent 28%),
    radial-gradient(circle at 90% 18%, rgba(236, 102, 180, 0.2), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(239, 246, 255, 0.86)),
    #ffffff;
  box-shadow:
    0 22px 52px rgba(76, 91, 159, 0.13),
    inset 0 0 0 1px rgba(255, 255, 255, 0.82);
}

.random-team-panel .random-team-preview::after {
  content: "";
  position: absolute;
  inset: auto 16px 14px;
  height: 8px;
  border-radius: 999px;
  background:
    radial-gradient(circle, #f4b740 0 34%, transparent 36%) 0 0 / 30px 8px repeat-x,
    radial-gradient(circle, #f05a96 0 34%, transparent 36%) 15px 0 / 30px 8px repeat-x;
  opacity: 0.52;
  pointer-events: none;
}

.random-team-panel .random-team-preview.has-result::after,
.random-team-panel .random-team-preview.is-mixing::after {
  opacity: 0.78;
}

.random-team-panel .random-team-empty-state,
.random-team-panel .random-team-mixer,
.random-team-panel .random-team-result-banner,
.random-team-panel .random-team-result-grid {
  position: relative;
  z-index: 1;
}

.random-panel .field input,
.random-panel .field textarea,
.random-panel .field select {
  border-color: rgba(71, 85, 105, 0.22);
  background: #ffffff;
}

.random-panel .field input:focus,
.random-panel .field textarea:focus,
.random-panel .field select:focus {
  border-color: var(--random-accent);
  box-shadow: 0 0 0 4px var(--random-accent-soft);
}

.random-tool .primary-button {
  border-color: var(--random-accent);
  background: var(--random-accent);
  color: #ffffff;
  box-shadow: 0 14px 26px var(--random-accent-soft);
}

.random-tool .primary-button:hover {
  border-color: var(--random-accent-dark);
  background: var(--random-accent-dark);
}

.random-tool .secondary-button {
  border-color: color-mix(in srgb, var(--random-accent) 26%, white);
  background: #ffffff;
  color: var(--random-accent-dark);
}

.random-tool .secondary-button:hover {
  background: var(--random-accent-faint);
}

.random-check-card,
.random-option-grid .check-row,
.random-team-preview,
.random-wheel-manager {
  border-color: color-mix(in srgb, var(--random-accent) 24%, white);
  background: rgba(255, 255, 255, 0.88);
}

.random-result-card,
.random-history {
  border: 1px solid color-mix(in srgb, var(--random-accent) 34%, white);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), #ffffff),
    #ffffff;
  box-shadow: 0 18px 42px rgba(35, 63, 112, 0.12);
}

.random-result-card::before,
.random-history::before {
  height: 6px;
  background: linear-gradient(90deg, var(--random-accent), color-mix(in srgb, var(--random-accent) 45%, #facc15));
}

.random-result-card pre {
  min-height: 84px;
  padding: 18px;
  border: 1px solid var(--random-accent-soft);
  border-radius: 8px;
  background:
    linear-gradient(180deg, var(--random-accent-faint), rgba(255, 255, 255, 0.96)),
    #ffffff;
  color: #0f172a;
  font-size: 18px;
  font-weight: 800;
}

.random-spin-count {
  border-color: color-mix(in srgb, var(--random-accent) 28%, white);
  background: var(--random-accent-faint);
  color: var(--random-accent-dark);
}

.random-history-list {
  color: #334155;
}

.random-history-item {
  border-color: rgba(71, 85, 105, 0.18);
  background: #ffffff;
}

.random-history-item:hover {
  border-color: color-mix(in srgb, var(--random-accent) 32%, white);
  background: var(--random-accent-faint);
}

.random-team-card {
  border-color: rgba(var(--team-accent-rgb), 0.28);
}

.random-team-card span {
  color: var(--team-accent, var(--random-accent-dark));
}

.random-wheel-stage {
  filter: drop-shadow(0 24px 42px var(--random-accent-soft));
}

.random-wheel-center {
  border-color: color-mix(in srgb, var(--random-accent) 36%, white);
}

.random-wheel-center strong {
  color: var(--random-accent-dark);
}

.random-tool[data-random-mode="wheel"] .random-panel.is-active {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.96), rgba(255, 241, 242, 0.92) 62%, rgba(255, 228, 230, 0.74)),
    linear-gradient(135deg, rgba(225, 29, 72, 0.08), rgba(250, 204, 21, 0.08)),
    #ffffff;
}

.random-tool[data-random-mode="wheel"] .random-wheel-stage {
  width: min(560px, 100%);
  margin: 14px auto 12px;
  isolation: isolate;
  filter:
    drop-shadow(0 28px 54px rgba(225, 29, 72, 0.22))
    drop-shadow(0 0 34px rgba(250, 204, 21, 0.24));
}

.random-tool[data-random-mode="wheel"] .random-wheel-stage::before {
  content: "";
  position: absolute;
  inset: -26px;
  z-index: -2;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.88) 0 54%, transparent 55%),
    conic-gradient(from 0deg, #60a5fa, #ec4899, #f59e0b, #10b981, #7c3aed, #ef4444, #60a5fa);
  opacity: 0.62;
  filter: blur(12px);
}

.random-tool[data-random-mode="wheel"] .random-wheel-stage::after {
  content: none;
}

.random-tool[data-random-mode="wheel"] .random-wheel-disc {
  inset: 0;
  border: 0;
  box-shadow:
    0 26px 66px rgba(15, 23, 42, 0.22),
    0 0 34px rgba(225, 29, 72, 0.24);
}

.random-tool[data-random-mode="wheel"] .random-wheel-disc::before {
  content: none;
}

.random-tool[data-random-mode="wheel"] .random-wheel-disc::after {
  content: "";
  position: absolute;
  inset: 46%;
  z-index: 3;
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 30%, #ffffff, #fef3c7 30%, #f59e0b 70%, #92400e 100%);
  box-shadow:
    0 0 0 4px rgba(31, 41, 55, 0.76),
    0 12px 22px rgba(15, 23, 42, 0.28);
}

.random-tool[data-random-mode="wheel"] .random-wheel-disc.is-spinning {
  box-shadow:
    0 30px 72px rgba(225, 29, 72, 0.3),
    0 0 36px rgba(250, 204, 21, 0.24);
}

.random-tool[data-random-mode="wheel"] .random-wheel-pointer {
  top: -25px;
  z-index: 8;
  border-left-width: 24px;
  border-right-width: 24px;
  border-top-width: 50px;
  border-top-color: #0f172a;
  filter:
    drop-shadow(0 7px 10px rgba(15, 23, 42, 0.38))
    drop-shadow(0 0 8px rgba(255, 255, 255, 0.84));
}

.random-tool[data-random-mode="wheel"] .random-wheel-pointer::after {
  content: "";
  position: absolute;
  left: -10px;
  top: -43px;
  width: 20px;
  height: 22px;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), transparent);
}

.random-tool[data-random-mode="wheel"] .random-wheel-label {
  z-index: 5;
  max-width: 150px;
  font-size: 17px;
  text-shadow: 0 2px 6px rgba(15, 23, 42, 0.48);
}

.random-tool[data-random-mode="wheel"] .random-wheel-label b {
  max-width: 150px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.78);
  box-shadow:
    0 10px 20px rgba(15, 23, 42, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(5px);
}

.random-tool[data-random-mode="wheel"] .random-wheel-center {
  bottom: 14px;
  z-index: 7;
  min-width: 160px;
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(76, 29, 149, 0.94), rgba(15, 23, 42, 0.86));
  box-shadow:
    0 18px 34px rgba(15, 23, 42, 0.3),
    0 0 0 4px rgba(255, 255, 255, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.random-tool[data-random-mode="wheel"] .random-wheel-center strong {
  color: #fdf2f8;
}

.random-tool[data-random-mode="wheel"] .random-wheel-center span {
  color: #fde68a;
}

.random-tool[data-random-mode="wheel"] .random-wheel-tap-hint {
  color: #be123c;
}

.random-tool[data-random-mode="wheel"] .random-wheel-name-list span {
  border-color: rgba(225, 29, 72, 0.2);
  background: rgba(255, 255, 255, 0.94);
  color: #881337;
}

@media (max-width: 1080px) {
  .sidebar {
    height: auto;
  }

  .brand {
    max-width: 320px;
  }

  .app-hero {
    min-height: auto;
  }

  .party-control-panel {
    position: static;
  }

  .random-team-panel.is-active {
    grid-template-columns: 1fr;
    grid-template-areas:
      "members"
      "settings"
      "names"
      "stage"
      "actions";
  }

  .random-team-panel .random-team-preview {
    min-height: 260px;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 12px;
  }

  .brand {
    max-width: none;
  }

  .topbar {
    grid-template-columns: 1fr;
    padding: 12px 14px;
  }

  .app-hero {
    border-radius: 8px;
  }

  .hero-copy h2 {
    font-size: 42px;
  }

  .tool-card {
    min-height: 154px;
  }

  .random-tab,
  .converter-tab {
    justify-content: flex-start;
    padding-inline: 13px;
  }

  .random-tool {
    padding: 10px;
  }

  .random-park-lights {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 6px;
  }

  .random-team-panel.is-active {
    padding: 20px 10px 10px;
  }

  .random-team-panel .random-team-preview {
    min-height: 220px;
    padding: 12px;
  }

  .random-team-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-widget-chart,
  .hero-widget-search,
  .hero-widget-tools,
  .hero-gear {
    animation: none;
  }
}
