@font-face {
  font-family: "Faghwang";
  src: url("../assets/fonts/fahkwang-400.ttf") format("truetype");
  font-weight: 400;
}

@font-face {
  font-family: "Faghwang";
  src: url("../assets/fonts/fahkwang-500.ttf") format("truetype");
  font-weight: 500;
}

@font-face {
  font-family: "Faghwang";
  src: url("../assets/fonts/fahkwang-600.ttf") format("truetype");
  font-weight: 600;
}

@font-face {
  font-family: "Faghwang";
  src: url("../assets/fonts/fahkwang-700.ttf") format("truetype");
  font-weight: 700;
}

:root {
  --forest: #2a3820;
  --moss: #3d4b2e;
  --paper: #ffffff;
  --beige: #eee8dc;
  --gold: #b8923e;
  --ink: #283321;
  --muted: #65705f;
  --line: #d9d6ca;
  --white: #ffffff;
  --black: #050505;
  --control: #faf9f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--beige);
  font-family: "Faghwang", "Fahkwang", sans-serif;
}

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

button {
  cursor: pointer;
}

.studio-shell {
  display: grid;
  grid-template-columns: minmax(360px, 500px) minmax(0, 1fr);
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.panel {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.form-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 36px);
  overflow: hidden;
}

.panel-header,
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--forest);
  font-family: "Faghwang", "Fahkwang", sans-serif;
  font-weight: 700;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 24px;
}

.tabs,
.preview-tabs {
  display: flex;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab,
.preview-tab,
.secondary-action,
.primary-action,
.icon-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--forest);
  background: var(--control);
}

.tab,
.preview-tab {
  flex: 0 0 auto;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
}

.tab.is-active,
.preview-tab.is-active {
  color: var(--white);
  border-color: var(--forest);
  background: var(--forest);
}

.icon-button {
  width: 40px;
  height: 40px;
  font-weight: 700;
}

.editor-form {
  flex: 1;
  overflow: auto;
  padding: 16px 18px 20px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field.checkbox-field {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  padding: 10px 0 0;
}

.field label,
.checkbox-field span,
.zoom-control {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fffefb;
  outline-color: var(--gold);
}

.field textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.45;
}

.field .compact-textarea {
  min-height: 58px;
}

.helper {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px 18px;
  border-top: 1px solid var(--line);
}

.secondary-action,
.primary-action {
  min-height: 38px;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 700;
}

.primary-action {
  color: var(--white);
  border-color: var(--forest);
  background: var(--forest);
}

.file-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.preview-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-height: calc(100vh - 36px);
  overflow: hidden;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zoom-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-stage {
  display: grid;
  place-items: start center;
  overflow: auto;
  padding: 22px;
  background:
    linear-gradient(90deg, rgba(61, 75, 46, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(61, 75, 46, 0.07) 1px, transparent 1px),
    #e8e5da;
  background-size: 24px 24px;
}

.artboard-root {
  transform-origin: top center;
}

.status-line {
  min-height: 34px;
  margin: 0;
  padding: 9px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.artboard {
  position: relative;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 18px 45px rgba(42, 56, 32, 0.22);
}

.artboard.invite {
  width: 540px;
  height: 540px;
}

.artboard.rules {
  width: 540px;
  height: 960px;
}

.asset-header {
  display: block;
  height: 132.5px;
}

.rules .asset-header {
  height: 132.5px;
}

.asset-header img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.main-area {
  position: relative;
  z-index: 2;
}

.invite .main-area {
  height: 176px;
  padding: 12px 54px 0;
  transform: translate(var(--text-x, 0), var(--text-y, 0));
}

.invite .intro {
  max-width: 440px;
  margin: 0 auto 8px;
  color: var(--forest);
  font-family: "Faghwang", "Fahkwang", sans-serif;
  font-size: var(--opening-font, 16px);
  line-height: 1.22;
}

.invite .event-lines {
  margin-left: 72px;
  color: var(--forest);
  font-family: "Faghwang", "Fahkwang", sans-serif;
}

.invite .event-date {
  margin: 0 0 6px;
  font-size: var(--date-font, 19px);
  font-weight: 400;
}

.invite .event-date strong,
.rules .event-date strong {
  font-weight: 700;
}

.invite .time-line {
  margin: 0 0 4px;
  font-size: var(--time-font, 14px);
}

.invite .focus-title {
  max-width: 430px;
  margin: 8px auto 0;
  color: var(--forest);
  font-family: "Faghwang", "Fahkwang", sans-serif;
  font-size: var(--theme-font, 15px);
  font-weight: 700;
  line-height: 1.28;
  text-align: center;
}

.rules .main-area {
  padding: 16px 55px 0;
  transform: translate(var(--text-x, 0), var(--text-y, 0));
}

.rules-title {
  margin: 0;
  color: var(--forest);
  font-family: "Faghwang", "Fahkwang", sans-serif;
  font-size: var(--title-font, 30px);
  font-weight: 700;
  line-height: 1.22;
  text-align: center;
}

.rules-period {
  margin: 14px 0 18px;
  color: var(--forest);
  font-family: "Faghwang", "Fahkwang", sans-serif;
  font-size: var(--period-font, 18px);
  font-weight: 700;
  text-align: center;
}

.rules-label {
  margin: 4px 0 24px;
  color: var(--forest);
  font-family: "Faghwang", "Fahkwang", sans-serif;
  font-size: calc(var(--body-font, 15px) + 6px);
  font-weight: 700;
  line-height: 1.1;
  text-decoration: underline;
  text-align: left;
}

.rules-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.model-final-sprint .rules-list {
  gap: 10px;
}

.rule-item {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 8px;
  align-items: start;
  color: var(--ink);
  font-family: "Faghwang", "Fahkwang", sans-serif;
  font-size: var(--body-font, 15px);
  line-height: 1.34;
}

.model-final-sprint .rule-item {
  line-height: 1.25;
}

.rule-item.compact {
  font-weight: 700;
}

.rule-item.levels .rule-copy {
  font-weight: 700;
  line-height: 1.22;
}

.rule-mark {
  position: relative;
  width: 24px;
  height: 24px;
  margin-top: 1px;
}

.rule-mark::before,
.rule-mark::after {
  content: "";
  position: absolute;
  background: var(--moss);
}

.rule-mark::before {
  left: 11px;
  top: 2px;
  width: 1px;
  height: 21px;
}

.rule-mark::after {
  left: 2px;
  top: 12px;
  width: 21px;
  height: 1px;
}

.rule-copy strong {
  font-weight: 700;
}

.rules-event {
  position: absolute;
  left: 56px;
  right: 170px;
  bottom: 106px;
  z-index: 2;
  color: var(--forest);
  font-family: "Faghwang", "Fahkwang", sans-serif;
}

.rules-event .event-date {
  margin: 0 0 12px;
  font-size: calc(var(--event-font, 18px) + 4px);
  font-weight: 400;
}

.rules-event .time-line {
  margin: 0 0 9px;
  font-size: var(--event-font, 18px);
}

.model-final-sprint .rules-event {
  display: none;
}

.footer-image {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: var(--footer-height, 232px);
  object-fit: fill;
}

.highlight-icon {
  position: absolute;
  left: 0;
  top: 249px;
  z-index: 3;
  width: 115px;
}

.rules .highlight-icon {
  left: 0;
  top: 146px;
  width: 115px;
}

.money-icon {
  position: absolute;
  right: 67px;
  top: 314px;
  z-index: 3;
  width: 82px;
  color: var(--forest);
}

.target-svg {
  width: 90px;
  height: 90px;
}

.rules .target-svg {
  width: 95px;
  height: 95px;
}

@media (max-width: 1040px) {
  .studio-shell {
    grid-template-columns: 1fr;
  }

  .form-panel,
  .preview-panel {
    max-height: none;
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .studio-shell {
    padding: 10px;
  }

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

  .panel-header,
  .preview-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-controls {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .zoom-control,
  .zoom-control input,
  .primary-action {
    width: 100%;
  }

  .preview-stage {
    padding: 14px 8px;
  }
}
