:root {
  --ink: #080808;
  --muted: #5f5f5f;
  --soft: #8b8b8b;
  --line: rgba(0, 0, 0, 0.16);
  --line-soft: rgba(0, 0, 0, 0.08);
  --panel: rgba(255, 255, 255, 0.78);
  --white: #ffffff;
  --danger: #8f1d1d;
  --success: #1d6541;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.16);
  --inner-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  font-family: Roboto, Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 14%, rgba(255, 255, 255, 0.98) 0, rgba(255, 255, 255, 0.64) 25rem, transparent 42rem),
    radial-gradient(circle at 92% 11%, rgba(255, 255, 255, 0.94) 0, rgba(255, 255, 255, 0.58) 15rem, transparent 32rem),
    linear-gradient(145deg, #ffffff 0%, #f4f4f4 37%, #d9d9d9 68%, #f7f7f7 100%);
}

body::before,
body::after {
  position: fixed;
  z-index: -1;
  display: block;
  content: "";
  pointer-events: none;
}

body::before {
  right: -14vw;
  top: -8vh;
  width: 54vw;
  height: 78vh;
  background: linear-gradient(132deg, transparent 0 43%, rgba(0, 0, 0, 0.12) 44%, rgba(255, 255, 255, 0.2) 76%);
  filter: blur(4px);
  transform: rotate(-7deg);
}

body::after {
  position: absolute;
  left: -10vw;
  bottom: 0;
  width: 54vw;
  height: 44vh;
  background: linear-gradient(18deg, rgba(0, 0, 0, 0.2), rgba(255, 255, 255, 0));
  filter: blur(8px);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: clamp(28px, 5vh, 48px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}

.brand-logo-link {
  display: block;
  width: clamp(155px, 15vw, 220px);
  height: 58px;
  flex: 0 0 auto;
  overflow: hidden;
}

.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.brand-divider,
h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.72rem, 2.1vw, 2.14rem);
  font-weight: 700;
  line-height: 1;
}

.topnav {
  position: relative;
  display: flex;
  align-items: center;
  gap: 22px;
}

.popover-control {
  position: relative;
}

.nav-button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 0 4px;
  color: var(--ink);
  background: transparent;
  font-size: 0.96rem;
  font-weight: 700;
}

.nav-button:hover,
.nav-button[aria-expanded="true"] {
  color: #000000;
  text-decoration: underline;
  text-underline-offset: 5px;
}

.popover-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 4;
  width: min(280px, 78vw);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 15px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(18px);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.45;
}

.portal-main {
  display: grid;
  gap: 18px;
}

.hero {
  max-width: 700px;
  margin-bottom: 14px;
}

.hero h2 {
  margin-bottom: 12px;
  font-size: clamp(2.15rem, 3.6vw, 3.45rem);
  font-weight: 700;
  line-height: 1;
}

.hero p {
  max-width: 640px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.25vw, 1.14rem);
  line-height: 1.45;
}

.workspace {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  gap: 20px;
  align-items: stretch;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: var(--radius-xl);
  padding: clamp(18px, 2vw, 22px);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.84), rgba(250, 250, 250, 0.62));
  box-shadow: var(--shadow), var(--inner-shadow);
  backdrop-filter: blur(22px);
}

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

.tool-panel {
  position: relative;
}

.popout-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.36);
  backdrop-filter: blur(6px) saturate(120%);
  border-radius: var(--radius-xl);
  padding: 18px;
}

.popout-overlay[hidden] {
  display: none !important;
}

.popout-overlay-inner {
  text-align: center;
  max-width: 320px;
  color: var(--ink);
}

.popout-overlay p {
  margin: 0 0 12px;
  font-weight: 700;
}

.popout-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.generator-panel {
  align-self: stretch;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(18px, 1.8vw, 22px);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.12), var(--inner-shadow);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin-bottom: 8px;
  font-size: clamp(1.32rem, 1.8vw, 1.55rem);
  font-weight: 900;
  line-height: 1.1;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.operation-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 18px;
}

.operation-row .segmented {
  flex: 1;
  margin-bottom: 0;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--inner-shadow);
  font-size: 1.02rem;
  line-height: 1;
}

.icon-button:hover {
  transform: translateY(-1px);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.035);
  box-shadow: inset 0 1px 8px rgba(0, 0, 0, 0.04);
}

.segmented input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.segmented span {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 13px;
  color: #6a6a6a;
  font-size: 0.92rem;
  font-weight: 800;
}

.segmented input:checked + span {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.09), var(--inner-shadow);
}

.input-label,
.field-row label {
  display: block;
  margin: 12px 0 7px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
}

.field-row label {
  margin-top: 0;
}

.secret-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.text-input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  outline: none;
  box-shadow: var(--inner-shadow);
}

.text-input {
  min-height: 44px;
  padding: 0 14px;
}

textarea {
  display: block;
  resize: vertical;
  min-height: 92px;
  padding: 12px;
  line-height: 1.48;
}

.text-input:focus,
textarea:focus {
  border-color: rgba(0, 0, 0, 0.48);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.06);
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 22px;
  color: var(--soft);
  font-size: 0.82rem;
}

.meta-row span:last-child {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.link-button {
  border: 0;
  padding: 0;
  color: #4d4d4d;
  background: transparent;
  font-size: 0.88rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.action-row {
  margin: 10px 0 14px;
}

.primary-action,
.copy-button,
.text-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 16px;
  font-size: 0.94rem;
  font-weight: 900;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.primary-action {
  width: 100%;
  border: 0;
  color: var(--white);
  background: linear-gradient(180deg, #1f1f1f, #050505);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

.primary-action:hover,
.copy-button:hover,
.text-button:hover {
  transform: translateY(-1px);
}

.copy-button,
.text-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--inner-shadow);
}

.result-box {
  margin-top: 0;
}

.output-control {
  position: relative;
}

.output-control textarea {
  min-height: 72px;
  padding-right: 116px;
}

.output-control .copy-button {
  position: absolute;
  right: 12px;
  top: 50%;
  min-height: 38px;
  transform: translateY(-50%);
}

.compact-output textarea {
  min-height: 52px;
  resize: none;
}

.generator-panel .primary-action {
  margin: 14px 0 18px;
}

.generator-note {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 16px;
  background: rgba(250, 250, 250, 0.72);
}

.generator-note p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.generator-note strong {
  color: var(--ink);
}

.shield-icon {
  position: relative;
  width: 28px;
  height: 32px;
  flex: 0 0 auto;
  border: 2px solid var(--ink);
  border-radius: 12px 12px 16px 16px;
}

.shield-icon::after {
  position: absolute;
  left: 8px;
  top: 9px;
  width: 9px;
  height: 5px;
  border-left: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  content: "";
  transform: rotate(-45deg);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(360px, calc(100% - 36px));
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 12px 16px;
  color: var(--white);
  background: linear-gradient(180deg, #282828, #000000);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
  font-size: 0.9rem;
  font-weight: 900;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.error {
  color: var(--danger) !important;
}

.success {
  color: var(--success) !important;
}

.generator-status {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.generator-status.success {
  color: var(--success) !important;
}

.generator-status.error {
  color: var(--danger) !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .hero {
    max-width: 100%;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 24px, 1380px);
    padding-top: 16px;
  }

  .topbar,
  .brand-lockup {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .brand-divider {
    display: none;
  }

  .topnav {
    width: 100%;
    gap: 16px;
  }

  .hero h2 {
    font-size: clamp(2.2rem, 11vw, 3.2rem);
  }

  .workspace {
    padding: 16px;
  }

  .secret-control {
    grid-template-columns: 1fr;
  }

  .text-button {
    width: 100%;
  }

  .output-control textarea {
    padding-right: 14px;
  }

  .output-control .copy-button {
    position: static;
    width: 100%;
    margin-top: 8px;
    transform: none;
  }
}
