/* 字体定义 */
@font-face {
  font-family: "HarmonyOS Sans";
  src: url("https://infopanel.lsy223622.com/HarmonyOS_Sans_SC_Regular.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "HarmonyOS Sans";
  src: url("https://infopanel.lsy223622.com/HarmonyOS_Sans_SC_Bold.woff2") format("woff2");
  font-weight: bold;
  font-style: normal;
}

/* 全局样式 */
html,
body {
  height: 100vh;
  margin: 0;
  padding: 0;
}

body {
  font-family: "HarmonyOS Sans", "Helvetica Neue", Arial, sans-serif;
  background-color: #f0f0f0;
  color: #333;
  display: flex;
  flex-direction: column;
}

h2 {
  color: #2c3e50;
  margin-top: 0;
}

textarea {
  font-family: inherit;
}

/* 布局 */
.container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 20px;
  height: 100vh;
  padding: 20px;
  box-sizing: border-box;
}

.panel {
  background-color: white;
  border-radius: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 15px 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.large {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  max-width: 100%;
  width: max-content;
  justify-self: center;
  overflow: hidden;
}

.small {
  display: flex;
  flex-direction: column;
}

.small h2 {
  margin-bottom: 10px;
}

.small > div,
.small > ul {
  flex-grow: 1;
  overflow-y: auto;
  word-wrap: break-word;
}

/* 日期时间 */
#datetime-box {
  width: max-content;
}

#date,
#time {
  color: #069;
  font-weight: bold;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#date {
  font-size: 4.5vw;
  text-align: left;
  margin-top: +1vw;
  margin-bottom: -1vw;
}

#time {
  font-size: 20vw;
  text-align: center;
  line-height: 1;
}

#seconds {
  font-size: 7vw;
  vertical-align: baseline;
}

/* 按钮和小部件 */
.top-buttons-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
}

.right-buttons {
  display: flex;
}

.circle-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: white;
  color: #069;
  border: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  margin-left: 5px;
  transition: background-color 0.3s, color 0.3s;
}

.circle-button:hover,
.circle-button:active {
  background-color: #f0f0f0;
  color: #000;
}

.circle-button:active:hover {
  background-color: white;
  color: #069;
}

.weather-widget {
  display: flex;
  align-items: center;
  background-color: white;
  border-radius: 20px;
  padding: 5px 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.weather-icon {
  font-size: 1.5em;
  margin-right: 10px;
}

.temperature {
  font-size: 1.2em;
  font-weight: bold;
}

/* 待办事项列表 */
#todo-list {
  list-style-type: none;
  padding-left: 0;
  margin: 0;
}

#todo-list li {
  margin-bottom: 5px;
  word-break: break-word;
}

.edit-button {
  float: right;
  background-color: #069;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 0.6em;
  cursor: pointer;
}

.edit-button:hover,
.edit-button:active {
  background-color: #0056b3;
}

.edit-button:active:hover {
  background-color: #069;
}

/* 课程表 */
.panel.small#schedule {
  padding: 15px;
}

.class-item {
  background-color: #eee;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 0.5rem;
  margin-left: 0rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.class-name {
  font-size: 2rem;
  font-weight: bold;
  margin: 0.5rem 0.75rem 0.25rem 0.75rem;
}

.class-time,
.class-location {
  font-size: 1rem;
  margin: 0 0.8rem 0.4rem 0.8rem;
}

#schedule h2 {
  margin-bottom: 5px;
}

/* 编辑文本区域 */
.edit-textarea {
  width: 100%;
  height: 100%;
  padding: 10px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 16px;
  resize: none;
}

.edit-textarea:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}

/* Markdown 渲染样式 */
.markdown-content h1 {
  margin-block-start: 0.44em;
  margin-block-end: 0.89em;
}

.markdown-content ul,
.markdown-content ol {
  padding-inline-start: 20px;
}

/* 系统图表 */
#system-charts {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  height: 100%;
}

.chart-container {
  width: 30%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chart-label {
  font-size: 0.9em;
  font-weight: bold;
  text-align: center;
  margin-bottom: 5px;
}

.chart {
  width: 100%;
  height: auto;
}

.chart-background {
  fill: none;
  stroke: #eee;
  stroke-width: 3.8;
}

.chart-value {
  fill: none;
  stroke: #36A2EB;
  stroke-width: 2.8;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dasharray 0.5s ease;
}

.chart-text {
  font-size: 0.45em;
  text-anchor: middle;
  font-weight: bold;
}

/* 大文本覆盖层 */
#large-text-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #f0f0f0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#large-text-overlay.hidden {
  display: none;
}

.large-text-content {
  width: 90%;
  height: 90%;
  display: flex;
  flex-direction: column;
}

#large-text {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: 100vw;
  font-weight: bold;
  color: #069;
  line-height: 1.2;
  overflow-y: auto;
  height: 100%;
}

.large-text-line {
  text-align: center;
  white-space: nowrap;
  width: 100%;
  word-break: break-all;
}

.large-text-buttons {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.large-text-buttons button {
  margin-left: 5px;
}

.large-text-edit {
  width: 100%;
  height: 100%;
  font-size: 5vw;
  padding: 20px;
  box-sizing: border-box;
  border: none;
  resize: none;
}

/* 暗黑模式 */
body.dark-mode {
  background-color: #333;
  color: #f0f0f0;
}

body.dark-mode .panel,
body.dark-mode .weather-widget,
body.dark-mode .circle-button {
  background-color: #444;
  color: #f0f0f0;
}

body.dark-mode #date,
body.dark-mode #time {
  color: #5bf;
}

body.dark-mode h2 {
  color: #fff;
}

body.dark-mode .circle-button:hover,
body.dark-mode .circle-button:active {
  background-color: #555;
  color: #08c;
}

body.dark-mode .circle-button:active:hover {
  background-color: #444;
  color: #f0f0f0;
}

body.dark-mode .class-item {
  background-color: #555;
}

body.dark-mode #large-text-overlay {
  background-color: #333;
  color: #f0f0f0;
}

body.dark-mode .large-text-buttons button {
  background-color: #5bf;
}

body.dark-mode #large-text {
  color: #5bf;
}

/* 移动设备触摸优化 */
@media (hover: none) {
  .circle-button:hover {
    background-color: white;
    color: #069;
  }
  .edit-button:hover {
    background-color: #0056b3;
  }
  body.dark-mode .circle-button:hover {
    background-color: #444;
    color: #f0f0f0;
  }
}