:root {
  color-scheme: dark;
  --ink: #fff7e8;
  --muted: rgba(255, 247, 232, 0.68);
  --line: rgba(255, 247, 232, 0.22);
  --panel: rgba(19, 21, 22, 0.62);
  --accent: #f4c56c;
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(115deg, rgba(9, 12, 15, 0.92), rgba(30, 20, 26, 0.76)),
    linear-gradient(180deg, #121416 0%, #1b151a 56%, #0f1114 100%);
  background-attachment: fixed;
}

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

.owner-shell {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(360px, 1.15fr);
  gap: 22px;
  width: min(1180px, calc(100vw - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 38px 0;
  align-items: start;
}

.ip-panel {
  grid-column: 1 / -1;
}

.comments-panel {
  grid-column: 1 / -1;
}

.lines-panel {
  grid-column: 1 / -1;
}

.owner-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(22px);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
  padding: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 20px;
  font-size: clamp(42px, 7vw, 92px);
  line-height: 0.9;
  font-weight: 500;
}

h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 52px);
  line-height: 1;
  font-weight: 500;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.ip-actions,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.compact-actions {
  margin: 0;
  flex: 0 0 auto;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

button:hover {
  background: rgba(244, 197, 108, 0.2);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.ip-actions button,
.actions button {
  padding: 0 16px;
}

#verifyProof,
.publish-actions {
  width: 100%;
  margin-top: 12px;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  outline: 0;
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(244, 197, 108, 0.62);
}

#challengeText,
#proofText,
#topLinesText {
  min-height: 178px;
  margin: 8px 0;
  padding: 12px;
  resize: vertical;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
}

#proofText {
  min-height: 112px;
}

#topLinesText {
  min-height: 152px;
  font-family: inherit;
  font-size: 16px;
}

form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

#publishForm label:nth-last-child(-n + 3),
.publish-actions {
  grid-column: 1 / -1;
}

.publish-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.validation-box {
  margin-top: 14px;
  border: 1px solid rgba(255, 247, 232, 0.18);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.validation-box.is-ok {
  border-color: rgba(244, 197, 108, 0.46);
}

.validation-box dl {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
}

.validation-box div {
  min-width: 0;
  padding: 12px;
  border-right: 1px solid rgba(255, 247, 232, 0.12);
}

.validation-box div:last-child {
  border-right: 0;
}

.validation-box dt {
  color: var(--muted);
  font-size: 12px;
}

.validation-box dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}

.validation-box ul {
  margin: 0;
  padding: 12px 16px 14px 30px;
  border-top: 1px solid rgba(255, 247, 232, 0.12);
  color: #ffcfbf;
}

#ipForm {
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: end;
}

#ipForm label,
#ipForm .ip-actions {
  grid-column: auto;
}

#ipForm .ip-actions {
  margin: 0;
}

.security-status {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.security-status span {
  min-height: 54px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.07);
  font-size: 13px;
}

.security-status b {
  display: block;
  color: var(--ink);
  font-size: 20px;
  font-weight: 500;
}

.ip-inspect {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.ip-inspect div {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255, 247, 232, 0.16);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.ip-inspect span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.ip-inspect b {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.comments-list {
  display: grid;
  gap: 12px;
}

.comment-work {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.comment-work header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.comment-work strong,
.comment-work small {
  display: block;
}

.comment-work strong {
  font-size: 18px;
  font-weight: 500;
}

.comment-work small,
.comment-meta,
.empty-state {
  color: var(--muted);
}

.comment-work header button,
.comment-actions button {
  min-height: 34px;
  padding: 0 12px;
}

.comment-rows {
  display: grid;
}

.comment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
}

.comment-row + .comment-row {
  border-top: 1px solid rgba(255, 247, 232, 0.12);
}

.comment-row.is-hidden {
  background: rgba(0, 0, 0, 0.18);
}

.comment-copy p {
  margin: 8px 0 0;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.comment-meta b {
  color: var(--ink);
  font-weight: 500;
}

.comment-meta em {
  color: var(--accent);
  font-style: normal;
}

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

.empty-state {
  margin: 0;
  padding: 18px 0;
}

.compact-empty {
  padding: 14px;
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

label textarea {
  padding: 10px 12px;
  resize: vertical;
}

.status {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--muted);
}

@media (max-width: 860px) {
  body {
    background:
      linear-gradient(180deg, rgba(9, 12, 15, 0.88), rgba(18, 16, 20, 0.94)),
      linear-gradient(180deg, #101315 0%, #1a1418 62%, #101114 100%);
    background-attachment: fixed;
  }

  .owner-shell,
  form,
  #ipForm {
    grid-template-columns: 1fr;
  }

  .publish-actions,
  .validation-box dl {
    grid-template-columns: 1fr;
  }

  .validation-box div {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 247, 232, 0.12);
  }

  .validation-box div:last-child {
    border-bottom: 0;
  }

  .security-status {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ip-inspect {
    grid-template-columns: 1fr;
  }

  .comment-work header,
  .comment-row {
    grid-template-columns: 1fr;
  }

  .comment-work header {
    align-items: stretch;
    flex-direction: column;
  }

  .comment-actions {
    justify-content: stretch;
  }

  .comment-actions button {
    flex: 1;
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .compact-actions {
    width: 100%;
  }

  .compact-actions button {
    flex: 1;
  }
}
