:root {
  color-scheme: dark;
  --bg: #11151a;
  --panel: #1b222b;
  --text: #ecf0f4;
  --muted: #9aa7b5;
  --danger: #ff4040;
  --danger-dark: #d63232;
  --outline: #2a3440;
  /* Same assets as myinstants, served locally (Telegram WebView CSP blocks many cross-origin images). */
  --mi-sprite: url("/assets/myinstants/transparent_button_small_sprite.png");
  --mi-shadow: url("/assets/myinstants/transparent_button_small_shadow.png");
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  background: radial-gradient(circle at 20% 0%, #1f2731 0%, var(--bg) 50%);
  color: var(--text);
}

a {
  color: #7cc3ff;
}

.layout {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 14px 28px;
}

.header h1 {
  margin: 0;
  font-size: 28px;
}

.header .subtitle {
  margin: 8px 0 0;
  max-width: 52ch;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

.kicker {
  margin: 0 0 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}

.toolbar {
  margin: 20px 0 12px;
  display: flex;
  gap: 10px;
}

.toolbar input {
  flex: 1;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--outline);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 15px;
}

.chip {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--outline);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
}

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

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.instant {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--outline);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-align: left;
}

.instant.instant-selected {
  border-color: rgba(255, 64, 64, 0.5);
  box-shadow: 0 0 0 1px rgba(255, 64, 64, 0.2);
}

.play-wrap {
  position: relative;
  width: 94px;
  height: 89px;
  flex-shrink: 0;
}

/* Stacked like myinstants result cards */
.small-button-shadow {
  position: absolute;
  inset: 0;
  width: 94px;
  height: 89px;
  margin: 0;
  background: var(--mi-shadow) no-repeat;
  pointer-events: none;
  z-index: 0;
}

.circle.small-button-background {
  width: 86px;
  height: 84px;
  margin-top: 3px;
  margin-left: 3px;
  position: absolute;
  z-index: 1;
  border-radius: 50%;
}

.small-button {
  appearance: none;
  width: 94px;
  height: 89px;
  position: absolute;
  inset: 0;
  background: var(--mi-sprite) no-repeat;
  background-position: -5px -5px;
  border: 0;
  display: block;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
}

.small-button:focus {
  outline: none;
  background: var(--mi-sprite) no-repeat;
  background-position: -5px -5px;
}

.small-button:active {
  background: var(--mi-sprite) no-repeat;
  background-position: -109px -5px;
}

.instant-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}

a.instant-link {
  font-size: 14px;
  line-height: 1.4em;
  max-height: 2.8em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  color: var(--text);
  text-decoration: underline;
  text-align: left;
  word-break: break-word;
}

.send-btn {
  border: 1px solid var(--outline);
  background: #273241;
  color: var(--text);
  border-radius: 9px;
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  cursor: pointer;
  align-self: flex-start;
}

.send-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
