/* ========== 色变量 ========== */
:root{
  --primary:#4A6CF7;
  --primary-dark:#3458D6;
  --purple:#6C5CE7;
  --accent:#00C9A7;
  --bg-gradient:linear-gradient(135deg,#EEF2FF 0%,#F5F3FF 50%,#DBEAFE 100%);
  --card-bg:#FFFFFF;
  --card-bg-2:#F5F3FF;
  --text:#1E293B;
  --text-sub:#64748B;
  --text-light:#94A3B8;
  --border:rgba(0,0,0,.06);
  --gray5:#E2E8F0;
  --gray6:#F1F5F9;
  --green:#10B981;
  --red:#EF4444;
  --shadow-card:0 8px 30px rgba(74,108,247,.08);
  --shadow-btn:0 6px 20px rgba(74,108,247,.3);
}

@media (prefers-color-scheme: dark){
  :root{
    --primary:#0A84FF;
    --purple:#8B5CF6;
    --accent:#14B8A6;
    --bg-gradient:linear-gradient(135deg,#0B1220 0%,#131A2E 50%,#0F172A 100%);
    --card-bg:#1E293B;
    --card-bg-2:#0F172A;
    --text:#E2E8F0;
    --text-sub:#94A3B8;
    --text-light:#64748B;
    --border:rgba(148,163,184,.15);
    --gray5:#334155;
    --gray6:#1E293B;
    --shadow-card:0 8px 30px rgba(0,0,0,.3);
    --shadow-btn:0 6px 20px rgba(10,132,255,.3);
  }
}

*{
  margin:0;padding:0;box-sizing:border-box;
  -webkit-tap-highlight-color:transparent;
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","PingFang SC","Helvetica Neue",Helvetica,Arial,sans-serif;
}

/* ========== 背景（渐变，无滤镜） ========== */
body{
  background:var(--bg-gradient);
  background-attachment:fixed;
  color:var(--text);
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
  position:fixed;
  width:100%;height:100%;
  overflow:hidden;
}

.container{
  max-width:680px;
  margin:0 auto;
  padding:20px;
  height:calc(100% - env(safe-area-inset-bottom));
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  padding-bottom:calc(50px + env(safe-area-inset-bottom));
}

/* ========== 标题（渐变文字） ========== */
.title{
  text-align:center;
  font-size:34px;
  font-weight:800;
  margin:30px 0;
  letter-spacing:-0.02em;
  background:linear-gradient(135deg,#4A6CF7,#6C5CE7,#00C9A7);
  -webkit-background-clip:text;
  background-clip:text;
  -webkit-text-fill-color:transparent;
  color:transparent;
}

/* ========== 卡片 ========== */
.card{
  background:var(--card-bg);
  border-radius:20px;
  padding:24px;
  margin-bottom:24px;
  box-shadow:var(--shadow-card);
  border:1px solid var(--border);
}

.form-group{margin-bottom:24px;}

.label{
  display:block;
  margin-bottom:8px;
  color:var(--text-sub);
  font-size:15px;
  font-weight:600;
}

.file-input{position:relative;width:100%;}
.file-input input[type=file]{position:absolute;left:-9999px;}

/* ========== 按钮 ========== */
.btn{
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  padding:12px 16px;
  border:none;
  border-radius:12px;
  font-size:17px;
  font-weight:600;
  cursor:pointer;
  transition:all .2s ease;
  text-align:center;
  font-family:inherit;
}

.btn-secondary{
  background:#F1F5F9;
  color:var(--text);
  border:1px solid #E2E8F0;
}

@media (prefers-color-scheme: dark){
  .btn-secondary{
    background:#334155;
    color:#E2E8F0;
    border-color:#475569;
  }
}

/* 主按钮：渐变 */
.btn-primary{
  background:linear-gradient(135deg,#4A6CF7,#6C5CE7);
  color:#FFFFFF;
  box-shadow:var(--shadow-btn);
}

.btn-primary:hover{
  transform:translateY(-1px);
  box-shadow:0 8px 24px rgba(74,108,247,.4);
}

.btn:active{
  transform:scale(.98);
  opacity:.95;
}

.file-name{
  margin-top:8px;
  text-align:center;
  color:var(--text-light);
  font-size:13px;
}

/* ========== 底部说明（渐变底） ========== */
.note-box{
  text-align:center;
  margin-top:24px;
  padding:16px;
  background:linear-gradient(135deg,rgba(74,108,247,.08),rgba(108,92,231,.08));
  border-radius:14px;
  border:1px solid rgba(74,108,247,.15);
}

.note-box p{
  color:var(--text-sub);
  font-size:13px;
}

/* ========== 输入框 ========== */
.input{
  width:100%;
  padding:14px 16px;
  border:1px solid var(--gray5);
  border-radius:12px;
  font-size:17px;
  color:var(--text);
  background:#F8FAFC;
  transition:all .2s ease;
  appearance:none;
  font-family:inherit;
}

@media (prefers-color-scheme: dark){
  .input{background:#0F172A;border-color:#334155;}
}

.input:focus{
  outline:none;
  border-color:var(--primary);
  background:#FFFFFF;
  box-shadow:0 0 0 3px rgba(74,108,247,.15);
}

@media (prefers-color-scheme: dark){
  .input:focus{background:#1E293B;}
}

/* ========== 弹窗 ========== */
.modal{
  position:fixed;
  top:0;left:0;
  width:100%;height:100%;
  background:rgba(15,23,42,.55);
  z-index:1000;
  display:none;
  overflow-y:auto;
  padding:20px;
}

.modal-content{
  position:relative;
  background:var(--card-bg);
  padding:24px;
  border-radius:20px;
  max-width:1200px;
  margin:20px auto;
  box-shadow:0 20px 60px rgba(0,0,0,.2);
  width:calc(100% - 40px);
  border:1px solid var(--border);
}

.modal-header{
  padding-bottom:16px;
  border-bottom:1px solid var(--border);
  margin-bottom:16px;
}

.modal-header h3{
  font-size:20px;
  font-weight:700;
  background:linear-gradient(135deg,#4A6CF7,#6C5CE7);
  -webkit-background-clip:text;
  background-clip:text;
  -webkit-text-fill-color:transparent;
  color:transparent;
}

.close{
  position:absolute;
  right:20px;top:20px;
  width:32px;height:32px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  color:var(--text-sub);
  cursor:pointer;
  background:#F1F5F9;
  font-size:20px;
  line-height:1;
  transition:all .2s;
}

.close:hover{background:#E2E8F0;transform:rotate(90deg);}

@media (prefers-color-scheme: dark){
  .close{background:#334155;}
}

/* ========== 结果区块 ========== */
.result-section{
  margin-bottom:20px;
  padding:20px;
  background:#F8FAFC;
  border-radius:14px;
  border:1px solid var(--border);
}

@media (prefers-color-scheme: dark){
  .result-section{background:rgba(15,23,42,.5);}
}

.result-section h5{
  font-size:17px;
  font-weight:700;
  color:var(--text);
  margin-bottom:16px;
  display:flex;
  align-items:center;
  gap:8px;
}

/* 标题左侧渐变小条 */
.result-section h5::before{
  content:'';
  width:4px;height:18px;
  background:linear-gradient(180deg,#4A6CF7,#6C5CE7);
  border-radius:2px;
}

.result-section p{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 0;
  border-bottom:1px solid var(--border);
  font-size:15px;
  gap:12px;
}

.result-section p:last-child{border-bottom:none;}

.result-section strong{
  color:var(--text-sub);
  font-weight:500;
  flex-shrink:0;
}

.result-section p > span{
  text-align:right;
  word-break:break-all;
  color:var(--text);
}

@media (min-width:768px){
  .cert-sections-wrapper{display:flex;gap:20px;margin-bottom:20px;}
  .cert-sections-wrapper .result-section{flex:1;margin-bottom:0;}
  .permissions-section{width:100%;}
}

/* ========== 权限列表 ========== */
.result-section ul{
  list-style:none;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-top:16px;
}

@media (min-width:768px){
  .permissions-section ul{
    grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
  }
}

.result-section li{
  background:var(--card-bg);
  border-radius:10px;
  font-size:14px;
  color:var(--text);
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 16px;
  border:1px solid var(--gray5);
  height:44px;
  white-space:nowrap;
  overflow:hidden;
}

.result-section li.allowed{
  border-color:rgba(16,185,129,.35);
  background:rgba(16,185,129,.05);
}

.result-section li.denied{
  border-color:rgba(239,68,68,.25);
  background:rgba(239,68,68,.04);
}

.result-section li > span:first-child{
  overflow:hidden;
  text-overflow:ellipsis;
  padding-right:8px;
  flex:1;
}

.result-section li .status{
  display:flex;
  align-items:center;
  font-weight:500;
  flex-shrink:0;
  min-width:60px;
  justify-content:flex-end;
}

.status-indicator{
  width:8px;height:8px;
  border-radius:50%;
  margin-right:6px;
  flex-shrink:0;
}

.status-indicator.allowed{
  background:var(--green);
  box-shadow:0 0 8px rgba(16,185,129,.5);
}

.status-indicator.denied{
  background:var(--red);
  box-shadow:0 0 8px rgba(239,68,68,.4);
}

.status-text{min-width:44px;text-align:right;}
.status-text.allowed{color:var(--green);font-weight:600;}
.status-text.denied{color:var(--red);}

/* ========== 状态文字 ========== */
span.status-success{color:var(--green)!important;font-weight:600;}
span.status-error{color:var(--red)!important;font-weight:600;}

/* ========== 错误提示 ========== */
.error-toast{
  position:fixed;
  top:50%;left:50%;
  transform:translate(-50%,-50%);
  background:linear-gradient(135deg,#EF4444,#DC2626);
  color:#FFFFFF;
  padding:16px 24px;
  border-radius:14px;
  z-index:1001;
  display:none;
  text-align:center;
  max-width:80%;
  font-size:16px;
  font-weight:500;
  box-shadow:0 10px 30px rgba(239,68,68,.3);
}

/* ========== 按钮 loading ========== */
.btn-loading{
  position:relative;
  color:transparent!important;
  pointer-events:none;
}

.btn-loading::after{
  content:'';
  position:absolute;
  width:24px;height:24px;
  border:2px solid rgba(255,255,255,.3);
  border-radius:50%;
  border-top-color:#FFFFFF;
  animation:spin .8s linear infinite;
}

@keyframes spin{to{transform:rotate(360deg);}}

/* ========== 展开内容 ========== */
.expandable-content{
  max-height:0;
  overflow:hidden;
  transition:all .3s cubic-bezier(.4,0,.2,1);
  background:var(--card-bg-2);
  border-radius:10px;
  margin-top:8px;
}

.expandable-content.expanded{
  max-height:200px;
  padding:16px;
}

.expand-trigger{
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px;
  background:var(--card-bg-2);
  border-radius:10px;
  margin:8px 0;
  font-size:15px;
  font-weight:500;
  color:var(--text);
}

.expand-trigger::after{
  content:'';
  width:8px;height:8px;
  border-right:2px solid var(--text-sub);
  border-bottom:2px solid var(--text-sub);
  transform:rotate(45deg);
  transition:transform .3s ease;
}

.expand-trigger.expanded::after{transform:rotate(-135deg);}

/* ========== UDID 列表 ========== */
.cert-list{
  display:flex!important;
  flex-direction:column!important;
  gap:10px;
}

.cert-list li{
  padding:14px 16px;
  background:var(--card-bg);
  border-radius:10px;
  font-size:13px;
  line-height:1.5;
  color:var(--text);
  border:1px solid var(--gray5);
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;
  word-break:break-all;
  height:auto!important;
}

/* ========== 小注释 ========== */
.note{
  font-size:12px;
  color:var(--text-light);
  line-height:1.4;
  margin-top:8px;
  display:block!important;
  text-align:left!important;
  border-bottom:none!important;
  padding:0!important;
}

/* ========== 手机端 ========== */
@media (max-width:480px){
  .container{padding:16px;}
  .title{font-size:26px;margin:24px 0;}
  .card{padding:20px;border-radius:16px;}
  .btn{font-size:15px;padding:12px;}
  .result-section{padding:16px;}
  .result-section h5{font-size:15px;}
  .result-section p,
  .result-section li{font-size:13px;}
  .result-section ul{grid-template-columns:1fr 1fr;gap:8px;}
  .result-section li{padding:10px 12px;height:40px;}
  .status{min-width:52px;}
  .status-text{min-width:36px;}
  .modal-content{width:100%;padding:18px;margin:10px auto;}
}

/* ========== 防选中（保留原功能） ========== */
body,div,p,span,h1,h2,h3,h4,h5,h6,a,img{
  -webkit-user-select:none!important;
  -moz-user-select:none!important;
  -ms-user-select:none!important;
  user-select:none!important;
}
input,textarea{
  -webkit-user-select:text!important;
  -moz-user-select:text!important;
  -ms-user-select:text!important;
  user-select:text!important;
}
body{-webkit-touch-callout:none!important;}