:root {
  --ink: #141414;
  --muted: #64696f;
  --line: #ddd9ce;
  --paper: #fbfaf6;
  --surface: #ffffff;
  --green: #2fbf71;
  --coral: #ff6b5f;
  --blue: #3578e5;
  --yellow: #f4c95d;
  --shadow: 0 18px 50px rgba(25, 25, 25, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

html[dir="rtl"] body {
  direction: rtl;
}

html[dir="rtl"] input,
html[dir="rtl"] textarea {
  text-align: right;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(47, 191, 113, 0.12), transparent 28%),
    linear-gradient(225deg, rgba(255, 107, 95, 0.11), transparent 34%),
    var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--yellow);
  box-shadow: 5px 5px 0 var(--ink);
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  line-height: 1;
  letter-spacing: 0;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 28px rgba(20, 20, 20, 0.05);
}

.mode-tab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.mode-tab.is-active {
  background: var(--ink);
  color: #fff;
}

.language-switch {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: max-content;
}

.language-switch span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.language-switch select {
  min-height: 40px;
  width: auto;
  min-width: 76px;
  padding: 0 9px;
  font-size: 0.82rem;
  font-weight: 850;
}

.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.account-strip {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto;
  align-items: start;
  gap: 16px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 13px 14px;
}

.account-copy {
  min-width: 210px;
  max-width: 440px;
}

.account-strip strong,
.account-strip span {
  display: block;
}

.account-strip strong {
  margin-bottom: 4px;
  font-size: 0.92rem;
}

.account-strip span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.account-auth {
  display: grid;
  grid-column: 1 / -1;
  justify-items: stretch;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.email-signin {
  display: grid;
  gap: 7px;
  justify-self: end;
  width: min(100%, 520px);
}

.email-auth-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.email-auth-row input {
  width: min(260px, 100%);
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  padding: 0 10px;
}

.email-auth-row input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(20, 20, 20, 0.08);
  outline: none;
}

.auth-hint {
  text-align: right;
}

.account-entry {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.account-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
  width: min(100%, 520px);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.quiet-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  padding: 0 12px;
  font-size: 0.84rem;
  font-weight: 850;
  text-decoration: none;
}

.quiet-link:disabled,
.email-auth-row input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.feature-note {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: inherit;
  padding: 13px 14px;
  text-align: left;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.feature-note:hover,
.feature-note:focus-visible,
.feature-note.is-active {
  border-color: var(--ink);
  box-shadow: 3px 3px 0 rgba(20, 20, 20, 0.16);
  transform: translateY(-1px);
}

.feature-note strong,
.feature-note span {
  display: block;
}

.feature-note strong {
  margin-bottom: 5px;
  font-size: 0.9rem;
}

.feature-note span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.2fr) minmax(260px, 0.75fr);
  gap: 18px;
  align-items: start;
  margin-top: 28px;
}

.composer,
.live-panel,
.library {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.composer,
.live-panel {
  min-height: calc(100vh - 148px);
}

.composer {
  padding: 24px;
}

.live-panel,
.library {
  padding: 20px;
}

.section-heading {
  margin-bottom: 22px;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--coral);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 650px;
  margin-bottom: 0;
  font-size: clamp(2.1rem, 5vw, 4.6rem);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
}

.boraya-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

input,
select,
textarea {
  min-width: 0;
  width: 100%;
  border: 1px solid #d6d1c4;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 13px 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(53, 120, 229, 0.14);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.free-period-field {
  display: none;
}

.pick-deadline-field {
  display: none;
}

.mode-free .single-time-field,
.mode-pick .single-time-field {
  display: none;
}

.mode-free .form-grid,
.mode-pick .form-grid {
  grid-template-columns: 1fr;
}

.mode-free .free-period-field {
  display: grid;
}

.mode-pick .pick-deadline-field {
  display: grid;
}

.options-field {
  display: none;
}

.mode-pick .options-field {
  display: grid;
  gap: 12px;
}

.audience-field {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.pick-type-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pick-type-button {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  padding: 13px;
  text-align: left;
}

.pick-type-button strong,
.pick-type-button span {
  display: block;
}

.pick-type-button strong {
  margin-bottom: 5px;
  font-size: 0.9rem;
}

.pick-type-button span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.pick-type-button.is-active {
  border-color: var(--ink);
  background: #fff7d8;
  box-shadow: 3px 3px 0 var(--ink);
}

.question-photo-field {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.question-photo-preview {
  display: grid;
  min-height: 128px;
  overflow: hidden;
  place-items: center;
  border: 1px dashed #c9c3b5;
  border-radius: 8px;
  background: #f7f4ec;
  color: var(--muted);
  text-align: center;
}

.question-photo-preview span {
  padding: 12px;
  font-size: 0.78rem;
  font-weight: 800;
}

.question-photo-preview img {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.question-photo-preview.has-photo {
  border-style: solid;
  background: #111;
}

.compact-photo-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.82rem;
}

.yes-no-preview {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.yes-no-preview span {
  display: grid;
  min-height: 72px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  font-size: 1.1rem;
  font-weight: 900;
  box-shadow: 4px 4px 0 var(--yellow);
}

.pick-yesno .yes-no-preview {
  display: grid;
}

.pick-yesno .option-builder,
.pick-yesno #add-option-row,
.pick-yesno .option-list-header,
.pick-yesno .field-hint {
  display: none;
}

.field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field-header span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

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

.field-hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.compact-action {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.82rem;
}

.option-builder {
  display: grid;
  gap: 12px;
}

.builder-option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.68fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.builder-photo-panel {
  display: grid;
  gap: 8px;
}

.builder-photo-preview {
  display: grid;
  min-height: 118px;
  overflow: hidden;
  place-items: center;
  border: 1px dashed #c9c3b5;
  border-radius: 8px;
  background: #f7f4ec;
  color: var(--muted);
  text-align: center;
}

.builder-photo-preview span {
  padding: 12px;
  font-size: 0.78rem;
  font-weight: 800;
}

.builder-photo-preview img {
  display: block;
  width: 100%;
  height: 128px;
  object-fit: cover;
}

.builder-photo-preview.has-photo {
  border-style: solid;
  background: #111;
}

.builder-option-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-picker-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 850;
  cursor: pointer;
}

.builder-photo-input {
  display: none;
}

.action-row,
.response-actions,
.share-actions,
.vote-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-action,
.quiet-action,
.danger-action,
.status-button,
.share-button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--ink);
  padding: 0 15px;
  font-weight: 850;
}

.primary-action {
  background: var(--green);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}

.quiet-action,
.share-button {
  background: #fff;
  color: var(--ink);
}

.quiet-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.danger-action {
  background: #fff1ef;
  color: #a5281d;
}

.current-card {
  min-height: calc(100vh - 240px);
}

.empty-state {
  display: grid;
  min-height: 360px;
  place-items: center;
  align-content: center;
  gap: 18px;
  border: 1px dashed #c9c3b5;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state p {
  width: min(280px, 100%);
  margin: 0;
}

.empty-mark {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 900;
}

.board-card {
  display: grid;
  gap: 18px;
}

.board-hero {
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent),
    var(--ink);
  color: #fff;
  padding: 22px;
}

.board-hero .type-chip {
  display: inline-flex;
  margin-bottom: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  padding: 7px 10px;
  font-size: 0.76rem;
  font-weight: 850;
}

.board-hero h3 {
  margin-bottom: 12px;
  font-size: clamp(1.6rem, 3vw, 3rem);
  line-height: 0.98;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.board-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0;
  padding: 0;
  list-style: none;
}

.board-meta li {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  padding: 7px 10px;
  font-size: 0.82rem;
}

.board-note {
  margin: 0;
  color: #efeee8;
  overflow-wrap: anywhere;
}

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

.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.stat strong {
  display: block;
  font-size: 1.6rem;
  line-height: 1;
  overflow-wrap: anywhere;
}

.stat span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.response-box {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.name-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.status-button {
  background: #fff;
}

.status-button[data-status="in"] {
  background: rgba(47, 191, 113, 0.16);
}

.status-button[data-status="maybe"] {
  background: rgba(244, 201, 93, 0.28);
}

.status-button[data-status="out"] {
  background: rgba(255, 107, 95, 0.16);
}

.participants,
.option-list,
.library-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.participants,
.option-list {
  max-height: min(520px, 48vh);
  overflow-y: auto;
  padding-right: 4px;
}

.participant,
.option-row,
.library-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.participant,
.library-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.participant strong,
.library-item strong {
  overflow-wrap: anywhere;
}

.pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 9px;
  background: #f0eee6;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 900;
}

.option-row {
  display: grid;
  gap: 10px;
}

.option-row.no-option-photo .option-media,
.option-row.no-option-photo [data-photo-option],
.option-row.no-option-photo [data-remove-photo] {
  display: none;
}

.board-question-photo {
  margin-bottom: 18px;
  overflow: hidden;
  border-radius: 8px;
}

.board-question-photo img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
}

.option-media {
  display: grid;
  min-height: 150px;
  overflow: hidden;
  place-items: center;
  border: 1px dashed #c9c3b5;
  border-radius: 8px;
  background: #f7f4ec;
  color: var(--muted);
  text-align: center;
}

.option-media span {
  max-width: 180px;
  padding: 14px;
  font-size: 0.82rem;
  font-weight: 800;
}

.option-media img {
  display: block;
  width: 100%;
  height: 190px;
  object-fit: cover;
}

.option-media.has-photo {
  border-style: solid;
  background: #111;
}

.option-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.option-topline strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.option-photo-input {
  display: none;
}

.meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #ece8de;
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.winner {
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--yellow);
}

.share-box {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.share-preview {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.92rem;
}

.library {
  min-height: 320px;
}

.community-block {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.library-list {
  max-height: min(620px, calc(100vh - 240px));
  overflow-y: auto;
  padding-right: 4px;
}

.library-item {
  width: 100%;
  text-align: left;
}

.library-item button {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.library-meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.76rem;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 44px));
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 13px 15px;
  box-shadow: 0 16px 40px rgba(20, 20, 20, 0.24);
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
  }

  .library {
    grid-column: 1 / -1;
    min-height: 0;
  }
}

@media (max-width: 780px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .section-heading.compact {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .language-switch {
    justify-content: space-between;
  }

  .language-switch select {
    flex: 0 0 96px;
  }

  .feature-strip {
    grid-template-columns: 1fr;
  }

  .account-strip {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .account-copy,
  .account-auth,
  .email-signin {
    max-width: none;
    width: 100%;
  }

  .account-auth {
    justify-items: stretch;
  }

  .account-entry {
    justify-content: flex-start;
  }

  .account-entry .quiet-link {
    width: 100%;
    justify-content: center;
  }

  .email-auth-row {
    flex-direction: column;
  }

  .email-auth-row input,
  .email-auth-row .quiet-link,
  .account-actions .quiet-link {
    width: 100%;
    justify-content: center;
  }

  .auth-hint {
    text-align: left;
  }

  .auth-divider {
    justify-self: stretch;
    width: 100%;
  }

  .account-actions {
    justify-content: flex-start;
  }

  .mode-tabs {
    overflow-x: auto;
  }

  .mode-tab {
    min-width: max-content;
  }

  .workspace {
    grid-template-columns: 1fr;
    margin-top: 18px;
  }

  .composer,
  .live-panel {
    min-height: auto;
  }

  .composer,
  .live-panel,
  .library {
    padding: 16px;
  }

  h1 {
    font-size: 2.35rem;
  }

  .form-grid,
  .stats-grid,
  .pick-type-switch,
  .yes-no-preview {
    grid-template-columns: 1fr;
  }

  .builder-option-row {
    grid-template-columns: 1fr;
  }
}
