: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;
}

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;
}

.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;
}

.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,
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,
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;
}

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

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

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

.options-field {
  display: none;
}

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

.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;
}

.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);
}

.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-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;
}

.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;
  }

  .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 {
    grid-template-columns: 1fr;
  }

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