:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e3e6ea;
  --text: #1c2128;
  --muted: #626c77;
  --accent: #3556c8;
  --accent-hover: #2a46a8;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(28, 33, 40, 0.06), 0 4px 12px rgba(28, 33, 40, 0.04);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 1.5rem;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

header,
main {
  max-width: 72rem;
  margin: 0 auto;
}

header {
  margin-bottom: 1.5rem;
}

.header-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

h1 {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.5rem;
  margin: 0;
}

.version-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.version-badges a {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
}

.version-badges a:hover,
.version-badges a:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
  font-size: 0.9em;
}

a {
  color: var(--accent);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.playground-layout {
  display: grid;
  gap: 1.5rem;
}

.controls-column,
.output-column {
  min-width: 0;
}

.panel h2 {
  margin-top: 0;
  font-size: 1.05rem;
}

.agent-resource {
  background: #f9fafc;
}

.agent-resource p,
.versioning-guide p {
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.agent-resource a,
.versioning-guide a {
  font-weight: 600;
}

.resource-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.version-url-list {
  display: grid;
  gap: 0.65rem;
  margin: 0.9rem 0;
}

.version-url-list div {
  min-width: 0;
}

.version-url-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.version-url-list dd {
  margin: 0.15rem 0 0;
  min-width: 0;
}

.version-url-list code {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.version-table-wrap {
  max-width: 100%;
  margin: 1rem 0;
  overflow-x: auto;
}

.version-table {
  width: 100%;
  min-width: 28rem;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.version-table th,
.version-table td {
  padding: 0.45rem 0.55rem;
  border-top: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.version-table th {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.version-table code {
  white-space: nowrap;
}

.field {
  margin-bottom: 1rem;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin-bottom: 0.25rem;
}

.field input[type="url"],
.field input[type="number"],
.field input[type="text"],
.field textarea,
.field select {
  width: 100%;
  max-width: 28rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
}

.field textarea {
  max-width: 100%;
  min-height: 9rem;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.45;
}

.hint.error {
  color: #c4302f;
}

.field-checkbox label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
}

.custom-action-demo > label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
}

.custom-action-options,
.action-placement-options {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.45rem;
}

.custom-action-options label,
.action-placement-options label {
  margin: 0;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
}

.custom-action-options select,
.action-placement-options select {
  max-width: 10rem;
}

.fields-legend {
  display: block;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin-bottom: 0.25rem;
}

.fields-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.source-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.source-options label,
.fields-checkboxes label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 400;
  font-family: inherit;
  margin-bottom: 0;
}

.field input:disabled,
.field input[type="text"]:disabled,
.field textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.hint {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.widget-frame {
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: #ffffff;
}

.widget-frame[data-theme="dark"] {
  background: #111318;
  border-color: #33373f;
}

.widget-frame[data-theme="dark"][data-layout="calendar"] {
  background: #14171d;
  border-color: #3a3f49;
}

.widget-frame[data-theme="auto"] {
  background: #ffffff;
}

@media (prefers-color-scheme: dark) {
  .widget-frame[data-theme="auto"] {
    background: #111318;
    border-color: #33373f;
  }

  .widget-frame[data-theme="auto"][data-layout="calendar"] {
    background: #14171d;
    border-color: #3a3f49;
  }
}

.preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.segmented-toolbar {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.preview-button {
  display: grid;
  grid-template-columns: 1rem auto;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.preview-button:hover,
.preview-button:focus-visible {
  color: var(--text);
  border-color: var(--border);
  outline: none;
}

.preview-button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--border);
  box-shadow: 0 1px 2px rgba(28, 33, 40, 0.08);
}

.preview-icon {
  display: block;
  width: 1rem;
  height: 1rem;
  color: currentColor;
}

.icon-calendar {
  border: 1.8px solid currentColor;
  border-radius: 3px;
  background:
    linear-gradient(currentColor, currentColor) 0 0.25rem / 100% 1.8px no-repeat,
    linear-gradient(currentColor, currentColor) 33% 0.48rem / 1px 0.42rem no-repeat,
    linear-gradient(currentColor, currentColor) 66% 0.48rem / 1px 0.42rem no-repeat,
    linear-gradient(currentColor, currentColor) 0.22rem 0.72rem / 0.25rem 0.18rem no-repeat,
    linear-gradient(currentColor, currentColor) 0.62rem 0.72rem / 0.25rem 0.18rem no-repeat;
}

.icon-list {
  background:
    linear-gradient(currentColor, currentColor) 0 0.15rem / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) 0 0.45rem / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) 0 0.75rem / 100% 2px no-repeat;
}

.icon-cards {
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 0.43rem 0.43rem no-repeat,
    linear-gradient(currentColor, currentColor) 0.57rem 0 / 0.43rem 0.43rem no-repeat,
    linear-gradient(currentColor, currentColor) 0 0.57rem / 0.43rem 0.43rem no-repeat,
    linear-gradient(currentColor, currentColor) 0.57rem 0.57rem / 0.43rem 0.43rem no-repeat;
  border-radius: 2px;
}

.icon-light {
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow:
    0 -0.38rem 0 -0.28rem currentColor,
    0 0.38rem 0 -0.28rem currentColor,
    0.38rem 0 0 -0.28rem currentColor,
    -0.38rem 0 0 -0.28rem currentColor;
}

.icon-dark {
  border-radius: 50%;
  box-shadow: inset -0.28rem 0 0 currentColor;
}

.icon-auto {
  border: 1.8px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

.snippet-box {
  position: relative;
}

.snippet-box pre {
  margin: 0;
  padding: 1rem;
  background: #1c2128;
  color: #e6e8eb;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
}

.snippet-box code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  white-space: pre;
}

#copy-button {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
}

#copy-button:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-hover);
}

@media (min-width: 58rem) {
  .playground-layout {
    grid-template-columns: minmax(20rem, 0.9fr) minmax(24rem, 1.1fr);
    align-items: start;
  }

  .panel {
    margin-bottom: 0;
  }

  .output-column {
    display: grid;
    gap: 1.5rem;
  }
}
