:root {
  --black: #050506;
  --white: #ffffff;
  --ink: #111216;
  --muted: #6b6f78;
  --soft: #f0f1f3;
  --frame: #ffffff;
  --line: #d8dbe0;
  --orange: #ff9d21;
  --orange-dark: #cc7210;
  --red: #d73232;
  --green: #1c8f58;
  --blue: #355fce;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.18);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.auth-corner {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(5, 5, 6, 0.68);
  color: white;
  backdrop-filter: blur(12px);
}

.auth-user {
  max-width: 150px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-status {
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.86rem;
  font-weight: 900;
}

.account-status.is-pro {
  background: var(--orange);
  color: #111;
}

.account-status.is-owner {
  background: #ffffff;
  color: #111;
}

.auth-button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-weight: 850;
}

.auth-button.auth-primary {
  background: var(--orange);
  border-color: var(--orange);
  color: #111;
}

.view {
  display: none;
  min-height: 100vh;
}

.view.is-active {
  display: block;
}

.home-view {
  background:
    linear-gradient(120deg, var(--black) 0%, #111111 37%, #efefef 70%, var(--white) 100%);
  color: var(--white);
  padding: 34px;
}

.home-content {
  width: min(1080px, 100%);
  min-height: calc(100vh - 68px);
  display: grid;
  align-content: center;
  gap: 26px;
}

.kicker {
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(4rem, 12vw, 11rem);
  font-weight: 950;
  line-height: 0.85;
}

.terms-box {
  max-width: 640px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.terms-box h2,
.feedback-frame h2,
.detector-header h2 {
  margin: 0 0 8px;
  font-size: 1.3rem;
}

.terms-box p {
  margin: 0;
  max-width: 58ch;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.65;
}

.rating-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--white);
}

.stars-display,
.feedback-stars {
  display: inline-flex;
  gap: 4px;
}

.star {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 32px;
  color: #8d8f94;
  font-size: 2rem;
  line-height: 1;
}

.star::before,
.star::after {
  content: "\2605";
  position: absolute;
  inset: 0;
}

.star::after {
  width: var(--fill, 0%);
  overflow: hidden;
  color: var(--orange);
  transition: width 360ms ease;
}

.rating-summary strong {
  display: block;
  font-size: 1.35rem;
}

.rating-summary span {
  display: block;
  color: rgba(255, 255, 255, 0.7);
}

.start-button,
.pro-button,
.redeem-button,
.discord-button,
.analyze-button,
.submit-button,
.skip-button,
.back-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  font-weight: 850;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.start-button {
  width: fit-content;
  min-width: 190px;
  padding: 0 24px;
  background: var(--orange);
  color: #111;
  box-shadow: 0 18px 36px rgba(255, 157, 33, 0.26);
}

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

.pro-button {
  width: fit-content;
  min-width: 170px;
  padding: 0 22px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.redeem-button {
  width: fit-content;
  min-width: 160px;
  padding: 0 22px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: white;
  color: #111;
}

.discord-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  min-width: 280px;
  padding: 0 22px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: #5865f2;
  color: white;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.pro-button.is-claimed,
.redeem-button.is-claimed {
  background: #1c8f58;
  border-color: #1c8f58;
  color: white;
}

.start-button:hover,
.pro-button:hover,
.redeem-button:hover,
.discord-button:hover,
.analyze-button:hover,
.submit-button:hover,
.skip-button:hover,
.back-button:hover {
  transform: translateY(-1px);
}

.pricing-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(640px, 100%);
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  backdrop-filter: blur(10px);
}

.pricing-card h2,
.pricing-card p {
  margin: 0;
}

.pricing-card p:not(.kicker) {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.5;
}

.price-box {
  min-width: 130px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.34);
  text-align: center;
}

.price-box strong,
.price-box span {
  display: block;
}

.price-box strong {
  font-size: 1.25rem;
}

.price-box span {
  color: rgba(255, 255, 255, 0.68);
}

.payment-message {
  min-height: 22px;
  margin: -12px 0 0;
  max-width: 640px;
  color: #ffd28a;
  font-weight: 750;
}

.redeem-modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 5, 6, 0.72);
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 5, 6, 0.72);
}

.auth-card {
  position: relative;
  width: min(470px, 100%);
  padding: 24px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
  box-shadow: var(--shadow);
}

.auth-card .kicker {
  color: var(--orange-dark);
}

.auth-card h2 {
  margin: 0 0 12px;
  font-size: 2rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef0f4;
}

.auth-tabs button {
  min-height: 40px;
  border: 0;
  background: transparent;
  color: #505762;
  font-weight: 850;
}

.auth-tabs button.is-active {
  background: #16181d;
  color: white;
}

.auth-card label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: #424750;
  font-weight: 800;
}

.auth-card input {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  font: inherit;
}

.auth-card input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 157, 33, 0.18);
}

.auth-message {
  min-height: 24px;
  margin: 2px 0 12px;
  color: var(--red);
  font-weight: 800;
}

.auth-submit {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: #16181d;
  color: white;
  font-weight: 850;
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.7;
}

.redeem-card {
  position: relative;
  width: min(470px, 100%);
  padding: 24px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
  box-shadow: var(--shadow);
}

.redeem-card .kicker {
  color: var(--orange-dark);
}

.redeem-card h2 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.redeem-card p {
  margin: 0 0 14px;
  color: #424750;
  line-height: 1.55;
}

.redeem-card input {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  font: inherit;
  text-transform: uppercase;
}

.redeem-card input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 157, 33, 0.18);
}

.redeem-message {
  min-height: 24px;
  margin: 10px 0 12px !important;
  color: var(--orange-dark) !important;
  font-weight: 800;
}

.redeem-success {
  display: grid;
  gap: 5px;
  margin: 12px 0;
  padding: 14px;
  border: 1px solid rgba(28, 143, 88, 0.28);
  border-radius: 8px;
  background: rgba(28, 143, 88, 0.1);
  color: #145c3c;
}

.redeem-success strong {
  font-size: 1.08rem;
}

.redeem-success span {
  color: #226247;
  font-weight: 800;
}

.redeem-submit {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: #16181d;
  color: white;
  font-weight: 850;
}

.redeem-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: #eef0f4;
  color: #202329;
  font-weight: 900;
}

.detector-view {
  background: #cfd1d6;
  padding: 28px;
}

.detector-shell {
  width: min(1220px, 100%);
  margin: 0 auto;
}

.detector-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.detector-header .kicker {
  color: #515761;
}

.detector-header h2 {
  font-size: clamp(1.8rem, 4vw, 3.4rem);
}

.back-button {
  min-width: 92px;
  padding: 0 16px;
  background: #22242a;
  color: white;
}

.detector-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(330px, 0.9fr);
  gap: 18px;
}

.text-frame,
.result-frame,
.feedback-frame {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--frame);
  box-shadow: var(--shadow);
}

.text-frame {
  min-height: 580px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

textarea {
  width: 100%;
  flex: 1;
  min-height: 460px;
  padding: 20px;
  border: 0;
  outline: 0;
  resize: none;
  color: var(--ink);
  line-height: 1.65;
}

textarea::placeholder {
  color: #8b9098;
}

.text-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.scan-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 190px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef0f4;
}

.mode-switch button {
  min-height: 40px;
  border: 0;
  background: transparent;
  color: #505762;
  font-weight: 850;
}

.mode-switch button.is-active {
  background: #16181d;
  color: white;
}

#wordCounter {
  color: var(--muted);
  font-weight: 700;
}

.analyze-button,
.submit-button {
  min-width: 165px;
  padding: 0 18px;
  background: #16181d;
  color: white;
}

.analyze-button:disabled {
  cursor: wait;
  transform: none;
  opacity: 0.7;
}

.message,
.feedback-error {
  min-height: 22px;
  margin: 0;
  padding: 0 16px 14px;
  color: var(--red);
  font-weight: 750;
}

.result-frame {
  min-height: 580px;
  display: grid;
  place-items: center;
  padding: 22px;
}

.loading-box {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.loader {
  width: 74px;
  height: 74px;
  border: 8px solid #e3e5e9;
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 950ms linear infinite;
}

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

.result-box {
  width: 100%;
  max-height: 536px;
  overflow: auto;
  padding-right: 4px;
}

.empty-result {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

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

.confidence-badge {
  width: fit-content;
  margin-bottom: 14px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #16181d;
  color: white;
  font-weight: 850;
}

.result-item {
  display: grid;
  gap: 8px;
}

.result-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 850;
}

.bar {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e6eb;
}

.bar span {
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  transition: width 700ms ease;
}

.bar.ai span {
  background: var(--orange);
}

.bar.mix span {
  background: var(--blue);
}

.bar.human span {
  background: var(--green);
}

.result-note {
  margin: 22px 0 0;
  padding: 14px;
  border-radius: 8px;
  background: var(--soft);
  color: #424750;
  line-height: 1.55;
}

.signal-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfc;
}

.signal-panel strong {
  display: block;
  margin-bottom: 8px;
}

.signal-panel ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: #424750;
  line-height: 1.45;
}

.sentence-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfc;
}

.sentence-panel strong {
  display: block;
  margin-bottom: 8px;
}

.sentence-panel ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sentence-panel li {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  border-left: 5px solid #aeb4bf;
  background: white;
  color: #424750;
  line-height: 1.42;
}

.sentence-panel li.high {
  border-left-color: var(--orange);
}

.sentence-panel li.mid {
  border-left-color: var(--blue);
}

.sentence-panel li.low {
  border-left-color: var(--green);
}

.sentence-panel li strong {
  margin: 0;
  color: var(--ink);
}

.feedback-frame {
  margin-top: 18px;
  padding: 22px;
  text-align: center;
}

.feedback-stars button {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #9b9da3;
  font-size: 2.35rem;
  line-height: 1;
  transition: color 180ms ease, transform 180ms ease;
}

.feedback-stars button.is-selected {
  color: #ffc247;
}

.feedback-stars button:hover {
  transform: scale(1.08);
}

.feedback-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}

.skip-button {
  min-width: 120px;
  padding: 0 18px;
  background: #eceef2;
  color: #202329;
}

.submit-button {
  min-width: 170px;
}

@media (max-width: 860px) {
  .home-view,
  .detector-view {
    padding: 18px;
  }

  .home-content {
    min-height: calc(100vh - 36px);
  }

  .detector-grid {
    grid-template-columns: 1fr;
  }

  .detector-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .text-frame,
  .result-frame {
    min-height: 460px;
  }
}

@media (max-width: 560px) {
  .auth-corner {
    top: 10px;
    right: 10px;
    left: 10px;
    justify-content: flex-end;
  }

  .auth-user {
    margin-right: auto;
  }

  .home-view {
    background:
      linear-gradient(155deg, var(--black) 0%, #181818 50%, #f6f6f6 100%);
  }

  .terms-box {
    padding: 16px;
  }

  .rating-summary,
  .text-actions,
  .scan-controls,
  .feedback-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .start-button,
  .pro-button,
  .redeem-button,
  .discord-button,
  .analyze-button,
  .submit-button,
  .skip-button {
    width: 100%;
  }

  .pricing-card {
    align-items: stretch;
    flex-direction: column;
  }
}
