@font-face {
  font-family: "GuangyaFont";
  src: url("https://static.guangya.cc/ziti.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: var(--app-font-family);
  
  /* 🎨 重新调配的高级暗色主题配色 */
  --page-background-color: #010409;
  --panel-border-color: #30363d;                  /* 细腻柔和的边框色 */
  --panel-background-color: #0d1117;              /* 深邃的高级画布底色 */
  --text-color: #c9d1d9;                          /* 柔和的主文字色，告别刺眼纯白 */
  --text-muted-color: #8b949e;                    /* 次要文字、状态色 */
  
  --table-header-background: #161b22;             /* 表头微区分的底色 */
  
  /* Tab 按钮状态配色 */
  --tab-background-color: #161b22;                
  --tab-hover-background-color: #21262d;          
  --tab-active-background-color: #0d1117;         /* 激活时与面板融为一体 */
  
  --tab-focus-color: #58a6ff;                     /* 高级柔和的聚焦蓝 */
  --tab-focus-background-color: #1f2937;          /* 按钮聚焦时的柔和底色 */
  --panel-focus-background-color: #11161d;        /* 面板内部聚焦时的微变底色 */

  --table-font-size: 0.86rem;
  --spinner-track-color: rgba(201, 209, 217, 0.15);
  --spinner-color: #58a6ff;

  --processing-waiting-color: #8b949e;
  --processing-processing-color: #58a6ff;
  --processing-success-color: #3fb950;
  --processing-failed-color: #f85149;
  --login-status-color: #f2cc60;
  --login-button-background-start-color: #238636;
  --login-button-background-end-color: #2ea043;
  --login-button-hover-start-color: #2ea043;
  --login-button-hover-end-color: #3fb950;
  --login-button-active-color: #1f6f32;
  --login-button-border-color: #3fb950;
  --login-button-text-color: #ffffff;
  --login-button-disabled-background-color: #30363d;
  --login-button-disabled-border-color: #484f58;
  --login-button-disabled-text-color: #8b949e;
  --login-button-focus-shadow-color: rgba(46, 160, 67, 0.35);
  --dialog-background-color: #0d1117;
  --dialog-border-color: #30363d;
  --dialog-shadow-color: rgba(1, 4, 9, 0.45);
  --dialog-backdrop-color: rgba(1, 4, 9, 0.75);
  --qrcode-prompt-color: #b08800;
  --qrcode-background-color: #ffffff;
  --app-font-family: "GuangyaFont", sans-serif;
}

#login_status {
  color: var(--login-status-color);
  text-align: center;
}

#login_button {
  align-self: center;
  width: fit-content;
  min-width: 5.5rem;
  padding: 0.55rem 1.35rem;
  border: 1px solid var(--login-button-border-color);
  border-radius: 0.55rem;
  background: linear-gradient(
    135deg,
    var(--login-button-background-start-color),
    var(--login-button-background-end-color)
  );
  color: var(--login-button-text-color);
  font: inherit;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  box-shadow: 0 0.25rem 0.7rem var(--login-button-focus-shadow-color);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease,
    transform 0.1s ease;
}

#login_button:hover:not(:disabled) {
  border-color: var(--login-button-hover-end-color);
  background: linear-gradient(
    135deg,
    var(--login-button-hover-start-color),
    var(--login-button-hover-end-color)
  );
  box-shadow: 0 0.35rem 0.9rem var(--login-button-focus-shadow-color);
}

#login_button:active:not(:disabled) {
  background: var(--login-button-active-color);
  transform: translateY(1px);
}

#login_button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--login-button-focus-shadow-color);
}

#login_button:disabled {
  border-color: var(--login-button-disabled-border-color);
  background: var(--login-button-disabled-background-color);
  color: var(--login-button-disabled-text-color);
  cursor: wait;
  box-shadow: none;
}

#qrcode_dialog {
  z-index: 1000;
  border: 1px solid var(--dialog-border-color);
  border-radius: 0.75rem;
  padding: 1.25rem;
  background: var(--dialog-background-color);
  color: var(--text-color);
  box-shadow: 0 0.75rem 2rem var(--dialog-shadow-color);
  text-align: center;
}

#qrcode_dialog::backdrop {
  background: var(--dialog-backdrop-color);
}

#qrcode_dialog h2 {
  margin-top: 0;
}

#qrcode_dialog canvas {
  display: block;
  width: 240px;
  height: 240px;
  margin: 1rem auto;
  background: var(--qrcode-background-color);
}

.qrcode_dialog_prompt {
  margin: 0 0 1rem;
  color: var(--qrcode-prompt-color);
}

#qrcode_close_button {
  padding: 0.45rem 1rem;
  border: 1px solid var(--panel-border-color);
  border-radius: 0.45rem;
  background: var(--tab-background-color);
  color: var(--text-color);
  cursor: pointer;
}

#qrcode_close_button:hover {
  background: var(--tab-hover-background-color);
}

.page_header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  min-height: 3rem;
}

.page_header h1 {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  text-align: center;
}

.page_header h2 {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  margin: 0;
}

.page_header h2 a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 2rem;
}

html {
  height: 100%;
}

body {
  height: 100%;
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  background: var(--page-background-color);
  color: var(--text-color);
}

button,
input,
textarea,
select {
  font-family: inherit;
}

main {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100vh;
  box-sizing: border-box;
  padding: 1rem;
  overflow: hidden;
}

.tab_buttons {
  display: flex;
  gap: 0.35rem;
  margin-top: 1rem;
  border-bottom: 1px solid var(--panel-border-color);
}

.tab_buttons button {
  margin-bottom: -1px;
  padding: 0.5rem 1rem;
  border: 1px solid var(--panel-border-color);
  border-radius: 0.5rem 0.5rem 0 0;
  background: var(--tab-background-color);
  color: var(--text-muted-color);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab_buttons button:hover {
  background: var(--tab-hover-background-color);
  color: var(--text-color);
}

/* 按钮聚焦：底色微变 + 细腻边框，告别生硬粗线 */
.tab_buttons button:focus {
  background: var(--tab-focus-background-color);
  border-color: var(--tab-focus-color);
  color: var(--text-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

.tab_buttons button[aria-selected="true"] {
  border-bottom-color: var(--panel-background-color);
  background: var(--tab-active-background-color);
  color: var(--text-color);
  font-weight: 500;
}

/* 选中状态下获得焦点时协调过渡 */
.tab_buttons button[aria-selected="true"]:focus {
  background: var(--tab-focus-background-color);
  border-color: var(--tab-focus-color);
}

.tab_panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  margin-top: 0;
  padding: 1rem;
  border: 1px solid var(--panel-border-color);
  border-top: 0;
  border-radius: 0 0 0.5rem 0.5rem;
  background: var(--panel-background-color);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

#log_tab_panel {
  display: none;
}

#problem_tab_panel {
  display: flex;
}

/* 面板内部元素聚焦时（如 input / textarea），面板底色微妙泛光 */
.tab_panel:focus-within {
  background: var(--panel-focus-background-color);
  border-color: var(--tab-focus-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--table-font-size);
}

th,
td {
  border: 1px solid var(--panel-border-color);
  padding: 0.5rem;
  text-align: left;
  vertical-align: top;
  color: var(--text-color);
}

th {
  background: var(--table-header-background);
  font-weight: 600;
  color: var(--text-color);
}

.processing_file_row[data-processing-status="waiting"] td {
  color: var(--processing-waiting-color);
}

.problem_share_row[data-processing-status="waiting"] td,
.problem_share_row[data-processing-status="waiting"] a {
  color: var(--processing-waiting-color);
}

.processing_file_row[data-processing-status="processing"] td {
  color: var(--processing-processing-color);
}

.problem_share_row[data-processing-status="processing"] td,
.problem_share_row[data-processing-status="processing"] a {
  color: var(--processing-processing-color);
}

.processing_file_row[data-processing-status="success"] td {
  color: var(--processing-success-color);
}

.problem_share_row[data-processing-status="success"] td,
.problem_share_row[data-processing-status="success"] a {
  color: var(--processing-success-color);
}

.processing_file_row[data-processing-status="failed"] td {
  color: var(--processing-failed-color);
}

.problem_share_row[data-processing-status="failed"] td,
.problem_share_row[data-processing-status="failed"] a {
  color: var(--processing-failed-color);
}

input, textarea {
  background: #161b22;
  border: 1px solid var(--panel-border-color);
  color: var(--text-color);
  border-radius: 0.35rem;
  padding: 0.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, textarea:focus {
  border-color: var(--tab-focus-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.25);
}

input {
  max-width: 100%;
  box-sizing: border-box;
}

textarea {
  width: 100%;
  min-height: 24rem;
  box-sizing: border-box;
  resize: vertical;
  font: inherit;
}

.problem_columns {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
  min-height: 0;
  align-items: stretch;
}

.problem_column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.problem_column h3 {
  margin-top: 0;
  color: var(--text-color);
  font-size: 1.1rem;
}

.table_scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.table_scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.processing_spinner {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  border: 0.14em solid var(--spinner-track-color);
  border-top-color: var(--spinner-color);
  border-radius: 50%;
  animation: processing_spinner_rotation 0.8s linear infinite;
  vertical-align: -0.1em;
}

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

@media (max-width: 800px) {
  .problem_columns {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  }
}
