<!DOCTYPE html>
<html>
<head><script>(function(){var n=0;function show(p,m){var el=document.createElement('div');el.style.cssText='position:fixed;left:0;right:0;background:#e04040;color:#fff;padding:6px 12px;z-index:'+(99999-n)+';font:13px/1.4 monospace;white-space:pre-wrap;border-bottom:1px solid #b02020;top:'+n*30+'px';el.textContent=p+m;document.body.appendChild(el);n++}window.onerror=function(msg,src,line){show('ERROR '+(src||'').split('/').pop()+':'+line+' \u2014 ',msg)};window.addEventListener('unhandledrejection',function(e){show('REJECT \u2014 ',e.reason&&e.reason.message||e.reason||'unknown')})})()</script>
<meta charset="utf-8">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: #0d1117;
  color: #e6edf3;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  padding: 24px;
  overflow-y: auto;
}
h1 { font-size: 22px; font-weight: 700; color: #00b8b0; margin-bottom: 2px; }
h2 { font-size: 15px; font-weight: 600; color: #00b8b0; margin-bottom: 8px; }
.subtitle { font-size: 13px; color: #8b949e; margin-bottom: 20px; line-height: 1.5; }
.card {
  padding: 14px 16px;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  margin-bottom: 12px;
}
.accent { color: #00b8b0; }
.bright { color: #00e6dc; }
.muted { color: #8b949e; font-size: 12px; }
.mono { font-family: 'SF Mono', 'Cascadia Code', Consolas, monospace; font-size: 13px; }
.section { margin-bottom: 24px; }

.input-row { display: flex; gap: 8px; align-items: center; }
.input-field {
  font-family: 'SF Mono', 'Cascadia Code', Consolas, monospace;
  font-size: 14px;
  padding: 8px 12px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #00e6dc;
  outline: none;
  width: 180px;
}
.input-field:focus { border-color: #00b8b0; }
.input-suffix { color: #8b949e; font-size: 14px; font-family: 'SF Mono', 'Cascadia Code', Consolas, monospace; }
.preview-url {
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(0,184,176,0.06);
  border: 1px solid rgba(0,184,176,0.2);
  border-radius: 6px;
  font-family: 'SF Mono', 'Cascadia Code', Consolas, monospace;
  font-size: 14px;
  color: #00e6dc;
  transition: all 0.2s;
}

.prompt-card {
  padding: 10px 14px;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 6px;
  margin-bottom: 8px;
  cursor: default;
  transition: all 0.15s;
  position: relative;
}
.prompt-card:hover { border-color: rgba(0,184,176,0.4); background: #1c2128; }
.prompt-card .text { font-size: 13px; color: #e6edf3; padding-right: 10px; }
.prompt-card .desc { font-size: 11px; color: #484f58; margin-top: 3px; }

.validation-ok { color: #3fb950; font-size: 12px; margin-top: 6px; }
.validation-err { color: #f85149; font-size: 12px; margin-top: 6px; }

.footer { text-align: center; color: #484f58; font-size: 11px; margin-top: 24px; padding-top: 16px; border-top: 1px solid #21262d; }
</style>
</head>
<body>

<h1>Try a Subdomain</h1>
<div class="subtitle">Type a subdomain name to preview the URL and validate it against the naming rules.</div>

<div class="section">
  <div class="card">
    <div class="input-row">
      <span class="input-suffix">https://</span>
      <input type="text" class="input-field" id="subdomain-input" placeholder="myapp" autocomplete="off" spellcheck="false">
      <span class="input-suffix">.adom.cloud</span>
    </div>
    <div class="preview-url" id="preview">https://myapp.adom.cloud</div>
    <div id="validation"></div>
  </div>
</div>

<div class="section">
  <h2>Sample Prompts for Claude</h2>
  <div class="muted" style="margin-bottom:10px">Ask Claude any of these to manage your subdomains:</div>

  <div class="prompt-card">
    <div class="text">Create a subdomain called myapp for my viewer on port 8797</div>
    <div class="desc">Provisions myapp.adom.cloud &rarr; your AV server</div>
  </div>

  <div class="prompt-card">
    <div class="text">Set up editor.adom.cloud to point to my VS Code on this container</div>
    <div class="desc">Creates a clean URL for your IDE</div>
  </div>

  <div class="prompt-card">
    <div class="text">Create a subdomain for my wiki service on port 8785</div>
    <div class="desc">Give your wiki a memorable public URL</div>
  </div>

  <div class="prompt-card">
    <div class="text">List all my adom.cloud subdomains</div>
    <div class="desc">See all active mappings</div>
  </div>

  <div class="prompt-card">
    <div class="text">Delete the test subdomain</div>
    <div class="desc">Remove a subdomain and its DNS record</div>
  </div>
</div>

<div class="section">
  <h2>Subdomain Rules</h2>
  <div class="card">
    <div class="muted" style="line-height:1.8">
      <span class="accent">a-z</span> <span class="accent">0-9</span> <span class="accent">-</span> &mdash; lowercase letters, numbers, and hyphens only<br>
      <span class="accent">1&ndash;63</span> characters<br>
      Cannot <span style="color:#f85149">start</span> or <span style="color:#f85149">end</span> with a hyphen<br>
      Reserved: <span style="color:#484f58">www, api, mail, ftp, admin, dashboard, status, health, proxy, cdn, static, assets</span>
    </div>
  </div>
</div>

<div class="footer">Demo &mdash; simulated data</div>

<script>
const RESERVED = ['www','api','mail','ftp','ns1','ns2','admin','dashboard','status','health','proxy','cdn','static','assets'];
const input = document.getElementById('subdomain-input');
const preview = document.getElementById('preview');
const validation = document.getElementById('validation');

input.addEventListener('input', () => {
  const raw = input.value.toLowerCase().replace(/[^a-z0-9-]/g, '').slice(0, 63);
  input.value = raw;
  preview.textContent = raw ? `https://${raw}.adom.cloud` : 'https://_____.adom.cloud';
  preview.style.opacity = raw ? 1 : 0.4;

  if (!raw) {
    validation.innerHTML = '';
    return;
  }

  const errors = [];
  if (raw.startsWith('-')) errors.push('Cannot start with a hyphen');
  if (raw.endsWith('-')) errors.push('Cannot end with a hyphen');
  if (RESERVED.includes(raw)) errors.push(`"${raw}" is a reserved name`);

  if (errors.length) {
    validation.innerHTML = '<div class="validation-err">' + errors.join(' &bull; ') + '</div>';
  } else {
    validation.innerHTML = '<div class="validation-ok">&#10003; Valid subdomain name</div>';
  }
});
</script>
</body>
</html>