.tmg-app{
  --tmg-bg:#090909;
  --tmg-bg-2:#111111;
  --tmg-panel:#151515;
  --tmg-panel-2:#1b1b1b;
  --tmg-border:#2f2f2f;
  --tmg-border-soft:#232323;
  --tmg-text:#f5f5f5;
  --tmg-muted:#aaaaaa;
  --tmg-accent:#e7d7b2;
  --tmg-accent-2:#b89557;
  --tmg-shadow:0 24px 60px rgba(0,0,0,.45);
  font-family:Inter,Arial,sans-serif;
  color:var(--tmg-text);
  max-width:1460px;
  margin:28px auto;
  padding:0 18px;
  box-sizing:border-box;
}
.tmg-app, .tmg-app *{box-sizing:border-box}
.tmg-app .tmg-hidden,.tmg-app .hidden,.tmg-app .tmg-crop-box.hidden,.tmg-app .tmg-preview-panel .hidden,.tmg-modal.hidden{display:none!important}
.tmg-app .tmg-header,.tmg-app .tmg-panel{
  background:linear-gradient(180deg,rgba(30,30,30,.98) 0%, rgba(17,17,17,.98) 100%);
  border:1px solid var(--tmg-border);
  border-radius:24px;
  box-shadow:var(--tmg-shadow);
}
.tmg-app .tmg-header{padding:28px 30px;margin-bottom:20px;position:relative;overflow:hidden}
.tmg-app .tmg-header:before{content:"";position:absolute;inset:-1px auto auto -1px;width:42%;height:2px;background:linear-gradient(90deg,var(--tmg-accent),transparent)}
.tmg-app .tmg-header h2,.tmg-app .tmg-panel h3,.tmg-admin-wrap .tmg-admin-card h2{margin:0 0 8px}
.tmg-app .tmg-header h2{font-size:32px;letter-spacing:.02em;color:#fff}
.tmg-app .tmg-header p,.tmg-app .tmg-preview-head p,.tmg-app .tmg-note,.tmg-app .tmg-status{margin:0;color:var(--tmg-muted)}
.tmg-app .tmg-grid{display:grid;grid-template-columns:470px minmax(0,1fr);gap:20px;align-items:start}
.tmg-app .tmg-panel{padding:24px}
.tmg-app .tmg-panel h3{font-size:22px;color:#fff}
.tmg-app .tmg-field{margin-bottom:16px}
.tmg-app .tmg-field label{display:block;font-weight:700;margin-bottom:8px;color:#ededed}
.tmg-app .tmg-row-2{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.tmg-app .tmg-field input,.tmg-app .tmg-field select,.tmg-app .tmg-btn{width:100%;border-radius:15px;font-size:15px}
.tmg-app .tmg-field input,.tmg-app .tmg-field select{padding:14px 16px;border:1px solid #343434;background:#101010;color:var(--tmg-text);outline:none;box-shadow:inset 0 1px 0 rgba(255,255,255,.03)}
.tmg-app .tmg-field select{padding-right:42px;line-height:1.35;appearance:auto;-webkit-appearance:menulist;background-image:none;text-overflow:ellipsis}
.tmg-app .tmg-field select option{color:#f5f5f5;background:#101010}
.tmg-app .tmg-field input:focus,.tmg-app .tmg-field select:focus{border-color:#6f5b35;box-shadow:0 0 0 3px rgba(184,149,87,.12), inset 0 1px 0 rgba(255,255,255,.03)}
.tmg-app .tmg-btn{padding:14px 18px;border:1px solid #4d3f24;background:linear-gradient(180deg,#b99757 0%,#8a6b35 100%);color:#111;font-weight:800;cursor:pointer;transition:transform .18s ease, box-shadow .18s ease, opacity .18s ease;box-shadow:0 10px 22px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.25)}
.tmg-app .tmg-btn:hover{transform:translateY(-1px);box-shadow:0 14px 28px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.25)}
.tmg-app .tmg-btn:active{transform:translateY(0)}
.tmg-app .tmg-btn-light{background:linear-gradient(180deg,#202020 0%,#141414 100%);color:#f1e7d1;border-color:#393939}
.tmg-app .tmg-generate-buttons{display:grid;gap:12px;margin-top:12px}
.tmg-app .tmg-generate-buttons .tmg-btn{font-size:16px;letter-spacing:.01em}
.tmg-app .tmg-status{margin-top:16px;padding:13px 14px;background:linear-gradient(180deg,#101010 0%,#141414 100%);border:1px solid var(--tmg-border-soft);border-radius:15px}
.tmg-app .tmg-crop-wrap{border:1px solid var(--tmg-border);border-radius:20px;padding:14px;background:linear-gradient(180deg,#101010 0%,#161616 100%)}
.tmg-app .tmg-crop-stage{position:relative;width:100%;aspect-ratio:1/1;overflow:hidden;border-radius:16px;background:radial-gradient(circle at top left, #262626 0%, #0a0a0a 70%);border:1px solid #262626}
.tmg-app .tmg-crop-stage img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;display:none;user-select:none;-webkit-user-drag:none}
.tmg-app .tmg-crop-empty{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:#8f8f8f;padding:20px;text-align:center}
.tmg-app .tmg-crop-box{position:absolute;border:2px solid var(--tmg-accent);box-shadow:0 0 0 9999px rgba(0,0,0,.55);cursor:move;border-radius:2px}
.tmg-app .tmg-handle{position:absolute;width:16px;height:16px;background:var(--tmg-accent);border:2px solid #161616;border-radius:50%;box-shadow:0 4px 10px rgba(0,0,0,.35)}
.tmg-app .tmg-handle.tl{top:-8px;left:-8px;cursor:nwse-resize}.tmg-app .tmg-handle.tr{top:-8px;right:-8px;cursor:nesw-resize}.tmg-app .tmg-handle.bl{bottom:-8px;left:-8px;cursor:nesw-resize}.tmg-app .tmg-handle.br{bottom:-8px;right:-8px;cursor:nwse-resize}
.tmg-app .tmg-crop-actions{display:flex;gap:12px;align-items:center;justify-content:space-between;margin-top:12px}
.tmg-app .tmg-note{font-size:12px;line-height:1.45}
.tmg-app .tmg-preview-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;margin-bottom:16px}
.tmg-app .tmg-preview-head h3{font-size:24px;color:#fff}
.tmg-app .tmg-preview-canvas-wrap{position:relative;min-height:560px;border:1px solid #2c2c2c;border-radius:22px;background:radial-gradient(circle at top left, rgba(255,255,255,.06) 0%, rgba(255,255,255,0) 30%),linear-gradient(180deg,#0d0d0d 0%,#1a1a1a 100%);display:flex;align-items:center;justify-content:center;overflow:hidden;cursor:zoom-in;box-shadow:inset 0 1px 0 rgba(255,255,255,.04)}
.tmg-app .tmg-preview-canvas-wrap canvas{max-width:100%;max-height:78vh;display:block;border-radius:8px}
.tmg-app .tmg-preview-placeholder{position:absolute;color:#8c8c8c;padding:24px;text-align:center}
.tmg-app .tmg-meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:16px}
.tmg-app .tmg-meta>div{padding:12px 14px;background:linear-gradient(180deg,#101010 0%,#181818 100%);border:1px solid #262626;border-radius:15px;color:#cfcfcf}
.tmg-app .tmg-meta strong{color:#fff}
.tmg-modal{position:fixed;inset:0;z-index:99999}
.tmg-modal .tmg-modal-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.8)}
.tmg-modal .tmg-modal-dialog{position:relative;z-index:2;width:min(1280px,94vw);height:min(92vh,900px);margin:4vh auto;background:#111;border:1px solid #2a2a2a;border-radius:24px;display:flex;flex-direction:column;overflow:hidden;box-shadow:0 30px 80px rgba(0,0,0,.55)}
.tmg-modal .tmg-modal-head{display:flex;justify-content:space-between;gap:16px;align-items:center;padding:18px 20px;border-bottom:1px solid #252525;background:linear-gradient(180deg,#191919 0%,#121212 100%)}
.tmg-modal .tmg-modal-head h3{margin:0;color:#fff}
.tmg-modal .tmg-modal-tools{display:flex;gap:8px}.tmg-modal .tmg-modal-tools .tmg-btn{width:auto;padding:10px 14px}
.tmg-modal .tmg-modal-body{flex:1;overflow:hidden;background:linear-gradient(180deg,#0b0b0b 0%,#171717 100%)}
.tmg-modal .tmg-modal-canvas-holder{width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:auto;padding:16px}
.tmg-modal .tmg-modal-canvas-holder img{transform-origin:center center;max-width:none;max-height:none;transition:transform .12s linear;user-select:none;-webkit-user-drag:none}
.tmg-app .tmg-preview-panel .tmg-btn{width:auto}
.tmg-app .tmg-tile-chooser{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.tmg-app .tmg-tile-option{position:relative;display:block;padding:14px 16px;border:1px solid #2e2e2e;border-radius:18px;background:linear-gradient(180deg,#141414 0%,#101010 100%);cursor:pointer;box-shadow:inset 0 1px 0 rgba(255,255,255,.03),0 8px 18px rgba(0,0,0,.16);transition:all .18s ease}
.tmg-app .tmg-tile-option:hover{transform:translateY(-1px);border-color:#57492c}
.tmg-app .tmg-tile-option input{position:absolute;opacity:0;pointer-events:none}
.tmg-app .tmg-tile-option.is-active{border-color:#8e6d36;box-shadow:0 0 0 1px rgba(185,151,87,.35),0 14px 28px rgba(0,0,0,.25),inset 0 1px 0 rgba(255,255,255,.05)}
.tmg-app .tmg-tile-option-title{display:block;font-weight:800;color:#f5f5f5;margin-bottom:4px}
.tmg-app .tmg-tile-option-meta{display:block;color:#b7b7b7;font-size:12px;letter-spacing:.03em;text-transform:uppercase}
.tmg-app .tmg-color-panel{margin-top:18px;border:1px solid #252525;background:linear-gradient(180deg,#101010 0%,#171717 100%);border-radius:18px;padding:16px}
.tmg-app .tmg-color-panel-head{display:flex;justify-content:space-between;gap:16px;align-items:center;margin-bottom:12px}.tmg-app .tmg-color-panel-head h4{margin:0;font-size:18px;color:#fff}
.tmg-app .tmg-color-list{display:grid;gap:8px;max-height:340px;overflow:auto;padding-right:4px}
.tmg-app .tmg-color-row{display:grid;grid-template-columns:18px 1fr auto;gap:10px;align-items:center;padding:8px 10px;border:1px solid #252525;background:#121212;border-radius:12px}
.tmg-app .tmg-color-swatch{width:18px;height:18px;border-radius:5px;border:1px solid rgba(255,255,255,.15)}
.tmg-app .tmg-color-code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;color:#efefef;font-size:13px}
.tmg-app .tmg-color-count{color:#c5c5c5;font-size:13px}
@media (max-width:1100px){.tmg-app .tmg-grid{grid-template-columns:1fr}.tmg-app .tmg-preview-canvas-wrap{min-height:440px}}
@media (max-width:700px){.tmg-app .tmg-tile-chooser{grid-template-columns:1fr}}
@media (max-width:640px){.tmg-app .tmg-row-2,.tmg-app .tmg-meta{grid-template-columns:1fr}.tmg-app .tmg-crop-actions,.tmg-app .tmg-preview-head,.tmg-modal .tmg-modal-head{flex-direction:column;align-items:stretch}.tmg-modal .tmg-modal-tools{flex-wrap:wrap}}
